(SELECT within SELECT Tutorial - SQLZoo题目9)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.
难点:如何找到所有国家人口都小于等于25000000的大洲。
方法1:(反做)
WHERE continent NOT IN (SELECT continent FROM world WHERE population > 25000000)
方法2:(正做,GROUP BY 和 HAVING)(注意GROUP BY 和 HAVING 的用法替换掉了WHERE)
WHERE continent IN (SELECT continent FROM world GROUP BY continent HAVING max(population) <= 25000000)