Chapter 9 SQL Statements
463
♦ The following CREATE SCHEMA statement creates a schema
consisting of two tables. The statement must be executed by the user ID
sample_user, who must have RESOURCE authority. If the statement
creating table t2 fails, neither table is created.
CREATE SCHEMA AUTHORIZATION sample_user
CREATE TABLE t1 ( id1 INT PRIMARY KEY )
CREATE TABLE t2 ( id2 INT PRIMARY KEY );
♦ The statement delimiter in the following CREATE SCHEMA statement
is placed after the first CREATE TABLE statement. As the statement
delimiter marks the end of the CREATE SCHEMA statement, the
example is interpreted as a two statement batch by the database server.
Consequently, if the statement creating table t2 fails, the table t1 is still
created.
CREATE SCHEMA AUTHORIZATION sample_user
CREATE TABLE t1 ( id1 INT PRIMARY KEY );
CREATE TABLE t2 ( id2 INT PRIMARY KEY );
Examples