Skip to content
Quantoros

Return userid and logindate for logins where the user did NOT log in the next calendar day (excluding each users final…

SQLLevel: AdvancedGaps, islands and streaks

Return user_id and login_date for logins where the user did NOT log in the next calendar day (excluding each users final login).

Table definitions (from the source exercise):

CREATE TABLE logins(login_id INTEGER PRIMARY KEY, user_id INTEGER, login_date TEXT);
Hints
  • Define one output row and the source-table keys.
  • Check duplicates, NULLs and the order of filtering and aggregation.

Answer

This answer is part of mentoring

Advanced questions come with a full breakdown and a mock interview with a working quant researcher. The first call is free.

Source and licence: SQL Practice Lab — Ebrahim Sharifi · MIT

Related questions