Challenge

The full text of this chapter, to read or revisit. To practise, do the exercises.

▶ Do the exercises

Exercise 1 — Transfer window: Step 1

The transfer window is open and Professor Pi needs three scripts from you. Each step starts from the original data.

Step 1: two new trainers. Add Casey (Moonlight Hollow, 0 badges) and Riley (Sunset Valley, 1 badge) in a single INSERT, then show name, hometown and badges of every trainer, sorted by trainer_id.

Starter code
-- Step 1: two new trainers

Exercise 2 — Transfer window: Step 2

Step 2: a transfer.

Firochu moves from Taylor to Jordan (trainer_id 4), and Jordan earns one badge. Finish by showing Jordan's row joined with the new Codémon: trainer (Jordan's name), badges and codemon (the Codémon's name).

Starter code
-- Step 2: a transfer

Exercise 3 — Transfer window: Step 3

Step 3: the weakest are released.

Delete every Codémon of level 10 or less (that includes the wild Plantachu), then show name and level of the remaining Codémons, strongest first.

Starter code
-- Step 3: release the weakest
Back to the course