A country is big if its area is at least 3,000,000 km² or its population is at least 25,000,000. Write a query that returns the name, population and area of every big country in the World table, ordered by name.
Input Table(s)
World
| Column | Type | Meaning |
|---|
| name | VARCHAR(255) | Country name, primary key |
| continent | VARCHAR(255) | Continent the country is on |
| area | INT | Area in square kilometers |
| population | BIGINT | Number of inhabitants |
| gdp | BIGINT | Gross domestic product. Not needed for this query. |
Keys: name is the primary key, so each country appears in exactly one row.
Output Contract
| Column | Type | Meaning |
|---|
| name | VARCHAR | Country name |
| population | BIGINT | Population as stored |
| area | INT | Area as stored |
-
Columns in this order:
name
,
population
,
area
.
-
One row per big country.
-
Order by
name
ascending.
name
is the primary key, so the order is unique.
-
No rounding or unit conversion.
Example
World
| name | continent | area | population | gdp |
|---|
| Arland | Europe | 3000000 | 1200000 | 45000000000 |
| Borovia | Asia | 450000 | 25000000 | 310000000000 |
| Calderra | Africa | 2999999 | 24999999 | 98000000000 |
| Dunmore | Oceania | 7600000 | 26000000 | 1500000000000 |
| Estavia | Europe | 120000 | 9000000 | 210000000000 |
Expected result:
| name | population | area |
|---|
| Arland | 1200000 | 3000000 |
| Borovia | 25000000 | 450000 |
| Dunmore | 26000000 | 7600000 |
Arland qualifies on area alone with a value exactly at the threshold, and Borovia qualifies on population alone at exactly 25,000,000. Dunmore passes both tests and still appears once. Calderra misses each threshold by one, and Estavia misses both.
Constraints and Clarifications
-
World
has at most 500 rows.
-
area
and
population
are non-negative integers.
-
Both thresholds are inclusive: a value equal to the threshold passes.
-
Meeting either threshold is enough. A country that meets both appears once.
-
The columns have no NOT NULL constraint. If one of
area
or
population
is NULL, judge the country on the other value alone. A country with both values NULL is not big.