|
| 1 | +<h2><a href="https://leetcode.com/problems/big-countries/">595. Big Countries</a></h2><h3>Easy</h3><hr><div class="sql-schema-wrapper__3VBi"><a class="sql-schema-link__3cEg">SQL Schema<svg viewBox="0 0 24 24" width="1em" height="1em" class="icon__1Md2"><path fill-rule="evenodd" d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"></path></svg></a></div><div><p>Table: <code>World</code></p> |
| 2 | + |
| 3 | +<pre>+-------------+---------+ |
| 4 | +| Column Name | Type | |
| 5 | ++-------------+---------+ |
| 6 | +| name | varchar | |
| 7 | +| continent | varchar | |
| 8 | +| area | int | |
| 9 | +| population | int | |
| 10 | +| gdp | int | |
| 11 | ++-------------+---------+ |
| 12 | +name is the primary key column for this table. |
| 13 | +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. |
| 14 | +</pre> |
| 15 | + |
| 16 | +<p> </p> |
| 17 | + |
| 18 | +<p>A country is <strong>big</strong> if:</p> |
| 19 | + |
| 20 | +<ul> |
| 21 | + <li>it has an area of at least three million (i.e., <code>3000000 km<sup>2</sup></code>), or</li> |
| 22 | + <li>it has a population of at least twenty-five million (i.e., <code>25000000</code>).</li> |
| 23 | +</ul> |
| 24 | + |
| 25 | +<p>Write an SQL query to report the name, population, and area of the <strong>big countries</strong>.</p> |
| 26 | + |
| 27 | +<p>Return the result table in <strong>any order</strong>.</p> |
| 28 | + |
| 29 | +<p>The query result format is in the following example.</p> |
| 30 | + |
| 31 | +<p> </p> |
| 32 | +<p><strong>Example 1:</strong></p> |
| 33 | + |
| 34 | +<pre><strong>Input:</strong> |
| 35 | +World table: |
| 36 | ++-------------+-----------+---------+------------+--------------+ |
| 37 | +| name | continent | area | population | gdp | |
| 38 | ++-------------+-----------+---------+------------+--------------+ |
| 39 | +| Afghanistan | Asia | 652230 | 25500100 | 20343000000 | |
| 40 | +| Albania | Europe | 28748 | 2831741 | 12960000000 | |
| 41 | +| Algeria | Africa | 2381741 | 37100000 | 188681000000 | |
| 42 | +| Andorra | Europe | 468 | 78115 | 3712000000 | |
| 43 | +| Angola | Africa | 1246700 | 20609294 | 100990000000 | |
| 44 | ++-------------+-----------+---------+------------+--------------+ |
| 45 | +<strong>Output:</strong> |
| 46 | ++-------------+------------+---------+ |
| 47 | +| name | population | area | |
| 48 | ++-------------+------------+---------+ |
| 49 | +| Afghanistan | 25500100 | 652230 | |
| 50 | +| Algeria | 37100000 | 2381741 | |
| 51 | ++-------------+------------+---------+ |
| 52 | +</pre> |
| 53 | +</div> |
0 commit comments