Given the following relational database schema: Student = (SSN, Name, Major) Course = ( CourseNumber, PrerequisiteCourseNumber, Course Title, NumberUnits) Section = ( CourseNumber, Quarter, RoomNumber, DayTime), where DayTime is of the form MW 1:0-2:00PM. Enrollment = (SSN,CourseNumber, Quarter, Grade)// Grade is either Null or a letter grade.
I'm looking for the DLL statements to make the tables above in SQL
Create Table Student (
SSN varchar(12) NOT NULL,
Name varchar(50) NOT NULL,
Major varchar(30) NOT NULL,
Primary Key(SSN)
) ;
Create Table Course(
CourseNumber int NOT NULL,
PrerequisiteCourseNumber int NOT NULL,
CourseTitle varchar(50) NOT NULL,
NumberUnits int NOT NULL,
Primary Key(CourseNumber)
);
Create Table Section (
CourseNumber int NOT NULL,
Quarter int NOT NULL,
RoomNumber int NOT NULL,
DayTime TimeDate NOT NULL,
Primary Key(CourseNumber, Quarter,RoomNumber),
Foreign Key(CourseNumber) References Course(CourseNumber)
);
Create Table Enrollment (
SSN varchar(12) NOT NULL,
CourseNumber int NOT NULL,
Quarter int NOT NULL,
Grade char(1) ,
Primary Key(SSN,CourseNumber,Quarter),
Foreign Key(SSN) References Student(SSN),
Foreign Key(CourseNumber) References Course(CourseNumber)
);
Do ask if any doubt. Please up-vote.
Get Answers For Free
Most questions answered within 1 hours.