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

习题地址: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%'
posted @ 2012-06-01 16:45  Leo Forest  阅读(387)  评论(0编辑  收藏  举报