Your question is Running Totals Over Time. Start with the requirements and the two tables on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Blend360 needs a revenue trend for its performance reporting dashboard. Write a PostgreSQL query that calculates daily settled revenue from completed orders and a chronological running revenue total.
order_date as daily_revenue.running_total across dates using a window function.| Column | Type | Description |
|---|---|---|
| order_idPK | INT | Unique order identifier |
| order_date | DATE | Date the order was placed |
| order_status | VARCHAR(20) | Order lifecycle status |
| Column | Type | Description |
|---|---|---|
| payment_idPK | INT | Unique payment identifier |
| order_id | INT | References blend360_orders.order_id |
| payment_amount | DECIMAL(10,2) | Amount processed for the payment |
| payment_status | VARCHAR(20) | Payment processing status |
| payment_method | VARCHAR(30) | Payment method used |