QuestionQ131

VerifiedCreating and Managing Tables

You need to design a student-registration database that contains several tables storing academic information.

The STUDENTS table stores information about a student. The STUDENT_GRADES table stores information about the student's grades. Both tables have a column named STUDENT_ID. The STUDENT_ID column in the STUDENTS table is a primary key.

You need to create a foreign key on the STUDENT_ID column of the STUDENT_GRADES table that references the STUDENT_ID column of the STUDENTS table.

Which statement creates the foreign key?

Explanation

A table-level foreign-key constraint is declared as CONSTRAINT constraint_name FOREIGN KEY (child_column) REFERENCES parent_table(parent_column). This makes STUDENT_GRADES.STUDENT_ID reference the primary key STUDENTS.STUDENT_ID, enforcing referential integrity between the child and parent tables.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!