SQL-J Language Reference,
Page 14 of 118


[top]
[prev]
[next]
Documentation Top
Global Index
Reference Manual
TOC Index
Grammar index
Developer's Guide
TOC Index
Tuning Cloudscape
TOC Index

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. Schema names must be unique within the database.

You must create a schema with a CREATE SCHEMA statement before referring to it, unless the schema is the APP or SYS schema.

Examples

-- Create a schema for hotel-related tables
CREATE SCHEMA Hotels
-- 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),
    segment_number INT,
    flight_date DATE,
    economy_seats_taken INT,
    business_seats_taken INT,
    firstclass_seats_taken INT,
    CONSTRAINT Flight_Availability_PK PRIMARY KEY
        (flight_id, segment_number, flight_date))
CREATE TABLE Hotels.Availability
(    hotel_id INT,
    booking_date DATE,
    rooms_taken INT,
    CONSTRAINT HotelAvailability_PK PRIMARY KEY
        (hotel_id, booking_date))
[top]
[prev]
[next]


Cloudscape Version 3.0
For technical support, go to: www.cloudscape.com and click Support.
Copyright © 1998 and 1999 Cloudscape, Inc. All rights reserved.