Your question is SQL Running Total by Date. 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.
OneTrust QA analysts need a daily revenue view for posted privacy request charges. Write a PostgreSQL query that aggregates eligible charges by date and calculates the cumulative revenue over time.
request_status = 'completed' and charges with charge_status = 'posted'.| Column | Type | Description |
|---|---|---|
| request_idPK | VARCHAR(20) | Unique OneTrust privacy request identifier |
| request_status | VARCHAR(20) | Current processing status of the privacy request |
| Column | Type | Description |
|---|---|---|
| charge_idPK | INT | Unique charge identifier |
| request_id | VARCHAR(20) | Identifier of the related privacy request |
| charge_date | DATE | Date on which the charge was recorded |
| charge_status | VARCHAR(20) | Processing status of the charge |
| amount | NUMERIC(10,2) | Revenue amount for the charge |