Lecture 19 Flashcards
(16 cards)
Query to create a schema
CREATE SCHEMA creates a schema.
CREATE SCHEMA COMPANY AUTHORIZATION ‘John_Smith’ ;
The main command for data definition is
CREATE
SQL uses the terms ….. for the formal relational model terms
table, row and column
Query to create a relation
CREATE TABLE ; - they are called base tables
numeric data types
INTEGER, SMALLINT, REAL DOUBLE PRECISION, FLOAT, DECIMAL(P, D)
Boolean
TRUE FALSE UNKOWN
character-string
CHAR(N), VARCHAR(N)
bit-strings
BIT(N), VARBIT(N)
large object types?
blob - binary large object, clob - character large object
When a query returns a large object…
a pointer is returned rather than the large object itself
how to define domain
CREATE DOMAIN AIRPORT-CODE CHAR(3);
CREATE DOMAIN FLIGHTNUMBER CHAR(5);
what query does not allow null
NOT NULL
secification of a default value
DEFAULT<value></value>
how to check a specific constraint
CHECK
EX: INT NOT NULL CHECK (Dnumber > 0 AND Dnumber < 21)
How to define primary ot foreign key
(FOREIGN KEY) PRIMARY KEY
INT PRIMARY KEY or PRIMARY KEY(Dnumber)
What to use to make delete data from other tables where it is foreign key
FOREIGN KEY(Dno) REFERENCES DEPARTMENT(Dnumber) ON DELETE
SET DEFAULT ON UPDATE CASCADE;