Quick
Ref.
Functions
- date
- number
- string
Data Types
- date
- number
- string
| BBC Country Profile: Aggregate functionsThis tutorial concerns aggregate functions such as COUNT,
SUM and AVG. Exercises
Using SUM, COUNT,
MAX, AVG, DISTINCT and
ORDER BY.
1a. Show the total population of the world.
bbc(name, region, area, population, gdp)
|
Results
|
1b. List all the regions - just once each.
|
Results
|
1c. Give the total GDP of Africa
|
Results
|
1d. How many countries have an area of at least 1000000
|
Results
|
1e. What is the total population of ('France','Germany','Spain')
|
Results
|
Using GROUP BY and HAVING.
2a. For each region show the region and number of
countries.
|
Results
|
2b. For each region show the region and number of
countries with populations of at least 10 million.
|
Results
|
2c. List the regions with total populations of at least
100 million.
|
Results
|
The next tutorial is looks at the Table Tennis
database. It shows how queries may use records from two related
tables.
| |