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 | |
|---|---|---|
| 1PRIMARY KEY (orderId, productId) | AA single-field primary key cannot have a partial dependency, because there is no part of the key to depend on | |
| 2productName depends on productId only | BCREATE TABLE products (productId INT PRIMARY KEY, productName VARCHAR(50)); | |
| 3To reach 2NF, move a field that depends on only part of the composite key into its own table | CCREATE TABLE orderItems (orderId INT, productId INT, quantity INT, PRIMARY KEY (orderId, productId)); | |
| 4A field that depends on the whole composite key can stay in the original table | DA partial dependency, which breaks 2NF when the key is (orderId, productId) | |
| 5orderItems(orderId, productId, quantity, productName) with PRIMARY KEY (orderId, productId) | EproductName depends only on productId, which is part of the key, so this table is not in 2NF | |
| 6A table with the single primary key studentId is checked for partial dependencies, and one is found | FA composite primary key made of two fields, so 2NF must be checked for partial dependency |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
2NF — Second normal form: a table is in 1NF and no non-key field depends on only part of a composite primary key. Removing partial dependencies means each field relies on the whole key.CREATE TABLE OrderItem (
orderId INT, productId INT, qty INT,
PRIMARY KEY (orderId, productId));CREATE TABLE Enrolment (
studentId INT, subjectId INT, mark INT,
PRIMARY KEY (studentId, subjectId));SELECT DISTINCT productId, productName
FROM OrderItem;CREATE TABLE Product (
productId INT,
productName VARCHAR(30), PRIMARY KEY
(productId));-- subjectName depends on subjectId only
-- This is a partial dependency
-- Move it to the Subject table