Cambridge AS Level Computer Science 9618 · 8.3 Data Definition Language (DDL) and Data Manipulation Language (DML)

Q19 · 9618/13/O/N/22 Q2

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

Q199618/13/O/N/22original Q2Structured · 14 marks
Question 2 from 9618/13/O/N/22

Worked solution

(a)

Write one answer for each item:

ItemAnswer
Primary key in COMPANYCompanyID
Candidate key in TELESCOPESerialNumber (TelescopeID also accepted)
Degree of relationship TELESCOPE to PHOTOGRAPH1:M (one to many)

Suitable primary key: CompanyID [1]

Candidate key: SerialNumber or TelescopeID [1]

Degree: 1:M (one telescope takes many photographs) [1]

(b)

This is the part of the DBMS that describes how the data is organised, not the data itself.

Write: logical schema [1]

(c)

Count the TelescopeID values, only for companies whose ID starts with HW. LIKE with % matches any ending.

SELECT COUNT(TelescopeID)
FROM TELESCOPE
WHERE CompanyID LIKE 'HW%';

COUNT used to total the telescopes [1]

TelescopeID inside the brackets [1]

CompanyID after WHERE [1]

'HW%' after LIKE [1]

(d)

Use ALTER TABLE to add a new field. The resolution looks like 1920 × 1068, so store it as text.

ALTER TABLE PHOTOGRAPH
ADD Resolution TEXT;

ALTER TABLE PHOTOGRAPH [1]

ADD Resolution with a text type, for example TEXT or VARCHAR(11) [1]

(e)

Fill in the two gaps:

The bit depth of a bitmap image is the number of bits used to store each pixel. [1]

Metadata is stored in the header of the file. [1]

(f)

A query processor takes the request from the user and finds the answer in the database.

Allows the user to enter criteria for the search [1]

Searches for the data that meets the criteria and organises the results to show to the user [1]

Either of these two points about searching or organising the results can earn the second mark.

KEY IDEAA relational query picks fields with SELECT, filters with WHERE and totals with an aggregate such as COUNT.
TOTAL 14 marks

Official mark scheme

Mark scheme for 9618/13/O/N/22 question 2
VIDEO
▶ Topic lesson

A lesson on this topic · by Craig'n'Dave. 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.