# 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](https://docs.deltastream.io/overview/core-concepts/access-control#custom-roles) within the [organization](https://docs.deltastream.io/overview/core-concepts/access-control#_organiation). Requires [MANAGE\_MEMBERS](https://docs.deltastream.io/overview/core-concepts/access-control#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="../command/list-roles">list-roles</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="../command/list-roles">list-roles</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                                  |
+------------+------------+------------+------------------------------------------+
```
