Big Countries - Problem

Given a World table with information about countries, find all the big 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

Return the name, population, and area of all big countries in any order.

Table Schema

World
Column Name Type Description
name PK varchar Country name (primary key)
continent varchar Continent where the country is located
area int Country area in km²
population int Country population
gdp bigint Country GDP value
Primary Key: name
Note: Each row represents a country with its geographical and economic information

Input & Output

Example 1 — Mixed Big Countries
Input Table:
name continent area population gdp
Afghanistan Asia 652230 25500100 20343000000
Albania Europe 28748 2831741 12960000000
Algeria Africa 2381741 37100000 188681000000
Output:
name population area
Afghanistan 25500100 652230
Algeria 37100000 2381741
💡 Note:

Afghanistan qualifies because its population (25,500,100) is ≥ 25,000,000, even though its area is less than 3,000,000 km². Algeria qualifies because its population (37,100,000) is ≥ 25,000,000. Albania is excluded because both its area (28,748) and population (2,831,741) are below the thresholds.

Example 2 — Large Area, Small Population
Input Table:
name continent area population gdp
Russia Europe 17098242 146793744 1699876578000
Kazakhstan Asia 2724900 18776707 236635000000
Output:
name population area
Russia 146793744 17098242
💡 Note:

Russia qualifies on both criteria: area (17,098,242) ≥ 3,000,000 km² AND population (146,793,744) ≥ 25,000,000. Kazakhstan is excluded because its population (18,776,707) is less than 25,000,000 and its area (2,724,900) is less than 3,000,000 km².

Constraints

  • 1 ≤ World table rows ≤ 200
  • name is unique for each country
  • area and population are non-negative integers

Visualization

Tap to expand
Big Countries Problem OverviewInput: WorldnameareapopulationRussia17M147MIceland0.1M0.4MChina9.6M1412MWHEREarea >= 3MORpop >= 25MOutput: Big CountriesnameareapopulationRussia17M147MChina9.6M1412MIceland filtered out: fails both conditions
Understanding the Visualization
1
Input
World table with country data
2
Filter
WHERE area >= 3M OR population >= 25M
3
Output
Countries meeting either criteria
Key Takeaway
🎯 Key Insight: Use OR conditions when records can qualify through multiple different criteria
Asked in
Amazon 28 Google 22 Facebook 15
125.0K Views
High Frequency
~8 min Avg. Time
1.9K Likes
Ln 1, Col 1
Smart Actions
💡 Explanation
AI Ready
💡 Suggestion Tab to accept Esc to dismiss
// Output will appear here after running code
Code Editor Closed
Click the red button to reopen