Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 2d06934

Browse files
committed
LeetCode 607~613 mysql
1 parent 7f8ab7c commit 2d06934

File tree

15 files changed

+134
-150
lines changed

15 files changed

+134
-150
lines changed

‎solution/0600-0699/0607.Sales Person/README.md‎

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,18 @@ None
1313

1414
<!-- tabs:start -->
1515

16-
### **Python3**
17-
<!-- 这里可写当前语言的特殊实现逻辑 -->
16+
### **SQL**
1817

19-
```python
20-
21-
```
22-
23-
### **Java**
24-
<!-- 这里可写当前语言的特殊实现逻辑 -->
25-
26-
```java
27-
28-
```
29-
30-
### **...**
3118
```
32-
19+
SELECT name
20+
FROM salesperson
21+
WHERE sales_id NOT IN
22+
(SELECT sales_id
23+
FROM orders
24+
WHERE com_id =
25+
(SELECT com_id
26+
FROM company
27+
WHERE name = 'RED'))
3328
```
3429

35-
<!-- tabs:end -->
30+
<!-- tabs:end -->

‎solution/0600-0699/0607.Sales Person/README_EN.md‎

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,18 @@ None
1111

1212
<!-- tabs:start -->
1313

14-
### **Python3**
14+
### **SQL**
1515

16-
```python
17-
18-
```
19-
20-
### **Java**
21-
22-
```java
23-
24-
```
25-
26-
### **...**
2716
```
28-
17+
SELECT name
18+
FROM salesperson
19+
WHERE sales_id NOT IN
20+
(SELECT sales_id
21+
FROM orders
22+
WHERE com_id =
23+
(SELECT com_id
24+
FROM company
25+
WHERE name = 'RED'))
2926
```
3027

31-
<!-- tabs:end -->
28+
<!-- tabs:end -->
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
SELECT name
2+
FROM salesperson
3+
WHERE sales_id NOT IN
4+
(SELECT sales_id
5+
FROM orders
6+
WHERE com_id =
7+
(SELECT com_id
8+
FROM company
9+
WHERE name = 'RED'))

‎solution/0600-0699/0608.Tree Node/README.md‎

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,22 @@ None
1313

1414
<!-- tabs:start -->
1515

16-
### **Python3**
17-
<!-- 这里可写当前语言的特殊实现逻辑 -->
16+
### **SQL**
1817

19-
```python
20-
21-
```
22-
23-
### **Java**
24-
<!-- 这里可写当前语言的特殊实现逻辑 -->
25-
26-
```java
27-
28-
```
29-
30-
### **...**
3118
```
32-
19+
SELECT id AS Id,
20+
21+
CASE
22+
WHEN p_id is NULL THEN
23+
'Root'
24+
WHEN id IN
25+
(SELECT p_id
26+
FROM tree
27+
WHERE p_id is NOT null) THEN
28+
'Inner'
29+
ELSE 'Leaf'
30+
END AS Type
31+
FROM tree
3332
```
3433

35-
<!-- tabs:end -->
34+
<!-- tabs:end -->

‎solution/0600-0699/0608.Tree Node/README_EN.md‎

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,22 @@ None
1111

1212
<!-- tabs:start -->
1313

14-
### **Python3**
14+
### **SQL**
1515

16-
```python
17-
18-
```
19-
20-
### **Java**
21-
22-
```java
23-
24-
```
25-
26-
### **...**
2716
```
28-
17+
SELECT id AS Id,
18+
19+
CASE
20+
WHEN p_id is NULL THEN
21+
'Root'
22+
WHEN id IN
23+
(SELECT p_id
24+
FROM tree
25+
WHERE p_id is NOT null) THEN
26+
'Inner'
27+
ELSE 'Leaf'
28+
END AS Type
29+
FROM tree
2930
```
3031

31-
<!-- tabs:end -->
32+
<!-- tabs:end -->
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
SELECT id AS Id,
2+
3+
CASE
4+
WHEN p_id is NULL THEN
5+
'Root'
6+
WHEN id IN
7+
(SELECT p_id
8+
FROM tree
9+
WHERE p_id is NOT null) THEN
10+
'Inner'
11+
ELSE 'Leaf'
12+
END AS Type
13+
FROM tree

‎solution/0600-0699/0610.Triangle Judgement/README.md‎

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,16 @@ None
1313

1414
<!-- tabs:start -->
1515

16-
### **Python3**
17-
<!-- 这里可写当前语言的特殊实现逻辑 -->
16+
### **SQL**
1817

19-
```python
20-
21-
```
22-
23-
### **Java**
24-
<!-- 这里可写当前语言的特殊实现逻辑 -->
25-
26-
```java
27-
28-
```
29-
30-
### **...**
3118
```
32-
19+
SELECT x,
20+
y,
21+
z,
22+
if(x + y > z
23+
AND x + z > y
24+
AND y + z > x, "Yes", "No") AS triangle
25+
FROM triangle
3326
```
3427

35-
<!-- tabs:end -->
28+
<!-- tabs:end -->

‎solution/0600-0699/0610.Triangle Judgement/README_EN.md‎

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,16 @@ None
1111

1212
<!-- tabs:start -->
1313

14-
### **Python3**
14+
### **SQL**
1515

16-
```python
17-
18-
```
19-
20-
### **Java**
21-
22-
```java
23-
24-
```
25-
26-
### **...**
2716
```
28-
17+
SELECT x,
18+
y,
19+
z,
20+
if(x + y > z
21+
AND x + z > y
22+
AND y + z > x, "Yes", "No") AS triangle
23+
FROM triangle
2924
```
3025

31-
<!-- tabs:end -->
26+
<!-- tabs:end -->
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
SELECT x,
2+
y,
3+
z,
4+
if(x + y > z
5+
AND x + z > y
6+
AND y + z > x, "Yes", "No") AS triangle
7+
FROM triangle

‎solution/0600-0699/0612.Shortest Distance in a Plane/README.md‎

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,15 @@ None
1313

1414
<!-- tabs:start -->
1515

16-
### **Python3**
17-
<!-- 这里可写当前语言的特殊实现逻辑 -->
16+
### **SQL**
1817

19-
```python
20-
21-
```
22-
23-
### **Java**
24-
<!-- 这里可写当前语言的特殊实现逻辑 -->
25-
26-
```java
27-
28-
```
29-
30-
### **...**
3118
```
32-
19+
SELECT round(min(sqrt(power(p1.x-p2.x,
20+
2) + power(p1.y-p2.y,
21+
2))),
22+
2) shortest
23+
FROM point_2d p1, point_2d p2
24+
WHERE (p1.x, p1.y) <> (p2.x,p2.y)
3325
```
3426

35-
<!-- tabs:end -->
27+
<!-- tabs:end -->

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /