9618/13/O/N/22 question 2: worked solution (October/November 2022, paper 13)

Show as plain text

Cambridge AS Level Computer Science 9618 · 8.3 Data Definition Language (DDL) and Data Manipulation Language (DML) Worked solution from the Databases Paper 1 Theory Fundamentals booklet, Part 2 of 2. Q19 9618/13/O/N/22 original Q2 Structured · 14 marks Worked solution (a) Write one answer for each item: Item Answer Primary key in COMPANY CompanyID Candidate key in TELESCOPE SerialNumber (TelescopeID also accepted) Degree of relationship TELESCOPE to PHOTOGRAPH 1: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 IDEA A relational query picks fields with SELECT, filters with WHERE and totals with an aggregate such as COUNT. TOTAL 14 marks Official mark scheme VIDEO ▶ Topic lesson A lesson on this topic · by Craig'n'Dave. Tap the picture to open it on YouTube.