Compute cumulative sales by store, resetting to 0 whenever a new month starts. Write the query.
Treat each row as one store sale. Include nullable sale amounts as zero for cumulative calculations.
store_id, sale_date, sale_amount, and cumulative_sales.store_id, sale_date, and sale_id.| Column | Type | Description |
|---|---|---|
| sale_idPK | INT | Unique identifier for the sale |
| store_id | VARCHAR(20) | Store associated with the sale |
| sale_date | DATE | Date of the sale |
| sale_amount | NUMERIC(12,2) | Sale amount, which may be NULL |