CREATE SCHEMA Statement (create_schema_statement)

The CREATE SCHEMA statement (create_schema_statement) defines a schema.

Syntax

<create_schema_statement>         ::= CREATE SCHEMA <schema_name_clause> [<schema_element> ...]

<schema_name_clause>              ::= <schema_name>
                                    | <schema_name> AUTHORIZATION <schema_authorization_identifier>

<schema_authorization_identifier> ::= <identifier>

<schema_element>                  ::= <create_table_statement>
                                    | <
create_view_statement>
                                    | <
create_dbproc_statement>
                                    | <
create_function_statement>
                                    | <
create_sequence_statement>

Explanation

The current user must be a database administrator.

The specified schema name (schema_name) must differ from the names of all existing schemas, database users, and roles.

CREATE SCHEMA <schema_name>

A schema with the name schema_name is created. The current user (a database administrator) becomes the owner of this schema.

CREATE SCHEMA <schema_name> AUTHORIZATION <schema_authorization_identifier>

A schema with the name schema_name is created. The user specified by schema_authorization_identifier must exist and be a database administrator. This database administrator becomes the owner of the schema. The owner has the CREATEIN and DROPIN privileges for the generated schema and can therefore at any time add database objects to the schema or delete objects.