KS4 – Databases and SQL Learner activity sheet
Lesson 2 – SQL searches
Class Activity: SQL questions
Database Book shop database
Here is a relational database for a book shop. Use these two tables to answer the questions below.
tblBooks
BookID Title Cost SupplierID
1 The way the wind blows 23.99 1
2 Is anybody out there? 9.99 1
3 What lies in the undergrowth? 6.99 2
4 A wizard’s journey 8.99 3
5 Jack and the sunflower 4.99 2
tblSupplier
SupplierID Name
1 Book warehouse
2 Books U Like
3 Book supplies
Questions .
Question 1: In the tblBooks table, which field is used for the primary key?
Answer
Question 2: In the tblBooks table, which field is used for the foreign key?
Answer
Question 3: In the tblSupplier table, which field is used for the primary key?
Answer
Page 1 Last updated: 17-06-21
KS4 – Databases and SQL Learner activity sheet
Lesson 1 – Database essentials
Question 4: List the results of executing the following SQL code on the book shop database:
1 SELECT tblSupplier.Name, tblBooks.Title
2 FROM tblSupplier, tblBooks
3 WHERE tblSupplier.SupplierID = tblBooks.SupplierID
4 AND tblSupplier.Name = "Books U Like";
Answer
Question 5: Write the SQL code for listing the book titles of all the books in the database.
Note: there might be slight variances in learner responses
1
2
3
Question 6: Write the SQL code for finding the supplier name of the book ‘The wizard’s journey’.
Note: there might be slight variances in learner responses
1
2
3
4
Page 2 Last updated: 17-06-21