-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHuman Traffic of Stadium
More file actions
29 lines (26 loc) · 904 Bytes
/
Human Traffic of Stadium
File metadata and controls
29 lines (26 loc) · 904 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# Write your MySQL query statement below
# select s.id, s.visit_date, s.people
# from stadium s
# where 3 <= (
# select count(*)
# from stadium s2
# where s2.people >= 100 and s2.visit_date = 1 + (
# select s3.visit_date
# from stadium s3
# where s3.people >= 100))
# select *
# from stadium s
# where s.people >= 100 and s.visit_date in (
# select s2.visit_date + 1
# from stadium s2
# where s2.people >= 100 and s2.visit_date in (
# select s3.visit_date + 1
# from stadium s3
# where s3.people >= 100));
select distinct(s.id), s.visit_date, s.people
from stadium s, stadium s2, stadium s3
where s.people >= 100 and s2.people >= 100 and s3.people >= 100 and (
(s.id = s2.id - 1 and s2.id = s3.id - 1) or
(s2.id = s.id - 1 and s.id = s3.id - 1) or
(s2.id = s3.id - 1 and s3.id = s.id - 1))
order by s.id asc;