The "Big Countries interview question" is a fundamental SQL challenge. You are given a table World with columns name, continent, area, population, and gdp. A country is considered "big" if it meets at least one of two criteria: it has an area of at least 3 million , OR it has a population of at least 25 million. Your task is to write a query that returns the name, population, and area of all big countries.
Companies like Microsoft and Google use the "Big Countries coding problem" as a basic competency check for SQL. It tests whether a candidate knows how to use the WHERE clause with the OR operator and how to select specific columns. It's an "entry-level" database question but essential for any developer role.
This problem uses the SQL Selection and Filtering pattern.
SELECT name, population, area.WHERE area >= 3000000 OR population >= 25000000.
Note: In some database optimization contexts, using UNION of two separate queries (one for area, one for population) can sometimes be faster than an OR clause if the columns are indexed, though for this simple problem, OR is the standard answer.Table World:
SELECT * instead of the specific columns requested.AND instead of OR. A country only needs to meet one of the criteria.3,000,000), which causes a syntax error.For SQL interviews, always pay close attention to the specific columns requested in the output. Also, understand that OR can sometimes be inefficient on massive datasets; mentioning UNION as an alternative optimization shows the interviewer you have "Database interview pattern" depth.
| Title | Difficulty | Topics | LeetCode |
|---|---|---|---|
| Project Employees I | Easy | Solve | |
| Duplicate Emails | Easy | Solve | |
| Recyclable and Low Fat Products | Easy | Solve | |
| Fix Names in a Table | Easy | Solve | |
| Not Boring Movies | Easy | Solve |