Lazy loaded image
Technology
Lazy loaded imageSQL Q&A4 SUM and COUNT
Words 186Read Time 1 min
May 8, 2020
Jun 12, 2025
type
status
date
slug
summary
tags
category
icon
password
notion image

1.Total world population

Show the total population of the world.
world(name,continent,area,population,gdp)
 
Correct answer
SUM(population)

7830500887

2.List of continents

List all the continents - just once each.
continent

Asia

Europe

Africa

North America

South America

Insular Oceania

 

3.GDP of Africa

Show the year and subject that won 'Albert Einstein' his prize.
total_GDP

2994342000000

4.Count the big countries

How many countries have an area of at least 1000000
COUNT(continent)

28

5.Baltic states population

What is the total population of ('Estonia', 'Latvia', 'Lithuania')
 
total_population

6115449

6.Using GROUP BY and HAVING Counting the countries of each continent

For each continent show the continent and number of countries.
continent
country_count
Africa
54
Asia
47
Europe
44
Insular Oceania
14
North America
23
South America
12

7.Counting big countries in each continent

For each continent show the continent and number of countries with populations of at least 10 million.

continent
count(name)
Africa
29
Asia
26
Caribbean
2
Eurasia
1
Europe
14
North America
4
Oceania
1
South America
8

8.Counting big continents

List the continents that have a total population of at least 100 million.
continent

Africa

Asia

Eurasia

Europe

North America

South America

 
上一篇
SQL Q&A3 SELECT in SELECT
下一篇
SQL Q&A4 The JOIN operation