CREATE SCHEMA

Creates a new schema.

create_schema.png

 

where schema-name-clause is:

schema_name_clause.png

 

and schema-element is:

schema_element.png

 

Usage

Embedded, Interactive, Module, ODBC, JDBC.

Description

A new schema is created with the name specified in schema-name-clause. If schema-name is specified, the schema is created with that name, otherwise the name of the schema will be the same as ident-name.

If ident-name is specified, the schema and all the other objects created by the CREATE SCHEMA statement are created with the named ident as the effective current ident.

A schema-element is a CREATE or GRANT statement that is specified using the normal syntax for such a statement and which is executed by the CREATE SCHEMA statement in the normal way.

Language Elements

create-collation-statement, see CREATE COLLATION.

create-domain-statement, see CREATE DOMAIN.

create-index-statement, see CREATE INDEX.

create-sequence-statement, see CREATE SEQUENCE.

create-synonym-statement, see CREATE SYNONYM.

create-table-statement, see CREATE TABLE.

create-view-statement, see CREATE VIEW.

grant-statement, see GRANT ACCESS PRIVILEGE or GRANT OBJECT PRIVILEGE.

Restrictions

The schema name must not be the same as that of a schema which already exists in the database.

CREATE SCHEMA requires that the current ident has SCHEMA or IDENT privilege.

The value for ident-name is currently restricted to be the name of the current ident.

If a schema-element contains a CREATE statement where the name of the object to be created is specified in its fully qualified form (i.e. schema_name.object_name), the schema-name component must be the same as the name of the schema being created by the CREATE SCHEMA statement.

Notes

If a schema-element contains a CREATE statement where the name of the object to be created is specified in an unqualified form, it will be created in the schema created by the CREATE SCHEMA statement (and not the schema with the same name as the current ident as is usual for CREATE statements).

It is possible for one schema-element to reference the objects created by other schema-element’s regardless of the order of creation of the objects. All object references are verified at the conclusion of the CREATE SCHEMA statement when all the schema-element’s have been executed and all objects have been created.

Example

CREATE SCHEMA mimer_store_music;

 

For more information, see the Mimer SQL User's Manual, Creating Idents and Schemas.

Standard Compliance

Standard

Compliance

Comments

SQL-2016

Core

Fully compliant.

SQL-2016

Features outside core

Feature F171, “Multiple schemas per user” support for schema name-clause.

Feature F251, “Domain support” support for CREATE DOMAIN statement in schema definition.

Feature F690, “Collation support” support for CREATE COLLATION statement in schema definition.

 

Mimer SQL extension

Support for CREATE INDEX and CREATE SYNONYM statements in a schema definition is a Mimer SQL extension.