Previous Next JavaScript must be enabled to correctly display this content

## Creating Namespaces

You can add and one or more namespaces to your store. Then, create tables within the namespaces, and grant various permissions to users to access namespaces and tables. For the security administrator, several new permissions are available for namespaces, described in Granting Authorization Access to Namespaces.

You create a new namespace by using a `CREATE NAMESPACE` DDL statement, as follows, with whatever name you choose.

    sql-> CREATE NAMESPACE [IF NOT EXISTS] namespace_name;

All namespace names use standard identifiers, with the same restrictions as tables and indexes:

- Names must begin with an alphabetic character (a-z, A-Z).

- Remaining characters are alphanumeric (a-z, A-Z, 0–9).

- Name characters can include period (.), and underscore (_) characters.

- The maximum name length for a namespace is 128 characters.

Note:

You cannot use the prefix `sys` for any namespaces. The `sys` prefix is reserved. No other keywords are restricted.
Following is the namespace syntax showing the identifier rules similar to a table name:

    table_name : (namespace ':' )? id_path;
    -namespace :  id_path ;

    id_path : id (DOT id)* ;
    id : (... | ID );
    ID : ALPHA (ALPHA | DIGIT | UNDER)* ;

Here are a couple of examples using DDL statements in the SQL CLI. The `SHOW NAMESPACES` directive in the SQL CLI lists the namespaces that currently exist:

    sql-> CREATE NAMESPACE ns1;
    Statement completed successfully

    sql-> CREATE NAMESPACE IF NOT EXISTS ns2;
    Statement completed successfully

    sql-> SHOW NAMESPACES
    namespaces
      ns1
      sysdefault
      ns2