sqlzoo.net刷题3

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,然后列出这些洲所在的国家以及人口

后来select几遍之后才发现理解错题意了,英语果然还是硬伤,题目我是看了stackoverflow之后才理解的,

完整并且翻译应该是下面:

找到那些洲,这些洲下面每个国家的人口都<= 25000000,然后列举出这些洲的国家的名字以及他们的人口

SELECT name, continent, population 
FROM world w
WHERE NOT EXISTS (                  
   SELECT *
   FROM world nx
   WHERE nx.continent = w.continent 
   AND nx.population > 25000000   
   );

这个子查询是反查

posted on 2016-08-28 05:57  winters86  阅读(287)  评论(0编辑  收藏  举报