126      Create tabe Course.

 

 

  create table class

( classid Integer,

  courseID integer,

  instID char(9),

  semester integer,

  days char(3) not null,

  times char(8) not null,

  room integer not null,

  cap integer not null,

  constraint class_classID_PK primary key (classID),

  constraint class_couseID_FK Foreign Key (courseID) references course (courseID),

  constraint class_InstID_FK Foreign Key (instID) references instructor (InstID),

  constraint class_room_FK Foreign key (room) references classrooms (classroom),

  constraint class_days_CK check (days in ('MWF','MW','TR')),

  constraint class_times_CK check ((days in ('MWF') and times in ('7:30 AM','8:30 AM','9:30 AM','10:30 AM','11:30 AM'))

  or (days = 'MW' and times in ('6:00 PM','7:30 PM'))

  or (days = 'TR' and times in ('7:30 AM','9:00 AM','10:30 AM','12:00 PM','1:30 PM','6:00 PM','7:30 PM'))),

  constraint class_cap_ck check (cap > 0),

  unique(instid,days,times),

  unique(room,days,times));