Your question is SQL Window Functions Running Total. 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.
Quadrint analysts need a product-level revenue trend for a reporting surface such as the Mission Operations Dashboard. Write a PostgreSQL query that summarizes completed sales by product and day, then calculates each product's running revenue total.
sale_status = 'completed' and matching products.daily_revenue.running_total.| Column | Type | Description |
|---|---|---|
| product_idPK | INTEGER | Unique product identifier |
| product_name | VARCHAR(120) | Quadrint product name |
| lifecycle_status | VARCHAR(20) | Current product lifecycle status |
| Column | Type | Description |
|---|---|---|
| sale_idPK | INTEGER | Unique sale identifier |
| product_id | INTEGER | Product associated with the sale |
| sale_date | DATE | Date on which the sale occurred |
| amount | NUMERIC(12,2) | Revenue amount |
| sale_status | VARCHAR(20) | Sale processing status |