# CREATE ROLE

## Syntax

```sql
CREATE ROLE [IF NOT EXISTS] role_name
[WITH (createRoleOption [, ...])];
```

## Description <a href="#description" id="description"></a>

Creates a new [custom role](/overview/core-concepts/access-control.md#custom-roles) within the [organization](/overview/core-concepts/access-control.md#_organiation). Requires [MANAGE\_MEMBERS](/overview/core-concepts/access-control.md#available-privileges) privilege.

### Arguments

#### WITH (createRoleOption \[, …​])

| Parameter Name                | Description                                                                                                                                                                                                                                                                                                                                           |
| ----------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `IN ROLE (role_name [, ...])` | <p>One or more existing roles to which the new role is added as a new member.<br><br><strong>Default value:</strong> Empty list</p><p><strong>Type:</strong> List of <code>STRING</code></p><p><strong>Valid values:</strong> See list of existing roles with <a data-mention href="/pages/VqwCIosvUQkC2nR6FFJD">/pages/VqwCIosvUQkC2nR6FFJD</a>.</p> |
| `ROLE (role_name [, ...])`    | <p>One or more existing roles that are added as members of the new role.<br><br><strong>Default value:</strong> Empty list</p><p><strong>Type:</strong> List of <code>STRING</code></p><p><strong>Valid values:</strong> See list of existing roles with <a data-mention href="/pages/VqwCIosvUQkC2nR6FFJD">/pages/VqwCIosvUQkC2nR6FFJD</a>.</p>      |

## Examples <a href="#example" id="example"></a>

#### Create a new role

```sh
<no-db>/<no-store># USE ROLE useradmin;
+------------+------------+------------+------------------------+
|  Type      |  Name      |  Command   |  Summary               |
+============+============+============+========================+
| role       | useradmin  | USE        | using role "useradmin" |
+------------+------------+------------+------------------------+
<no-db>/<no-store># CREATE ROLE IF NOT EXISTS new_role;
+------------+------------+------------+------------------------------------------+
|  Type      |  Name      |  Command   |  Summary                                 |
+============+============+============+==========================================+
| role       | new_role   | CREATE     | role "new_role" was successfully created |
+------------+------------+------------+------------------------------------------+
```

#### Create a new role under *SysAdmin*

```sh
<no-db>/<no-store># USE ROLE useradmin;
+------------+------------+------------+----------------------+
|  Type      |  Name      |  Command   |  Summary             |
+============+============+============+======================+
| role       | useradmin  | USE        | using role useradmin |
+------------+------------+------------+----------------------+
<no-db>/<no-store># CREATE ROLE IF NOT EXISTS cust_role WITH (IN ROLE (sysadmin));
+------------+------------+------------+------------------------------------------+
|  Type      |  Name      |  Command   |  Summary                                 |
+============+============+============+==========================================+
| role       | cust_role  | CREATE     | role "cust_role" was successfully        |
|            |            |            | created                                  |
+------------+------------+------------+------------------------------------------+
```

#### Create a new role under *SysAdmin* , adding *new\_role* as a member

```sh
<no-db>/<no-store># USE ROLE useradmin;
+------------+------------+------------+----------------------+
|  Type      |  Name      |  Command   |  Summary             |
+============+============+============+======================+
| role       | useradmin  | USE        | using role useradmin |
+------------+------------+------------+----------------------+
<no-db>/<no-store># CREATE ROLE IF NOT EXISTS test_role WITH (IN ROLE (sysadmin), ROLE (new_role));
+------------+------------+------------+------------------------------------------+
|  Type      |  Name      |  Command   |  Summary                                 |
+============+============+============+==========================================+
| role       | test_role  | CREATE     | role "test_role" was successfully        |
|            |            |            | created                                  |
+------------+------------+------------+------------------------------------------+
```


---

# 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/ddl/create-role.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.
