

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Each student must work on this homework alone.
Question 1.
CREATE TABLE student( ssn NUMERIC(9) , rin NUMERIC (9) , name VARCHAR(255) , degree CHAR(4) , email CHAR(8) , address VARCHAR(255) , phoneNumber VARCHAR(15) , GPA NUMERIC(4,2) , CONSTRAINT student_pk PRIMARY KEY (ssn) , CONSTRAINT student_uq_ssn UNIQUE (rin) , CONSTRAINT student_uq_email UNIQUE (email) )
Phone number is a character string, which may include an extension.
CREATE TABLE class(
instructorSSN NUMERIC(9) , classCRN NUMERIC(9) , courseCode NUMERIC(4) , subjectCode CHAR(4) , semester VARCHAR(7) , year NUMERIC(4) , sectionNo CHAR(2) , classroom INT , DayandTimeInfo VARHCAR(255) , CONSTRAINT class_pk PRIMARY KEY (classCRN) , CONSTRAINT class_uq UNIQUE (courseCode, subjectCode, semester, year, sectionNo) )
Assuming that classCRN may not be reused. If it is being reused, then a better key would be classCRN and year. However, in this case, the transcript probably should use the year as well. There may not be two sections with the same number for a course in the same year and semester.
CREATE TABLE transcript( studentSSN NUMERIC(9) , classCRN NUMERIC(9) , grade CHAR(1) , CONSTRAINT transcript_pk PRIMARY KEY(studentSSN, classCRN) )
CREATE TABLE prerequisite( subjectCode , courseCode , requiredSubjectCode , requiredCourseCode , CONSRTAINT prerequisite_pk PRIMARY KEY(subjectCode, courseCode, requiredSubjectCode, requiredCourseCode) )
Question 2.