Table of Contents Previous Next


2 The SQL Language : 2.3 SQL Commands : 2.3.30 CREATE SCHEMA

CREATE SCHEMA -- define a new schema
CREATE SCHEMA AUTHORIZATION username schema_element [ ... ]
This variation of the CREATE SCHEMA command creates a new schema owned by username and populated with one or more objects. The creation of the schema and objects occur within a single transaction so either all objects are created or none of them including the schema. (Please note: if you are using an Oracle database, no new schema is created – username, and therefore the schema, must pre-exist.)
CREATE SCHEMA includes subcommands to create objects within the schema. The subcommands are treated essentially the same as separate commands issued after creating the schema. All the created objects will be owned by the specified user.
The name of the user who will own the new schema. The schema will be named the same as username. Only superusers may create schemas owned by users other than themselves. (Please note: In Advanced Server the role, username, must already exist, but the schema must not exist. In Oracle, the user (equivalently, the schema) must exist.)
An SQL statement defining an object to be created within the schema. CREATE TABLE, CREATE VIEW, and GRANT are accepted as clauses within CREATE SCHEMA. Other kinds of objects may be created in separate commands after the schema is created.
To create a schema, the invoking user must have the CREATE privilege for the current database. (Of course, superusers bypass this check.)
In Advanced Server, there are other forms of the CREATE SCHEMA command that are not compatible with Oracle databases.

2 The SQL Language : 2.3 SQL Commands : 2.3.30 CREATE SCHEMA

Table of Contents Previous Next