For each customer's orders, show how the order value compares to their previous order. Return customer_id, order_id, order_date, total_amount, the previous order's amount, and the difference. Use LAG to access the previous row.
Schema
🔑idINT
🔗customer_idINT
order_dateTEXT
statusTEXT
total_amountREAL
postgresql
Run your query to see results
Press Ctrl + Enter to execute