An open API service indexing awesome lists of open source software.

https://github.com/itdxer/chaining-ranges-in-sql

Code with examples provided for the article
https://github.com/itdxer/chaining-ranges-in-sql

mysql ranges sql

Last synced: 22 days ago
JSON representation

Code with examples provided for the article

Awesome Lists containing this project

README

        

# Chaining ranges in SQL

The main purpose for this code is to provide an example of the solution for the following problem

> Let's say we have an office that can be accessed only using an ID card. Each time an employee enters and leaves the office we record this event as a row in the database. In the database, we store user ID, time when an employee entered and left the office. We want to write a query that extracts all time ranges when there was at least one person in the office.