(10 points)
Write an SQL database schema for your application, using the
CREATE TABLE commands described in class. Make sure your
application provides at least 4-5 different relations (do not
have more than 6 relations; it will be difficult to grade
these). Pick
suitable datatypes for each attribute. Browse through the online
ORACLE
manual to determine the principal options that are available for
types (your class notes may or may not cover the ones that you
require). Do not forget to specify at least one key for each
relation (using the PRIMARY KEY construct). Specify
other choices for keys via the UNIQUE construct.
Justify your choice of key(s) for each relation.
If some attribute should not be NULL, use NOT NULL to
specify this aspect. Also provide DEFAULT values wherever applicable.
An example of a complete DDL for one relation is:
CREATE TABLE Students
(
sid CHAR(6) PRIMARY KEY,
ssn CHAR(9) UNIQUE,
name CHAR(30),
birthdate DATE,
gender CHAR(1) NOT NULL,
address VARCHAR(255)
);
Execute some sample INSERT, DELETE and UPDATE commands on every
one of your relations. Convince yourself that things are working just
fine. Report any interesting observations that you make.