# CAN I

## Syntax

```sql
CAN I [
    [ 
        CREATE_DATABASE
        | CREATE_STORE
        | CREATE_SCHEMA_REGISTRY
        | CREATE_DESCRIPTOR_SOURCE
        | CREATE_FUNCTION_SOURCE
        | CREATE_FUNCTION
        | CREATE_CONNECTOR
        | CREATE_QUERY
        | MANAGE_MEMBERS
        | MANAGE_GRANTS
    ]
    | [
        [ USE | CREATE IN | SELECT FROM | INSERT INTO | DROP ]
        [
            DATABASE
            | SCHEMA
            | STORE
            | DESCRIPTOR_SOURCE
            | QUERY
            | RELATION
            | FUNCTION_SOURCE
            | FUNCTION
            | ROLE
            | REGION
        ] target_name
    ]
];
```

## Description

This command shows whether the current [Access Control](/overview/core-concepts/access-control.md#user) can execute specific commands in the current [Access Control](/overview/core-concepts/access-control.md#organiation).

### Arguments <a href="#parameters" id="parameters"></a>

#### target\_name

Name of the object to use for testing authorization for the privilege target. Use this only for testing authorization of a privilege type, — for example, `USE`.

## Examples

#### Check whether the user can create a database

```bash
<no-db>/<no-store># CAN I CREATE_DATABASE;
+------------+
|  Can I     |
+============+
| true       |
+------------+
```

#### Check whether the user can create a query

```bash
<no-db>/<no-store># CAN I CREATE_QUERY;
+------------+
|  Can I     |
+============+
| true       |
+------------+
```

#### Check whether the user with the current role can create objects in another role

```
<no-db>/<no-store># CAN I CREATE IN ROLE useradmin;
+------------+
|  Can I     |
+============+
| false      |
+------------+
```

#### Check whether user has USAGE privilege on a database

```bash
<no-db>/<no-store># CAN I USE DATABASE db;
+------------+
|  Can I     |
+============+
| true       |
+------------+
```

#### Check whether user can user another role

```bash
<no-db>/<no-store># CAN I USE ROLE useradmin;
+------------+
|  Can I     |
+============+
| false      |
+------------+
```

#### Check whether user can drop a database

```bash
main_db.public/pub_demo_msk# CAN I DROP DATABASE user_db;
+------------+
|  Can I     |
+============+
| false      |
+------------+
```

#### Check whether user can select from an existing relation

```bash
db.public/<no-store># CAN I SELECT FROM RELATION pageviews;
+------------+
|  Can I     |
+============+
| true       |
+------------+
```

#### Check whether user can insert records into an existing relation

```bash
db.public/<no-store># CAN I INSERT INTO RELATION pageviews;
+------------+
|  Can I     |
+============+
| true       |
+------------+
```

#### Check whether user can manage grants

```bash
db.public/<no-store># CAN I MANAGE_GRANTS;
+------------+
|  Can I     |
+============+
| false      |
+------------+
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.deltastream.io/reference/sql-syntax/command/can-i.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
