Skip to content

595. Big Countries | Database | LeetCode | Solution

This problem is not about programming related. It’s about the database. Here is the link to the problem.

There is a table called the world. It contains some information about countries around the world. These are name, continent, area, population, etc.

To solve this problem, we have to write a SQL solution to output big countries’ name, population, and area.

A country is big if it has an area of bigger than 3 million square km or a population of more than 25 million.

These are the explanation from the problem details. And the solution is very easy and self-explanatory.

I am using MySQL to solve this problem. Let’s look at the code

SELECT name, population, area FROM WORLD WHERE area > 3000000 OR population > 25000000

If you submit the code in LeetCode, it will be accepted.

Published inLeetCode

Comments are closed.