SqlZoo.net习题答案:Using nested SELECT.
2012-06-01 23:54
477 查看
习题地址:http://sqlzoo.net/1a.htm
表结构: bbc(name, region, area, population, gdp)
1a.List each country name where the population is larger than 'Russia'.
1b.List the
1c.Show the countries in Europe with a per capita GDP greater than 'United Kingdom'.
1d.Which country has a population that is more than Canada but less than Algeria?
2a.Which countries have a GDP greater than any country in Europe? [Give the name only.]
3a.Find the largest country in each region, show the region, the name and the population:
3b.Find each country that belongs to a region where all populations are less than 25000000. Show name, region and population.
3c.Some countries have populations more than three times that of any of their neighbours (in the same region). Give the countries and regions.
表结构: bbc(name, region, area, population, gdp)
1a.List each country name where the population is larger than 'Russia'.
select name from bbc where population > (select population from bbc where name = 'Russia')
1b.List the
nameand
regionof countries in the regions containing 'India', 'Iran'.
select name, region from bbc where region in (select region from bbc where name in ('India', 'Iran'))
1c.Show the countries in Europe with a per capita GDP greater than 'United Kingdom'.
select name from bbc where region = 'Europe' and GDP/population > (select Gdp/population from bbc where name = 'United Kingdom')
1d.Which country has a population that is more than Canada but less than Algeria?
from bbc where population < (select population from bbc where name = 'Algeria') and population > (select population from bbc where name = 'Canada')
2a.Which countries have a GDP greater than any country in Europe? [Give the name only.]
select name from bbc where GDP > all (select GDP from bbc where region = 'Europe')
3a.Find the largest country in each region, show the region, the name and the population:
select region, name, population from bbc x where population >= all (select population from bbc y where x.region = y.region and y.population is not null)
3b.Find each country that belongs to a region where all populations are less than 25000000. Show name, region and population.
select name, region, population from bbc x where 25000000 > all (select population from bbc y where x.region = y.region)
3c.Some countries have populations more than three times that of any of their neighbours (in the same region). Give the countries and regions.
select name, region from bbc x where x.population/3 > all (select y.population from bbc y where x.region = y.region and y.name <> x.name)
相关文章推荐
- SqlZoo.net习题答案:Using the SELECT statement.【bbc】
- SqlZoo.net习题答案:Using the SELECT statement.【nobel】
- SqlZoo.net习题答案:How to do joins.【Album】
- SqlZoo.net习题答案:How to do joins.【Table Tennis】
- SqlZoo.net习题答案:The Join 【Movie】
- SqlZoo.net习题答案:Using SUM, COUNT, MAX, AVG, DISTINCT and ORDER BY.
- SqlZoo.net习题答案:NULL, INNER JOIN, LEFT JOIN, RIGHT JOIN
- could not execute query; SQL [select count(*) as col_0_0_ from order order0_]; nested exception is o
- SQLZOO:SELECT from WORLD Tutorial/zh
- Saving and Displaying Photos in SQL Server using ASP.NET and FileUpload Control
- C#.net中的using语法, SQl连接数据库
- asp.net学习之SqlDataSource 2 select的四种参数赋予形式的解释
- Ultra-fast ASP.NET: Build Ultra-Fast and Ultra-Scalable Websites Using ASP.NET and SQL Server
- Using SQLXML Bulk Load in the .NET Environment
- SQLZOO.NET
- SQLZOO(Using Null)Writeup
- sql在线练习网站(http://sqlzoo.cn)答案解析(1)
- using sql server or sql azure for session state store in asp.net
- SQLZOO SELECT FROM NOBEL
- c++ primer第五版(中文)习题答案 第三章第一节-命名空间using声明