Managing Namespace

To manage namespaces, run the below commands in the SQL Shell.

CREATE NAMESPACE

Example 1 - Create a Namespace: Use the CREATE NAMESPACE statement to add a new namespace.

CREATE NAMESPACE IF NOT EXISTS ns1

Note: IF NOT EXISTS clause is optional.

Output:

Statement completed successfully

SHOW NAMESPACES

Example 2 - Show Existing Namespaces: Use the show namespaces statement to show the existing namespaces.

SHOW NAMESPACES

Output:

namespaces
  ns1
  sysdefault

Example 3 - Show Namespaces in JSON Format: To show the namespaces in a JSON format, use the statement below

SHOW AS JSON NAMESPACES

Output:

{"namespaces" : ["ns1","sysdefault"]}

DROP NAMESPACE

To delete a namespace, use the DROP NAMESPACE statement

Example 4 - Delete a Namespace: Delete a namespace from your store.

DROP NAMESPACE IF EXISTS ns1 CASCADE

Explanation: The above statement removes the namespace, ns1.

Note: You cannot delete the default namespace, sysdefault.