601. Human Traffic of Stadium

X city built a new stadium, each day many people visit it and the stats are saved as these columns: id, visit_date, people

Please write a query to display the records which have 3 or more consecutive rows and the amount of people more than 100(inclusive).

Each day only have one row record, and the dates are increasing with id increasing.

Logic: The three three or more consecutive indices can be {i, i-1, i-2}, {i+1, i, i-1}, {i+2, i+1, i}





My homepage to record my thought processes for solving SQL and Algorithm questions

Recommended from Medium

Using plotly.express to make ZIP Code-level choropleth maps

Data Science on the Go — How? Ask a New Mom! Part II

Read Ebook Data Smart: Using Data Science to Transform Information into Insight FOR ANY DEVICE

Data Science for Risk Management in a Global Market

Watson Studio Overview for Analytics Managers

Demystifying the Secrets of Data Mesh with Snowflake’s Kent Graziano

Not Your Ordineray Doughnut

Data Science in the Real World

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Jen-Li Chen

Jen-Li Chen

In love with telling stories with data

More from Medium

SQL Server Indexes: Interview Questions

LeetCode SQL| 196. Delete Duplicate Emails

Top 05 SQL Query Optimization Tips | Devstringx

SQL Query Optimization

Seven Join Techniques in SQL