Leetcode SQL 50 -- 595. Big Countries
Question
Table name: World
| Column Name | Type |
|---|---|
| name | varchar |
| continent | varchar |
| area | int |
| population | int |
| gdp | bigint |
name is the primary key (column with unique values) for this table.
Each row of this table gives information about the name of a country,
the continent to which it belongs, its area, the population, and its GDP value.
Big Country
A country is big if:
- it has an
areaof at least three million (i.e., 3000000 km2), or - it has a
populationof at least twenty-five million (i.e., 25000000).
Write a solution to find the
name,population, andareaof the big countries.
Return the result table in any order.
Explaination
Again we use SELECT <column_name> FROM <table_name> WHERE <conditions> to get the solution.
As question mention we should use OR and at least refers to >=.
Solution
SELECT name, population, area
FROM World
WHERE area >= 3000000 OR population >= 25000000;
More SQL 50 questions: here
Leetcode SQL 50 -- 595. Big Countries