Challenge
The full text of this chapter, to read or revisit. To practise, do the exercises.
▶ Do the exercisesExercise 1 — Leaderboard: Step 1
The Codédex is getting a leaderboard screen. Let's build its queries step by step.
Step 1: return the name and power of the 3 weakest Codémons, weakest first.
Starter code
-- Step 1: the 3 weakestExercise 2 — Leaderboard: Step 2
Step 2: the water and fire divisions get their own board. Return the name, type and level of the Codémons whose type is water or fire, sorted by level descending, then by name ascending.
Starter code
-- Step 2: water & fire divisionExercise 3 — Leaderboard: Step 3
Step 3: the screen shows the Codémons alphabetically, 2 per page. Write the query that returns the name of the Codémons on page 2.
Hint
Page 1 shows rows 1–2, page 2 shows rows 3–4. OFFSET tells SQL how many rows to skip.
Starter code
-- Step 3: page 2, two per page