The CREATE NAMESPACE
statement is used to create a new namespace. In addition to relational namespaces, Polypheny also supports document and graph namespaces.
In Polypheny, you can also use the SQL-typical CREATE SCHEMA
term, which serves as an alias to CREATE NAMESPACE
, hence offering identical functionality.
Syntax
The syntax for the CREATE NAMESPACE
statement is:
CREATE [ RELATIONAL | DOCUMENT | GRAPH ] ( NAMESPACE | SCHEMA ) [ IF NOT EXISTS ] namespace_name;
In this syntax:
RELATIONAL
,DOCUMENT
,GRAPH
specify the type of the namespace. If none is provided,RELATIONAL
is assumed by default.NAMESPACE
andSCHEMA
are interchangeable terms.IF NOT EXISTS
is optional. If included, a namespace with the given name will not be created if it already exists.namespace_name
is the name you wish to assign to the namespace.
Please note:
- You need the necessary privileges to create a namespace.
- Namespace names must be unique.
- Please note the following limitations on namespace names.
Examples
Here are a few examples showing the use of the CREATE NAMESPACE
statement:
Example 1: Create a relational namespace
CREATE RELATIONAL NAMESPACE sales;
This statement creates a new relational namespace named ‘sales’.
Example 2: Create a document namespace
CREATE DOCUMENT NAMESPACE inventory;
This statement creates a new namespace of type document named ‘inventory’.
Example 3: Create a graph namespace
CREATE GRAPH NAMESPACE connections;
This statement creates a new graph namespace named ‘connections’.
Example 4: Create a namespace using IF NOT EXISTS
CREATE NAMESPACE IF NOT EXISTS reports;
This statement will create a new relational namespace named ‘reports’ if it does not already exist.