Interactive exercise 9 Difficult Questions That Utilize Techniques Not Covered In Prior Sections at https://sqlzoo.net
:
Find the continents where all countries have a population <= 25000000. Then find the names of the countries associated with these continents. Show name, continent and population.
What I have done:
SELECT name, continent, population
FROM world x
WHERE population <= ALL(SELECT population
FROM world y
WHERE y.continent = x.continent
AND population > 25000000)
What am I writing wrong?
distinct
as there is one row per country. There are multiple ways to solve this, you could just as easily -- or more easily in fact -- usemax
as suggested in the other answer. – Tad