Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
Shade in the A or B circle for each question.
Draw a line connecting each item on the left to its match on the right.
| Left column | Right column | |
|---|---|---|
| 1FOREIGN KEY (class_id) REFERENCES Classes(class_id) | AA field in the Students table that stores the class_id of the class the student belongs to | |
| 2class_id INTEGER | BThe foreign key value 99 does not match any primary key in Classes, so it links to a class that does not exist. | |
| 3One-to-many relationship: one class can have many students, so the student table holds the class link | CStudents(student_id, name, class_id) | |
| 4Avoiding repeated data: store the class details once in Classes and link to them with the class ID | DMakes class_id in this table a link to the primary key class_id in the Classes table | |
| 5Students(student_id, name, class_name, teacher, room) | EClass details are typed into every student record instead of using a foreign key, so data is repeated and can become inconsistent. Store them in Classes and add class_id to Students. | |
| 6Students: class_id = 99, Classes: 1, 2, 3 | FClasses(class_id, class_name, teacher) |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
FOREIGN KEY — A field in one table that holds the primary key value of a record in another table, linking the two tables together so related data is stored once and not repeated.FOREIGN KEY (ClassID) REFERENCES Classes(ID)ClassID INT,
FOREIGN KEY (ClassID) REFERENCES Classes(ID)ClassID INT,
FOREIGN KEY (ClassID) REFERENCES Classes(ID)CREATE TABLE Classes (ID INT PRIMARY KEY);ClassID INT,
FOREIGN KEY (ClassID) REFERENCES Classes(ID)