Skip to content

Commit bf3696b

Browse files
committed
Add solution 595 [sql]
1 parent d86af65 commit bf3696b

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ Complete [solutions](https://github.com/doocs/leetcode/tree/master/solution) to
4242
| 237 | [Delete Node in a Linked List](https://github.com/doocs/leetcode/tree/master/solution/237.Delete%20Node%20in%20a%20Linked%20List) | `Linked List` |
4343
| 344 | [Reverse String](https://github.com/doocs/leetcode/tree/master/solution/344.Reverse%20String) | `Two Pointers`, `String` |
4444
| 581 | [Shortest Unsorted Continuous Subarray](https://github.com/doocs/leetcode/tree/master/solution/581.Shortest%20Unsorted%20Continuous%20Subarray) | `Array` |
45+
| 595 | [Big Countries](https://github.com/doocs/leetcode/tree/master/solution/595.Big%20Countries) | `SQL` |
4546
| 605 | [Can Place Flowers](https://github.com/doocs/leetcode/tree/master/solution/605.Can%20Place%20Flowers) | `Array` |
4647
| 695 | [Max Area of Island](https://github.com/doocs/leetcode/tree/master/solution/695.Max%20Area%20of%20Island) | `Array`, `Depth-first Search` |
4748
| 703 | [Kth Largest Element in a Stream](https://github.com/doocs/leetcode/tree/master/solution/703.Kth%20Largest%20Element%20in%20a%20Stream) | `Heap` |
@@ -100,6 +101,7 @@ Complete [solutions](https://github.com/doocs/leetcode/tree/master/solution) to
100101
## Contributions
101102
I'm looking for long-term contributors/partners to this repo! Send me [PRs](https://github.com/doocs/leetcode/pulls) if you're interested! See the following:
102103
- Fork this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device.
104+
- Add or update file of the repository, then commit and push it to your GitHub repository.
103105
- Submit a pull request with your changes!
104106

105107
![how-to-contribute](http://p9ucdlghd.bkt.clouddn.com/how-to-contribute-yanglbme.png)

solution/595.Big Countries/README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
## 大的国家
2+
### 题目描述
3+
4+
这里有张 `World`
5+
```
6+
+-----------------+------------+------------+--------------+---------------+
7+
| name | continent | area | population | gdp |
8+
+-----------------+------------+------------+--------------+---------------+
9+
| Afghanistan | Asia | 652230 | 25500100 | 20343000 |
10+
| Albania | Europe | 28748 | 2831741 | 12960000 |
11+
| Algeria | Africa | 2381741 | 37100000 | 188681000 |
12+
| Andorra | Europe | 468 | 78115 | 3712000 |
13+
| Angola | Africa | 1246700 | 20609294 | 100990000 |
14+
+-----------------+------------+------------+--------------+---------------+
15+
```
16+
17+
如果一个国家的面积超过300万平方公里,或者人口超过2500万,那么这个国家就是大国家。
18+
19+
编写一个SQL查询,输出表中所有大国家的名称、人口和面积。
20+
21+
例如,根据上表,我们应该输出:
22+
```
23+
+--------------+-------------+--------------+
24+
| name | population | area |
25+
+--------------+-------------+--------------+
26+
| Afghanistan | 25500100 | 652230 |
27+
| Algeria | 37100000 | 2381741 |
28+
+--------------+-------------+--------------+
29+
```
30+
31+
### 解法
32+
33+
```sql
34+
# Write your MySQL query statement below
35+
select distinct name, population, area from World where area > 3000000 or population > 25000000
36+
37+
```

0 commit comments

Comments
 (0)