Mangai Neelavannan

Generate statements (ddl) to create all objects

Sqlfiddle link: http://sqlfiddle.com/#!9/d233a

  • May 20, 2018 at 5:44 PM
  • Visible to public
CREATE TABLE IF NOT EXISTS PROGRAM_OF_STUDY
(
  ID INT NOT NULL,
  PROGRAM_ID TEXT NOT NULL,
  PROGRAM_TITLE VARCHAR (30) NOT NULL, 
  PRIMARY KEY (ID)
 );
 
 CREATE TABLE DISCIPLINE
 (
   DISCIPLINE_ID INT NOT NULL,
   CODE VARCHAR(15) NOT NULL, 
   DISCIPLINE_TITLE TEXT NOT NULL,
   NUM_CREDITS INT NOT NULL, 
   HOUR_TYPE VARCHAR(6) NOT NULL,
   FOREIGN KEY (DISCIPLINE_ID) REFERENCES PROGRAM_OF_STUDY (ID)
  );
  
  CREATE TABLE STUDENT
  (
    STUDENT_ID INT NOT NULL,
    STUDENT_NUMBER VARCHAR(4) NOT NULL, 
    STUDENT_FNAME TEXT NOT NULL, 
    STUDENT_LNAME TEXT NOT NULL, 
    FOREIGN KEY (STUDENT_ID) REFERENCES PROGRAM_OF_STUDY (ID)
   );