![]() |
ALLBASE/SQL Reference Manual
> Chapter 10 SQL Statements A - DCREATE SCHEMA |
|||||||||||||||||||||||
|
ScopeISQL or Application Programs SQL Syntax
CREATE SCHEMA AUTHORIZATION AuthorizationName
[TableDefinition
ViewDefinition
IndexDefinition
ProcedureDefinition
RuleDefinition
CreateGroup
AddToGroup
GrantStatement ][...]
Parameters
Description
AuthorizationYou can execute this statement if you have RESOURCE authority or DBA authority. With RESOURCE authority you can create a schema by using your own name or the authorization group name to which you belong. If you have DBA authority, then you can create a schema with any AuthorizationName. ExampleIn the following example, RecDB is the AuthorizationName (owner name). All the tables created here are owned by RecDB; it is not necessary to repeat the owner name for each creation statement.
CREATE SCHEMA AUTHORIZATION RecDB
CREATE PUBLIC TABLE Clubs
(ClubName CHAR(15) NOT NULL
PRIMARY KEY CONSTRAINT Clubs_PK,
ClubPhone SMALLINT,
Activity CHAR(18))
IN RecFS
CREATE PUBLIC TABLE Members
(MemberName CHAR(20) NOT NULL,
Club CHAR(15) NOT NULL,
MemberPhone SMALLINT,
PRIMARY KEY (MemberName, Club)
CONSTRAINT Members_PK,
FOREIGN KEY (Club) REFERENCES Clubs (ClubName)
CONSTRAINT Members_FK)
IN RecFS
CREATE PUBLIC TABLE Events
(SponsorClub CHAR(15),
Event CHAR(30),
Date DATE DEFAULT CURRENT_DATE,
Time TIME,
Coordinator CHAR(20),
FOREIGN KEY (Coordinator, SponsorClub)
REFERENCES Members (MemberName, Club)
CONSTRAINT Events_FK)
IN RecFS
|