9618/12/M/J/21 question 1: worked solution (May/June 2021, paper 12)

Show as plain text

Cambridge AS Level Computer Science 9618 · 8.1 Database Concepts Worked solution from the Databases Paper 1 Theory Fundamentals booklet, Part 1 of 2. Q2 9618/12/M/J/21 original Q1 Structured · 16 marks 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 IDEA Define 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 VIDEO ▶ Whole paper Video solution of the whole paper · by O/Alevel CS by Wasiq. Tap the picture to open it on YouTube.