
本章节主要训练SELECT语句的嵌套使用。
题目3:Neighbours of Argentina and Australia
List the name and continent of countries in the continents containing either Argentina or Australia. Order by name of the country.
解题3:
SELECT name, continent
FROM world
WHERE continent IN
(SELECT continent
FROM world
WHERE name IN ('Argentina','Australia'))
ORDER BY name
题目5:Percentages of Germany
Germany (population 80 million) has the largest population of the countries in Europe. Austria (population 8.5 million) has 11% of the population of Germany.
Show the name and the population of each country in Europe. Show the population as a percentage of the population of Germany.
The format should be Name, Percentage

本篇博客介绍了如何使用SQL的嵌套SELECT语句来解决复杂的查询问题,如找出与特定国家在同一大陆的其他国家、计算人口比例、筛选GDP高于所有欧洲国家的国家、确定每个大洲的最大国家以及找出人口少于2500万的大陆等。通过实例解析了ALL、MAX、MIN和CONCAT等函数的用法,以及如何在WHERE子句中使用这些函数进行比较和分组操作。
401

被折叠的 条评论
为什么被折叠?



