Question 8

AQA Computer Science June 2024 Paper 2 (7517/2)A level11 marks

On the specification

8.1
4.10 Fundamentals of databases
8.2
4.10 Fundamentals of databases
8.3
4.10 Fundamentals of databases
8.4
4.10 Fundamentals of databases
8.5
4.10 Fundamentals of databases
Question text

8 A shop that sells items through a website uses a relational database to store information about the products that it sells and the sales that it has made. Figure 6 shows the structure of the relations in the database. Figure 6 Product(ProductID, Description, QuantityInStock, SupplierID) Sale(SaleID, CustomerID, SaleDate) SaleLine(SaleID, ProductID, QuantitySold) Customer(CustomerID, Forename, Surname, EmailAddress) Supplier(SupplierID, SupplierName, SupplierEmail) • The Product relation stores information about the products that the shop sells and who supplies them. Each type of product is identified by a unique number and has a brief description. For example, ProductID 1 has the Description ‘A4 Ring Binder – Purple’. The QuantityInStock indicates how many of the product the shop currently has in stock. • The Sale and SaleLine relations are used to record the details of the sale of products to a customer. Each sale is identified by a unique SaleID, which is a number. • The Customer relation stores the details of customers who have registered on the website so that they can purchase products. Each customer is identified by a unique CustomerID, which is a number. • The Supplier relation records the details of companies who supply the products to the shop. Each supplier is identified by a unique SupplierID, which is a number. 8.1 Shade one lozenge to indicate which of the listed assumptions has been made when the database was designed. [1 mark] A customer cannot be added to the database until a sale has been A made to them. B Each product is only supplied by one supplier. C Each supplier only supplies one product. D Only one sale can be made to a customer on a particular date. E Two different products cannot be purchased as part of the same sale. When a sale is made to a customer, three changes need to be made to the data in the database: • a new record is created in the Sale table • a new record is created in the SaleLine table for each different product that is part of the sale • the records in the Product table are updated to reduce the QuantityInStock by the purchased quantity for each type of product that has been sold. A sale is made on the 29/09/2024 to the Customer with CustomerID 48. The sale is for 3 of the products with ProductID 1. The sale is to be given the SaleID 4072. 8.2 Write an SQL query that will create the new record for sale 4072 in the Sale table. [2 marks] 8.3 Write an SQL query that will update the QuantityInStock of the product with ProductID 1 when this sale is made. The value 3 should be subtracted from the current quantity in stock. [3 marks] 8.4 The database system can be accessed by many users simultaneously. Describe how timestamp ordering can be used to manage concurrent access to a database. [3 marks] 8.5 The database described in Figure 6 is fully normalised. Describe two problems that can occur with databases that are not fully normalised. [2 marks] Problem 1 Problem 2