Loading...

Second Purchase

A hard SQL interview practice problem on DataDriven. Write and execute real sql code with instant grading.

Domain
SQL
Difficulty
hard

Problem

The onboarding team wants to study second-purchase behavior. For each user with more than one transaction, order their transactions by transaction_date and isolate the second one. Return the user_id, total_amount, and transaction_date of that second purchase.

Practice This Problem

Solve this SQL problem with real code execution. DataDriven runs your SQL queries against a live PostgreSQL database and grades it instantly.