Back to problems

Same Week Purchases

SQL · Pinterest · Medium

Table: user_transactions transaction_id is the primary key. Each row represents one purchase transaction. Write a query that returns the percentage of users who made at least one additional purchase within 7 days of their very first purchase. The result column should be named same_week_purchases_pct and rounded to two decimal places. Example Input: Output: Explanation: User 1's first purchase was on 2023-01-01, and they made another purchase on 2023-01-05 (4 days later) —…

Checking your access…