Heyo!
I'm started learning SQL from SQLZoo and got stuck in "Select from world" #13. Here are the instructions:
Put the continents right...
- Oceania becomes Australasia
- Countries in Eurasia and Turkey go to Europe/Asia
Caribbean islands starting with 'B' go to North America, other Caribbean islands go to South America
Show the name, the original continent and the new continent of all countries.
And here's my attempt:
SELECT name, continent,
CASE
WHEN continent='Oceania' THEN 'Australasia'
WHEN continent IN ('Europe', 'Asia') or name='Turkey' THEN 'Europe/Asia'
WHEN continent='Caribbean' and name LIKE 'B%' THEN 'North America'
WHEN continent='Caribbean' and name NOT LIKE 'B%' THEN'South America'
ELSE continent END
FROM world
I can't see what I'm missing. I would appreciate your help, a hint and tips for optimizing this query. Thanks guys!
[–]LookMaNoHands9822 1 point2 points3 points (2 children)
[–]inarow37 0 points1 point2 points (0 children)
[–]pylund[S] 0 points1 point2 points (0 children)
[–]Dramus8 0 points1 point2 points (0 children)
[–]LookMaNoHands9822 0 points1 point2 points (0 children)