9618/11/M/J/22 question 4: worked solution (May/June 2022, paper 11)
Show as plain textHide 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. Q17 9618/11/M/J/22 original Q4 Structured · 19 marks Worked solution (a) Write any four points about the advantages of a relational database: Less data redundancy , because each item of data is stored once. [1] Better data consistency (integrity), because a change in one table is seen in the linked tables and linked data cannot be entered differently. [1] Program-data independence , so changes to the data do not mean programs must be rewritten. [1] Complex queries are easier to run. [1] Different views can be given, so users see only certain parts of the database. Only four marks can be scored, so any four of these five points are enough. (b) Normal Form: 3NF [1] There are no repeating attributes (it is already in 2NF). [1] Each field depends fully on its primary key (no partial dependencies), and no field depends on a non-key field (no transitive dependencies). [1] Any two justification points earn the two marks. (c)(i) The primary key is made of both StudentID and TestID. Each is also a foreign key. CREATE TABLE STUDENT_TEST ( StudentID INTEGER, TestID VARCHAR, Mark INTEGER, PRIMARY KEY (StudentID, TestID), FOREIGN KEY (TestID) REFERENCES TEST(TestID), FOREIGN KEY (StudentID) REFERENCES STUDENT(StudentID) ); CREATE TABLE, table name, opening and closing brackets [1] StudentID and Mark as INTEGER [1] TestID as VARCHAR [1] Primary key set up correctly [1] Foreign keys set up correctly [1] (c)(ii) SELECT AVG(Mark) FROM STUDENT_TEST WHERE TestID = "A7"; AVG(Mark) [1] SELECT and FROM STUDENT_TEST [1] WHERE clause for test A7 [1] (d) Write two points for validation and two for verification (up to 4 marks in all; validation can score up to 3 and verification up to 2). Validation checks the mark is sensible. Range check : the mark must be between 0 and the test's total marks. [1] Type check : the mark must be an integer (whole number). [1] A presence check (a mark must be entered) also scores. Verification checks the mark was entered correctly. Double entry : enter the mark twice and the computer compares them. [1] Visual check : look at the mark entered and compare it with the mark on the paper. [1] KEY IDEA Validation checks that data is reasonable, while verification checks that it was copied correctly. TOTAL 19 marks Official mark scheme VIDEO ▶ Whole paper Video solution of the whole paper · by qiphyedu. Tap the picture to open it on YouTube.