Six original Cambridge-style questions on SQL DML using the library tables, every output checked by running the query.
Using the MEMBER table in this lesson, give the output of:
SELECT FormGroup, COUNT(MemberID) FROM Member GROUP BY FormGroup ORDER BY FormGroup;
Write an SQL query to output the Title and Author of every SciFi book in the BOOK table, most expensive first. Give the output.
Write an SQL query to output the total price of all the books that are currently out on loan (not returned). Give the output.
Write SQL statements to: (a) add member M05, Eli Brown, in form group 12B; (b) record that loan L05 has been returned; (c) delete every loan that has been returned.
A student wants the average price of each genre and writes:
SELECT Genre, AVG(Price) FROM Book ORDER BY Genre GROUP BY Genre;
Identify the error and give the output of the corrected query.
The statement INSERT INTO Book VALUES ('B106', 'Wonder', 'Palacio', 'Adventure', 9.00); is run. Then the query SELECT AVG(Price) FROM Book WHERE Genre = 'Adventure'; is run. Give the output and show your working.
Mark this once you have attempted all six and checked your working. It records a Practiced badge on the topic and adds a one-time bonus. Revealing the solutions alone does not count.