CREATE SCHEMA statement

A schema is a way to logically group objects in a single collection and provide a unique namespace for objects.

Syntax

CREATE SCHEMA schemaName

The CREATE SCHEMA statement is used to create a schema. A schema name cannot exceed 128 characters. Schema names must be unique within the database.

-- Create a schema for employee-related tables
CREATE SCHEMA EMP;
-- Create a schema for airline-related tables
CREATE SCHEMA Flights
-- Create a table called "Availability" in each schema
CREATE TABLE FLIGHTS.AVAILABILITY
	(FLIGHT_ID CHAR(6) NOT NULL, SEGMENT_NUMBER INT NOT NULL,
	FLIGHT_DATE DATE NOT NULL, ECONOMY_SEATS_TAKEN INT,
	BUSINESS_SEATS_TAKEN INT, FIRSTCLASS_SEATS_TAKEN INT, 
	CONSTRAINT FLT_AVAIL_PK
	PRIMARY KEY (FLIGHT_ID, SEGMENT_NUMBER, FLIGHT_DATE));

CREATE TABLE EMP.AVAILABILITY
	(HOTEL_ID INT NOT NULL, BOOKING_DATE DATE NOT NULL, ROOMS_TAKEN INT,
	CONSTRAINT HOTELAVAIL_PK PRIMARY KEY (HOTEL_ID, BOOKING_DATE));
Related reference
CREATE FUNCTION statement
CREATE INDEX statement
CREATE PROCEDURE statement
CREATE SYNONYM statement
CREATE TABLE statement
CREATE TRIGGER statement
CREATE VIEW statement