Bolt marketing analysts need to compare revenue generated with campaign costs across cities and channels. The source tables contain city-level records, but the required KPI is reported at the date and channel level.
Write a PostgreSQL query that calculates Bolt ROI by date and channel, where ROI is total revenue divided by total cost.
NULL ROI when total cost is zero.| Column | Type | Description |
|---|---|---|
| date | DATE | Date on which the channel cost was incurred |
| channel | VARCHAR(40) | Bolt marketing or acquisition channel |
| city | VARCHAR(80) | Bolt operating city |
| cost | NUMERIC(12,2) | Cost attributed to the city and channel |
| Column | Type | Description |
|---|---|---|
| date | DATE | Date on which the order was completed |
| channel | VARCHAR(40) | Bolt channel attributed to the order |
| city | VARCHAR(80) | City associated with the order |
| order_id | BIGINT | Unique order identifier |
| revenue | NUMERIC(12,2) | Revenue attributed to the order |