SQL · ByteDance · Medium
Problem: Find Each User's Longest Daily Login Run (SQL) Using the logins table, write SQL that determines the greatest number of calendar days each user logged in consecutively. Schema logins(user_id STRING, login_date DATE) A user can have several records for one calendar date; treat all such records as a single login day. Output Return the following columns: user_id max_consecutive_days Sort the result by user_id in ascending order. Notes A streak continues only across…
Checking your access…