Cambridge AS Level Computer Science 9618 · 8.1 Database Concepts

Q2 · 9618/12/M/J/21 Q1

Worked solution from the Databases Paper 1 Theory Fundamentals booklet, Part 1 of 2.

Q29618/12/M/J/21original Q1Structured · 16 marks
Question 1 from 9618/12/M/J/21

Worked solution

(a)

For each term, write a definition and an example from HOUSE_RENTALS.

Field: a column (attribute) in a table. [1]

Example: CustomerID in the table CUSTOMER. [1]

Entity: anything that data can be stored about. [1]

Example: a customer or a house. [1]

Foreign key: a field in one table that links to the primary key of another table. [1]

Example: CustomerID (or HouseID) in the table RENTAL. [1]

(b)

Tick In 3NF.

Every field in every table depends fully on the primary key and on no other field. [1]

Example: all fields in CUSTOMER depend only on CustomerID. [1]

(c)(i)

CREATE TABLE RENTAL (
    RentalID INTEGER NOT NULL,
    CustomerID INTEGER NOT NULL,
    HouseID VARCHAR(5) NOT NULL,
    MonthlyCost REAL NOT NULL,
    DepositPaid BOOLEAN NOT NULL,
    PRIMARY KEY (RentalID)
);

CREATE TABLE [1]

VARCHAR for HouseID [1]

REAL (or CURRENCY) for MonthlyCost [1]

PRIMARY KEY [1]

(c)(ii)

The names are in CUSTOMER and the deposit is in RENTAL, so join the two tables.

SELECT FirstName, LastName
FROM CUSTOMER, RENTAL
WHERE DepositPaid = No
AND RENTAL.CustomerID = CUSTOMER.CustomerID;

SELECT FirstName and LastName [1]

FROM both tables [1]

WHERE DepositPaid = No [1]

Tables joined (with AND, or with INNER JOIN) [1]

KEY IDEADefine terms with a short example from the given tables, and join tables on the foreign key to get data from both.
TOTAL 16 marks

Official mark scheme

Mark scheme for 9618/12/M/J/21 question 1
VIDEO
▶ Whole paper

Video solution of the whole paper · by O/Alevel CS by Wasiq. Tap the picture to open it on YouTube.

Solutions follow the official Cambridge mark schemes; marks are shown in grey. Videos are from other YouTube channels. Paper codes read component / series / year: M/J = May/June, O/N = October/November. Past-paper questions © UCLES, reproduced for classroom practice.