Now, add the required foreign key constraints for each table. Do not add any records yet. Spool your statements and results to the CH4LAB1B.LST file and print it.

What will be an ideal response?

ALTER TABLE student
ADD CONSTRAINT student_facultyid_fk FOREIGN KEY (FacultyId)
REFERENCES faculty (FacultyId);

ALTER TABLE student
ADD CONSTRAINT student_majorid_fk FOREIGN KEY (MajorId)
REFERENCES major (MajorId);

ALTER TABLE student
ADD CONSTRAINT student_startterm_fk FOREIGN KEY (StartTerm)
REFERENCES term (TermId);

ALTER TABLE faculty
ADD CONSTRAINT faculty_roomid_fk FOREIGN KEY (RoomId)
REFERENCES location (RoomId);

ALTER TABLE faculty
ADD CONSTRAINT faculty_deptid_fk FOREIGN KEY (DeptId)
REFERENCES department (DeptId);

ALTER TABLE crssection
ADD CONSTRAINT crssection_courseid_fk FOREIGN KEY (CourseId)
REFERENCES course (CourseId);

ALTER TABLE crssection
ADD CONSTRAINT crssection_termid_fk FOREIGN KEY (TermId)
REFERENCES term (TermId);

ALTER TABLE crssection
ADD CONSTRAINT crssection_facultyid_fk FOREIGN KEY (FacultyId)
REFERENCES faculty (FacultyId);

ALTER TABLE crssection
ADD CONSTRAINT crssection_roomid_fk FOREIGN KEY (RoomId)
REFERENCES location (RoomId);

ALTER TABLE registration
ADD CONSTRAINT registration_studentid_fk FOREIGN KEY (StudentId)
REFERENCES student (StudentId);

ALTER TABLE registration
ADD CONSTRAINT registration_csid_fk FOREIGN KEY (CsId)
REFERENCES crssection (CsId);

ALTER TABLE location
ADD CONSTRAINT location_roomtype_fk FOREIGN KEY (RoomType)
REFERENCES ROOM (RoomType);

Computer Science & Information Technology

You might also like to view...

The SUM aggregate function can work with Date/Time data

Indicate whether the statement is true or false

Computer Science & Information Technology

Which of the following statements is false?

a. You can concatenate two lists, two tuples or two strings using the + operator. The result is a new sequence of the same type containing the left operand’s elements followed by the right operand’s elements. b. A TypeError occurs if the + operator’s operands are difference sequence types—for example, concatenating a list and a tuple is an error. c. List elements can be accessed via their indices and the subscription operator ([]). d. All of the above statements are true.

Computer Science & Information Technology