Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
This Third normal form (3NF) (Data and Programming Techniques) worksheet is part of the QCE Digital Solutions Unit 2 — Data and Programming Techniques journey. Print it as a booklet?
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 | |
|---|---|---|
| 1Students(StudentID, Name, Postcode, Suburb) | APostcode was left out of Students, so there is no foreign key linking the two tables. Students cannot be matched to their postcode. | |
| 2Postcodes(Postcode, Suburb) | BStudentID -> Postcode -> Suburb | |
| 33NF removes a non-key field that depends on another non-key field by moving it to a new table. | CHaving a primary key does not make a table 3NF. Suburb still depends on Postcode, a non-key field, so the transitive dependency remains. | |
| 4A transitive dependency is a chain where the key determines a non-key field, which then determines another non-key field. | DStudents(StudentID, Name, Postcode) Postcodes(Postcode, Suburb) | |
| 5Students(StudentID, Name, Postcode, Suburb) This table is in 3NF because it has a primary key. | EA new table that holds the suburb for each postcode, so Suburb depends only on its own key. | |
| 6Students(StudentID, Name, Suburb) Postcodes(Postcode, Suburb) | FNot in 3NF: Suburb depends on Postcode, which is a non-key field, so there is a transitive dependency. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
3NF — Third normal form: the table is in 2NF and no non-key field depends on another non-key field (no transitive dependency), e.g. suburb depends on postcode, so move it to its own table.CREATE TABLE Postcode (
postcode CHAR(4) PRIMARY KEY,
suburb VARCHAR(30));CREATE TABLE Student (postcode CHAR(4),
FOREIGN KEY (postcode)
REFERENCES Postcode(postcode));studentId -> postcode -> suburbSELECT Student.name, Postcode.suburb
FROM Student JOIN Postcode
ON Student.postcode = Postcode.postcode;ALTER TABLE Student
DROP COLUMN suburb;