CIS 336 STUDY Extraordinary Success /cis336study.com CIS 336 STUDY Extraordinary Success /cis336study.c | Page 54
STEP 1: The DROP Statements
A DROP TABLE statement must appear in your script file, prior to
the SQL statements for creating
the table in question. This will allow you to run and re-run your
script file as often as you need to. The
very first time you run your script the table does not exist, so the IF
EXISTS clause causes the statement
to be ignored. Thereafter, the table will be deleted, ensuring that
your CREATE TABLE statement creates
the table fresh and clean, with only the attributes present in the
current revision of the CREATE
statement. Here is an example of one of the six DROP TABLE
statements you will need to create.
DROP TABLE IF EXISTS `ENROLLMENT` ;
STEP 2: The CREATE TABLE Statements
Next, define the CREATE TABLE statements for the six tables that
you are to create based upon the
ERD (provided above) for this lab. Be sure to follow the guidelines
given above on how and where to
create the different types of constraints for each table. This will
include PK, FK, and NOT NULL
constraints.
STEP 3: The INSERT Statements for the Data
The third step is to create the insert statements to insert the sample
data into the tables created in