ledger_entries has one row per ride payment (user_id, transaction_date, amount). For each user with at least three transactions, return their third transaction in chronological order; if two transactions share a date, the smaller amount counts first. Output columns: user_id, third_transaction_date, amount. Order by user_id ascending.
| Column | Type |
|---|---|
| user_id | INTEGER |
| transaction_date | DATE |
| amount | REAL |
| user_id | transaction_date | amount |
|---|---|---|
| 1 | 2026-01-01 | 10 |
| 1 | 2026-01-03 | 20 |
| 1 | 2026-01-05 | 30 |
| 1 | 2026-01-08 | 40 |
| 2 | 2026-02-01 | 15 |
| 2 | 2026-02-04 | 25 |
| 2 | 2026-02-06 | 35 |
| user_id | third_transaction_date | amount |
|---|---|---|
| 1 | 2026-01-05 | 30 |
| 2 | 2026-02-06 | 35 |
Solve it in the live editor on this page — run on sample data, then submit against hidden tests.
‹ Frequent Support Contact Customers · Second Distinct Compensation Level ›
{{ totalCount }} questions in the style asked at Amazon, Microsoft, Google, Meta, Flipkart and more — {{ hardPct }}% Hard. Write SQL in a real database engine in your browser, run it on sample data, then evaluate against hidden tests.
Company tags show where this type of question is commonly reported in interviews. Questions, data and solutions are written by TechTown.
{{ cur.statement }}
No submissions yet. Press Evaluate to submit your query.
{{ solutionSql }}
{{ out.error }}
You have solved your 3 free questions — nice work! Log in (free) to unlock all 150 questions, keep your streak and appear on the leaderboard.