Back to problems

User Shopping Sprees

SQL · Amazon · Medium

Description You have a table called transactions that records every purchase. There is no single-column primary key. Each row represents one purchase transaction. A user can appear multiple times on the same day. Write a query to find every user who has made purchases on three or more consecutive days. Return the result as a single column of user_id values, sorted in ascending order. Example Input Output Explanation User 2 bought something on 08/05, 08/06, and 08/07 — three…

Checking your access…