Skip to content

Commit ba7390d

Browse files
authored
Add MySQL query solution to README_EN.md
Added MySQL solution for human traffic analysis in stadium.
1 parent 2b32b0e commit ba7390d

File tree

1 file changed

+31
-0
lines changed
  • solution/0600-0699/0601.Human Traffic of Stadium

1 file changed

+31
-0
lines changed

solution/0600-0699/0601.Human Traffic of Stadium/README_EN.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,4 +104,35 @@ ORDER BY 1;
104104

105105
<!-- solution:end -->
106106

107+
<!-- solution:start -->
108+
109+
### Solution 2
110+
111+
<!-- tabs:start -->
112+
113+
#### MySQL
114+
115+
```sql
116+
# Write your MySQL query statement below
117+
WITH Consecutive AS (
118+
SELECT
119+
*,
120+
id - ROW_NUMBER() OVER() AS id_diff
121+
FROM Stadium
122+
WHERE people >= 100
123+
)
124+
SELECT id, visit_date, people
125+
FROM Consecutive
126+
WHERE id_diff IN (
127+
SELECT id_diff
128+
FROM Consecutive
129+
GROUP BY id_diff HAVING COUNT(*) > 2
130+
)
131+
ORDER BY visit_date;
132+
```
133+
134+
<!-- tabs:end -->
135+
136+
<!-- solution:end -->
137+
107138
<!-- problem:end -->

0 commit comments

Comments
 (0)