You are on page 1of 3

<模範解答>

1. insert into country(


Code
, Name
, Continent
, Region
, SurfaceArea
, IndepYear
, Population
, LifeExpectancy
) values(
‘SSD’
, ‘South Sudan’
, ‘Africa’
, ‘Northern Africa’
, 619745.00
, 2011
, 11194000
, 58.1
);

2. select
count(Code)
from
country
;

3. select
Code
, Name
from
country
where
Continent = ‘Asia’
and Population >= 100000000
order by
Population desc
;

4. select
Name
, SurfaceArea
from
country
where
Name like ‘A%’
order by
SurfaceArea asc;

5. select
Continent
, count(Code) as DependCountry
from
country
where
IndepYear is null
group by
Continent
order by
count(Code) desc
;

6. select
Continent
, Region
, sum(Population) as TotalPopulation
, avg(Lifexpectancy) as AvgLifeExpectancy
from
country
group by
Continent
, Region
order by
Continent asc
, Region asc
;

7. update
country
set
IndepYear = 2002
, GNP = 3090.00
where
Code = ‘TMP’
;

8. delete from
country
where
Code = ‘YUG’
;

You might also like