Show each customer's previous purchase amount
A purchases table logs every member's transactions. For a loyalty report, CRM wants each purchase shown next to that same member's previous purchase amount, so they can flag anyone whose latest spend dropped sharply.
Return member_id, purchase_date, amount and prev_amount (the member's immediately preceding purchase amount, or NULL if it was their first), ordered by member_id then purchase_date.
Schema
| purchase_id | INT |
| member_id | TEXT |
| purchase_date | DATE |
| amount | NUMERIC |
Example input
Stuck? Ask the coach for a nudge that won't give the answer away, or reveal the reference solution and a short walkthrough of why it works.