Question 1
1 markA recipe website stores its recipes in a database table called Recipes, shown in the table.
State how many records are returned by this SQL query:
SELECT Name FROM Recipes WHERE Calories <= 450 AND Minutes >= 20Model answer
4 (Veg chilli, Lentil soup, Stir fry and Bean burger)
Explanation
Both conditions must be true because they are joined by AND. Bean burger has exactly 450 calories and Stir fry takes exactly 20 minutes; both are included because <= and >= include the boundary value. Chicken wrap has 450 calories but takes only 15 minutes, so it fails the second condition.
Mark scheme
-
1 mark
4
The records are Veg chilli, Lentil soup, Stir fry and Bean burger. Correct answer only. 3 usually means a boundary record (Stir fry at exactly 20 minutes or Bean burger at exactly 450 calories) was missed; 5 usually means Chicken wrap (only 15 minutes) was wrongly included.