SQLZOO刷题记录4——SELECT within SELECT Tutorial

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

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

本章节主要训练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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值