Skip to content

Commit ac50eef

Browse files
committed
feat: update solutions to lc problems: No.0183,0584,0595,1757
- No.0183.Customers Who Never Order - No.0584.Find Customer Referee - No.0595.Big Countries - No.1757.Recyclable and Low Fat Products
1 parent 92539a3 commit ac50eef

File tree

11 files changed

+69
-39
lines changed

11 files changed

+69
-39
lines changed

solution/0100-0199/0183.Customers Who Never Order/README.md

+10-7
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,22 @@
5757
### **SQL**
5858

5959
```sql
60-
select Name as Customers from Customers
61-
where id not in (select CustomerId from Orders)
60+
select Name as Customers
61+
from Customers
62+
where id not in (
63+
select CustomerId
64+
from Orders
65+
);
6266
```
6367

6468
```sql
65-
# Write your MySQL query statement below
6669
SELECT
67-
c.Name AS Customers
70+
c.Name AS Customers
6871
FROM
69-
customers AS c
70-
LEFT JOIN orders AS o ON c.Id = o.CustomerId
72+
customers AS c
73+
LEFT JOIN orders AS o ON c.Id = o.CustomerId
7174
WHERE
72-
o.CustomerId IS NULL
75+
o.CustomerId IS NULL;
7376
```
7477

7578
<!-- tabs:end -->

solution/0100-0199/0183.Customers Who Never Order/README_EN.md

+10-7
Original file line numberDiff line numberDiff line change
@@ -78,19 +78,22 @@ Orders table:
7878
### **SQL**
7979

8080
```sql
81-
select Name as Customers from Customers
82-
where id not in (select CustomerId from Orders)
81+
select Name as Customers
82+
from Customers
83+
where id not in (
84+
select CustomerId
85+
from Orders
86+
);
8387
```
8488

8589
```sql
86-
# Write your MySQL query statement below
8790
SELECT
88-
c.Name AS Customers
91+
c.Name AS Customers
8992
FROM
90-
customers AS c
91-
LEFT JOIN orders AS o ON c.Id = o.CustomerId
93+
customers AS c
94+
LEFT JOIN orders AS o ON c.Id = o.CustomerId
9295
WHERE
93-
o.CustomerId IS NULL
96+
o.CustomerId IS NULL;
9497
```
9598

9699
<!-- tabs:end -->
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
1-
select Name as Customers from Customers
2-
where id not in (select CustomerId from Orders)
1+
select Name as Customers
2+
from Customers
3+
where id not in (
4+
select CustomerId
5+
from Orders
6+
);

solution/0500-0599/0584.Find Customer Referee/README.md

+11
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,15 @@ WHERE
5353
referee_id != 2 OR referee_id IS NULL;
5454
```
5555

56+
MySQL 可使用 `IFNULL()`
57+
58+
```sql
59+
SELECT
60+
name
61+
FROM
62+
customer
63+
WHERE
64+
IFNULL(referee_id, 0) != 2;
65+
```
66+
5667
<!-- tabs:end -->

solution/0500-0599/0584.Find Customer Referee/README_EN.md

+12
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,16 @@ WHERE
6868
referee_id != 2 OR referee_id IS NULL;
6969
```
7070

71+
MySQL can use `IFNULL()`:
72+
73+
```sql
74+
SELECT
75+
name
76+
FROM
77+
customer
78+
WHERE
79+
IFNULL(referee_id, 0) != 2;
80+
```
81+
82+
7183
<!-- tabs:end -->

solution/0500-0599/0595.Big Countries/README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,13 @@ World 表:
7676

7777
### **SQL**
7878

79-
```
79+
```sql
8080
SELECT name,
81-
population,
82-
area
83-
FROM World
84-
WHERE area>3000000
85-
OR population>25000000
81+
population,
82+
area
83+
FROM world
84+
WHERE area > 3000000
85+
OR population > 25000000;
8686
```
8787

8888
<!-- tabs:end -->

solution/0500-0599/0595.Big Countries/README_EN.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,13 @@ World table:
6565

6666
### **SQL**
6767

68-
```
68+
```sql
6969
SELECT name,
70-
population,
71-
area
72-
FROM World
73-
WHERE area>3000000
74-
OR population>25000000
70+
population,
71+
area
72+
FROM world
73+
WHERE area > 3000000
74+
OR population > 25000000;
7575
```
7676

7777
<!-- tabs:end -->
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
SELECT name,
2-
population,
3-
area
4-
FROM World
5-
WHERE area>3000000
6-
OR population>25000000
2+
population,
3+
area
4+
FROM world
5+
WHERE area > 3000000
6+
OR population > 25000000;

solution/1700-1799/1757.Recyclable and Low Fat Products/README.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,13 @@ Result 表:
5858
### **SQL**
5959

6060
```sql
61-
# Write your MySQL query statement below
6261
SELECT
6362
product_id
6463
FROM
6564
Products
6665
WHERE
6766
low_fats = 'Y'
68-
AND recyclable = 'Y';
67+
AND recyclable = 'Y';
6968
```
7069

7170
<!-- tabs:end -->

solution/1700-1799/1757.Recyclable and Low Fat Products/README_EN.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,13 @@ Products table:
5858
### **SQL**
5959

6060
```sql
61-
# Write your MySQL query statement below
6261
SELECT
6362
product_id
6463
FROM
6564
Products
6665
WHERE
6766
low_fats = 'Y'
68-
AND recyclable = 'Y';
67+
AND recyclable = 'Y';
6968
```
7069

7170
<!-- tabs:end -->
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
# Write your MySQL query statement below
21
SELECT
32
product_id
43
FROM
54
Products
65
WHERE
76
low_fats = 'Y'
8-
AND recyclable = 'Y';
7+
AND recyclable = 'Y';

0 commit comments

Comments
 (0)