SqlZoo.net习题答案:Using the SELECT statement.【bbc】

余生长醉 提交于 2019-11-26 18:36:37

习题地址:http://sqlzoo.net/1.htm

 

表结构:bbc(name, region, area, population, gdp)

 

2a.Show the name for the countries that have a population of at least 200 million. (200 million is 200000000, there are eight zeros)

select name 
from bbc where population >= 200000000

 

2b.Give the name and the per capita GDP for those countries with a population of at least 200 million.

select name, GDP/population
from bbc
where population >= 200000000

 

2c.Show the name and population in millions for the countries of 'Middle East'
Divide the population by 1000000 to get population in millions.

select name, population/1000000
from bbc
where region = 'Middle East'

 

2d.Show the name and population for 'France', 'Germany', 'Italy'

select name, population
from bbc
where name in ('France', 'Germany', 'Italy')

 

2e.Identify the countries which have names including the word 'United'

select name
from bbc
where name like '%United%'

转载于:https://www.cnblogs.com/Leo-Forest/archive/2012/06/01/2531029.html

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!