Big Countries
Preview mode. Log in to edit, run, submit, and save progress.
Description
You are given a World table containing information about countries. A country is considered big if: - it has an area of at least 3,000,000 km², OR - it has a population of at least 25,000,000. Write a SQL query to find the name, population, and area of all big countries. Return the result in any order.
Database Schema
World
| Column Name | Example Value |
|---|---|
| name | Afghanistan |
| continent | Asia |
| area | 652230 |
| population | 25500100 |
| gdp | 20343000000 |
Example
World
| name | continent | area | population | gdp |
|---|---|---|---|---|
| Afghanistan | Asia | 652230 | 25500100 | 20343000000 |
| Albania | Europe | 28748 | 2831741 | 12960000000 |
| Algeria | Africa | 2381741 | 37100000 | 188681000000 |
| Andorra | Europe | 468 | 78115 | 3712000000 |
| Angola | Africa | 1246700 | 20609294 | 100990000000 |
Output
| name | population | area |
|---|---|---|
| Afghanistan | 25500100 | 652230 |
| Algeria | 37100000 | 2381741 |
Explanation:
Afghanistan qualifies because its population (25500100) >= 25000000. Algeria qualifies because its population (37100000) >= 25000000. Albania, Andorra, and Angola do not meet either condition.
Approach hint
Start with a simple approach, explain the trade-off, then move toward a cleaner or more scalable solution.
Common mistake
Skipping assumptions, edge cases, or trade-offs can make an otherwise good answer feel incomplete.
World
| name | continent | area | population | gdp |
|---|---|---|---|---|
| Afghanistan | Asia | 652230 | 25500100 | 20343000000 |
| Albania | Europe | 28748 | 2831741 | 12960000000 |
| Algeria | Africa | 2381741 | 37100000 | 188681000000 |
| Andorra | Europe | 468 | 78115 | 3712000000 |
| Angola | Africa | 1246700 | 20609294 | 100990000000 |
Output
| name | population | area |
|---|---|---|
| Afghanistan | 25500100 | 652230 |
| Algeria | 37100000 | 2381741 |