List the continents that have a total population of at least 100 million. 这题考察的是使用集聚函数生成表之后,如何过滤 一般我们生成一个查询结果集都会使用 where 表达式来过滤不想要的内容, 但是group by分组表达式在SQL中是在where过滤之后才能执行,所以当group by分组之后,我们需要另外一个表达式having 来过滤分组聚集后的结果集 having sum(population)>=10000000…
SELECT name, continent FROM world a WHERE population > ( FROM world b WHERE a.continent = b.continent AND a.name <> b.name) http://dba.stackexchange.com/questions/4066/cant-retrieve-data-of-countries-and-regions 老外也有在论坛为这题发愁的,幸好下面有人解答,我找着思路把这题给抄了…
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几遍之后才发现理解错题…
Find the largest country (by area) in each continent, show the continent, thename and the area: 找到每个洲面积最大的国家: SELECT continent, name, area FROM world x WHERE area >= ALL (SELECT area FROM world y WHERE y.continent=x.continent ) 其实这种>=ALL(子查询) 最不好理解,…
只发后面提升题目的题解,前面的太简单,写下来也没有意义 12.查找尤金•奧尼爾EUGENE O'NEILL得獎的所有細節 Find all details of the prize won by EUGENE O'NEILL select * from nobel where winner ='EUGENE O\'NEILL' 题目推荐用两个‘符号来转义 个人还是推荐linux系统常用的转义符号\,这个基本上是类unix的传统 13.列出爵士的獲獎者.年份.獎頁(爵士的名字以Sir開始).先顯示…