Skip to content

Commit 461f0ed

Browse files
committed
feat: add solutions to lc problems: No.0614,1270
* No.0614.Second Degree Follower * No.1270.All People Report to the Given Manager
1 parent 79b935f commit 461f0ed

File tree

6 files changed

+49
-27
lines changed

6 files changed

+49
-27
lines changed

solution/0600-0699/0614.Second Degree Follower/README.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,14 @@
5656
### **SQL**
5757

5858
```sql
59-
59+
# Write your MySQL query statement below
60+
SELECT f1.follower
61+
,COUNT(DISTINCT f2.follower) AS num
62+
FROM follow f1
63+
JOIN follow f2
64+
ON f1.follower = f2.followee
65+
GROUP BY f1.follower
66+
ORDER BY f1.follower
6067
```
6168

6269
<!-- tabs:end -->

solution/0600-0699/0614.Second Degree Follower/README_EN.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,14 @@ User Alice has 1 follower. Alice is not a second-degree follower because she doe
6767
### **SQL**
6868

6969
```sql
70-
70+
# Write your MySQL query statement below
71+
SELECT f1.follower
72+
,COUNT(DISTINCT f2.follower) AS num
73+
FROM follow f1
74+
JOIN follow f2
75+
ON f1.follower = f2.followee
76+
GROUP BY f1.follower
77+
ORDER BY f1.follower
7178
```
7279

7380
<!-- tabs:end -->
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Write your MySQL query statement below
2+
SELECT f1.follower
3+
,COUNT(DISTINCT f2.follower) AS num
4+
FROM follow f1
5+
JOIN follow f2
6+
ON f1.follower = f2.followee
7+
GROUP BY f1.follower
8+
ORDER BY f1.follower

solution/1200-1299/1270.All People Report to the Given Manager/README.md

+8-9
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,14 @@ employee_id 是 3, 8 ,9 的职员不会直接或间接的汇报给公司 CEO
7373

7474
```sql
7575
# Write your MySQL query statement below
76-
77-
SELECT e1.employee_id
78-
FROM employees e1
79-
JOIN employees e2
80-
JOIN employees e3
81-
ON e1.manager_id=e2.employee_id
82-
AND e2.manager_id=e3.employee_id
83-
where e3.manager_id=1
84-
AND e1.employee_id!=1;
76+
SELECT e1.employee_id
77+
FROM Employees e1
78+
JOIN Employees e2
79+
ON e1.manager_id = e2.employee_id
80+
JOIN Employees e3
81+
ON e2.manager_id = e3.employee_id
82+
WHERE e1.employee_id != 1
83+
AND e3.manager_id = 1
8584
```
8685

8786
<!-- tabs:end -->

solution/1200-1299/1270.All People Report to the Given Manager/README_EN.md

+9-8
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,15 @@ The employees with employee_id 3, 8, and 9 do not report their work to the head
7373
```sql
7474
# Write your MySQL query statement below
7575

76-
SELECT e1.employee_id
77-
FROM employees e1
78-
JOIN employees e2
79-
JOIN employees e3
80-
ON e1.manager_id=e2.employee_id
81-
AND e2.manager_id=e3.employee_id
82-
where e3.manager_id=1
83-
AND e1.employee_id!=1;
76+
# Write your MySQL query statement below
77+
SELECT e1.employee_id
78+
FROM Employees e1
79+
JOIN Employees e2
80+
ON e1.manager_id = e2.employee_id
81+
JOIN Employees e3
82+
ON e2.manager_id = e3.employee_id
83+
WHERE e1.employee_id != 1
84+
AND e3.manager_id = 1
8485
```
8586

8687
<!-- tabs:end -->
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Write your MySQL query statement below
2-
SELECT e1.employee_id
3-
FROM employees e1
4-
JOIN employees e2
5-
JOIN employees e3
6-
ON e1.manager_id=e2.employee_id
7-
AND e2.manager_id=e3.employee_id
8-
where e3.manager_id=1
9-
AND e1.employee_id!=1;
2+
SELECT e1.employee_id
3+
FROM Employees e1
4+
JOIN Employees e2
5+
ON e1.manager_id = e2.employee_id
6+
JOIN Employees e3
7+
ON e2.manager_id = e3.employee_id
8+
WHERE e1.employee_id != 1
9+
AND e3.manager_id = 1

0 commit comments

Comments
 (0)