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
- Host: GitHub
- URL: https://github.com/itdxer/chaining-ranges-in-sql
- Owner: itdxer
- Created: 2020-06-26T13:47:11.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-06-26T15:35:31.000Z (almost 5 years ago)
- Last Synced: 2023-08-03T03:55:14.019Z (over 1 year ago)
- Topics: mysql, ranges, sql
- Language: TSQL
- Homepage: http://blog.itdxer.com/2020/06/22/chaining-ranges-with-sql.html
- Size: 1000 Bytes
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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.