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]
- SELECT Title, Price FROM Book(1)
- WHERE Genre = 'Fantasy' (allow double quotes; allow the two conditions in either order)(1)
- AND Price < 10 (reject <= 10; reject OR)(1)
- ORDER BY Price DESC (reject ORDER BY without DESC)(1)
- Answer: SELECT Title, Price FROM Book WHERE Genre = 'Fantasy' AND Price < 10 ORDER BY Price DESC;
- Examiner tip: Put ORDER BY last, and DESC is needed since the default is ascending.