Question bank › A-level Computer Science › Fundamentals of databases

SQL and client–server databases

Answer on paper first, then reveal the mark scheme one mark at a time.

1Standard4 marks

A table Book(BookID, Title, Genre, Price, Stock) stores books in a shop.

Write an SQL query to display the Title and Price of all Fantasy books costing less than 10, in descending order of price. [4]

2Stretch6 marks

Tables: Student(StudentID, Name, FormID) and Result(ResultID, StudentID, Subject, Mark).

Write an SQL query to display each Subject and the average Mark of students in form '12B' only, showing only subjects whose average is greater than 60. [6]

3Standard4 marks

Using the table Book(BookID, Title, Genre, Price, Stock):

(a) Write an SQL statement to add the book with BookID 6, title 'Sky Fort', genre 'Fantasy', price 7.50 and stock 12. [2]

(b) Write an SQL statement to increase the price of every Fantasy book by 10%. [2]

Stuck on SQL and client–server databases?

Get it sorted in a free 30-minute session

We work through your weakest questions on this topic on Zoom. I reply the same day.

4Hard5 marks

(a) In a school database, Student.FormID is a foreign key that refers to Form.FormID. Explain what is meant by referential integrity and give an example of an action that would break it in this database. [2]

(b) A bank uses a client–server database. Two clerks open the same account record at the same time and each makes a change to the balance. Explain how record locking prevents one of the updates from being lost. [2]

(c) A transaction that transfers money between two accounts must lock both account records. Explain how this use of record locks could lead to deadlock. [1]

Stuck on this topic?

Book a free 30-minute session on WhatsApp and we'll find exactly which step is costing you the marks. Or build a timed paper on it.

Free 30-minute session