ExamBank Scot · N5 Computing Science question bank · All N5 Computing Science questions

N5 Computing Science 2018 Question 10

3 marks · SQL INSERT, UPDATE and DELETE

Explain why the SQL statement above would give an unexpected result. Rewrite the SQL statement to give the expected output. A shop stores stock information in a database. Part of the database table is shown below. Stock stockCode type description price quantity 2374 Vase Blue with floral pattern 12.40 1 3467 Book Satellite Games 0.45 2 4576 Book Organic Farming 0.45 1 186 Garden Hand fork 0.90 1 8964 Jigsaw Picture of Culzean Castle 1.00 1 3647 DVD The 49 Steps 0.45 1 762 Book Baking Pies 0.45 1 The manager writes the following SQL statement to change the price of all books to 50p. UPDATE Stock SET price = 0.50 WHERE price = 0.45;

Marking scheme

The price of other records would update. Answers may refer to: • other 45p records • the DVD • not just the books (UPDATE Stock SET price = 0.50) WHERE type = “Book”; (1) (1) SQL accepts single and double quotes.

Previous question: N5 Computing Science 2018 Question 9

Next question: N5 Computing Science 2018 Question 11