All Downloads are FREE. Search and download functionalities are using the official Maven repository.

g0601_0700.s0601_human_traffic_of_stadium.script.sql Maven / Gradle / Ivy

There is a newer version: 1.37
Show newest version
# Write your MySQL query statement below
# #Hard #Database
select id, visit_date, people
from 
(select 

id, visit_date, people, 
 lead(people, 1) over ( order by id) as 1_next, 
 lead(people, 2) over ( order by id) as 2_next,
 lag(people, 1) over ( order by id) as 1_prev,
 lag(people, 2) over ( order by id) as 2_prev

from Stadium
) a

where (people >= 100) and

(
    (1_next >= 100 and 2_next >=100) or
    (1_prev >= 100 and 2_prev >=100) or
    (1_prev >= 100 and 1_next >=100)
)




© 2015 - 2024 Weber Informatics LLC | Privacy Policy