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 | |
|---|---|---|
| 1Scenario: A library lends books to members. Entities: MEMBER, BOOK | AClass was not identified as its own entity. Underline all the nouns: STUDENT and CLASS should be separate entities with a relationship line between them. | |
| 2MEMBER(memberId, name, email) | BLOAN(loanId, memberId, bookId, dateOut) | |
| 3One teacher teaches many classes, so the foreign key goes on the many side (the class table) | CUnderline the nouns in the scenario to find the entities, which become the boxes on the ERD | |
| 4A member can have many loans and a book can have many loans, so a loan entity links them with two foreign keys | DCLASS(classId, subject, teacherId) | |
| 5TEACHER(teacherId, name, classId) | EThe foreign key is on the wrong side. One teacher has many classes, so classId should not be in TEACHER. Put teacherId in CLASS instead. | |
| 6Scenario: Students enrol in classes. ERD: STUDENT only, with a className field | FAn entity with its attributes listed and the primary key (memberId) chosen to identify each record |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
ERD from a scenario — Find the entities, list their attributes, pick primary keys, then work out each relationship and draw it, with the foreign key on the many side.-- Entity: people who join the library
CREATE TABLE members (
memberId INT PRIMARY KEY, name TEXT);CREATE TABLE books (
bookId INT PRIMARY KEY,
title VARCHAR(50));CREATE TABLE loans (loanId INT PRIMARY KEY,
memberId INT, FOREIGN KEY (memberId)
REFERENCES members(memberId));-- One teacher has many classes
CREATE TABLE classes (id INT PRIMARY KEY,
teacherId INT REFERENCES teachers(id));SELECT members.name, loans.loanDate
FROM members JOIN loans
ON members.memberId = loans.memberId;