Skip to content

Commit 6e33368

Browse files
authored
feat: add sql solution to lc problem: No.1355 (#1094)
No.1355.Activity Participants
1 parent cafab0b commit 6e33368

File tree

3 files changed

+30
-2
lines changed

3 files changed

+30
-2
lines changed

solution/1300-1399/1355.Activity Participants/README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,16 @@ Singing 活动有两个人参加 (Victor J. and Jade W.)</pre>
9191
### **SQL**
9292

9393
```sql
94-
94+
# Write your MySQL query statement below
95+
WITH
96+
t AS (
97+
SELECT activity, count(1) AS cnt
98+
FROM Friends
99+
GROUP BY activity
100+
)
101+
SELECT activity
102+
FROM t
103+
WHERE cnt > (SELECT min(cnt) FROM t) AND cnt < (SELECT max(cnt) FROM t);
95104
```
96105

97106
<!-- tabs:end -->

solution/1300-1399/1355.Activity Participants/README_EN.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,16 @@ Singing is performed by 2 friends (Victor J. and Jade W.)
8787
### **SQL**
8888

8989
```sql
90-
90+
# Write your MySQL query statement below
91+
WITH
92+
t AS (
93+
SELECT activity, count(1) AS cnt
94+
FROM Friends
95+
GROUP BY activity
96+
)
97+
SELECT activity
98+
FROM t
99+
WHERE cnt > (SELECT min(cnt) FROM t) AND cnt < (SELECT max(cnt) FROM t);
91100
```
92101

93102
<!-- tabs:end -->
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Write your MySQL query statement below
2+
WITH
3+
t AS (
4+
SELECT activity, count(1) AS cnt
5+
FROM Friends
6+
GROUP BY activity
7+
)
8+
SELECT activity
9+
FROM t
10+
WHERE cnt > (SELECT min(cnt) FROM t) AND cnt < (SELECT max(cnt) FROM t);

0 commit comments

Comments
 (0)