The Student No. in the “Student” table is the primary key on the referenced side, not a foreign key. A foreign key is set on a column in the referencing child table (here, the “Grade” table). Moreover, this option only links students and lacks the reference to subjects, so it cannot satisfy the condition in the question.
×Incorrectイ
The student name and subject name are ordinary attributes that are not primary keys, so they cannot uniquely reference another table. A foreign key must be a column that references the primary key of the other table, so a name column cannot be made a foreign key.
○ウ
正解The correct answer is “ウ”. A foreign key is a column that maintains consistency between tables (referential integrity) by referencing the primary key (or a unique column) of another table, and it is set on the referencing side (the child table). The condition in the question, “a student not in the “Student” table or a subject not in the “Subject” table cannot be registered in the “Grade” table”, precisely means that the “Grade” table references the “Student” table and the “Subject” table. The “Student No.” in the “Grade” table references the primary key (Student No.) of the “Student” table, and the “Subject Code” references the primary key (Subject Code) of the “Subject” table. Therefore, the columns that should be set as foreign keys are the “Student No.” and “Subject Code” in the “Grade” table, so ウ is appropriate.
×Incorrectエ
The grade in the “Grade” table (Excellent, Good, Pass, etc.) is merely a data item representing an evaluation and does not reference the primary key of any other table. It is not a foreign key that ensures referential integrity.
ここがポイント
A foreign key is “a column that references the primary key of another table”; it is set on the referencing side (the child table) and maintains referential integrity between tables.
In a detail table that references multiple tables, such as the “Grade” table, the columns corresponding to each parent table’s primary key (Student No. and Subject Code) each become a foreign key.