Skip to content

Instantly share code, notes, and snippets.

View joseph-higaki's full-sized avatar

Joseph Higaki joseph-higaki

  • Barcelona, Spain
View GitHub Profile
@joseph-higaki
joseph-higaki / read_spotify_user_streams.ipynb
Last active August 5, 2021 00:23
Understanding my Spotify Listening Habits - Part 0
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@joseph-higaki
joseph-higaki / 0 Back 2 Back Project Tasks.md
Last active August 2, 2021 10:26
Back 2 Back Project Tasks

Back 2 Back Project Tasks

Having a simple task (called projects) table with task_id, start and end dates, identify begin and end date for groups of tasks that are back 2 back. Back 2 back (b2b), means that a task starts on the same date where another ended.

2 solutions:

1. Using CTEs

I approached the solution as one where you needed to group the b2b tasks by its root or beggining task. As this is a tree, I used recursion through common table expressions (CTEs).