CREATE TABLE TableName
({colName dataType [NOT NULL] [UNIQUE]
[DEFAULT defaultOption]
[CHECK searchCondition] [,...]}
[PRIMARY KEY (listOfColumns),]
{[UNIQUE (listOfColumns),] […,]}
{[FOREIGN KEY (listOfFKColumns)
REFERENCES ParentTableName
[(listOfCKColumns)],
[ON UPDATE referentialAction]
[ON DELETE referentialAction ]] [,…]}
{[CHECK (searchCondition)] [,…] })
CREATE TABLE PropertyForRent (
propertyNo char NOT NULL,
rooms char NOT NULL DEFAULT 4,
rent char NOT NULL DEFAULT 600,
ownerNo char NOT NULL,
staffNo char,
CONSTRAINT StaffNotHandlingTooMuch
CHECK ( NOT EXISTS ( SELECT staffNo
FROM propertyForRent
GROUP BY staffNo
HAVING COUNT(*)>100)),
branchNo char NOT NULL,
PRIMARY KEY (propertyNo),
FOREIGN KEY (staffNo) REFERENCES Staff
ON DELETE SET NULL ON UPDATE CASCADE);
ALTER TABLE TabName
[ADD [COLUMN] columnName dataType
[NOT NULL][UNIQUE][DEFAULT defaultOption]
[CHECK (searchCondition)]]
[DROP [COLUMN] columnName [RESTRICT | CASCADE ]]
[ADD [CONSTRAINT [constraintName]]
tableConstraintDefinition]
[DROP CONSTRAINT constraintName [RESTRICT | CASCADE ]]
[ALTER [COLUMN] SET DEFAULT defaultOption]
[ALTER [COLUMN] DROP DEFAULT]
DROP TABLE TableName [RESTRICT | CASCADE]