Write a SQL query to calculate the conversion rate by customer segment over a specific time period for Rivian marketing campaigns.
Assume a customer is exposed when a campaign event exists during the period, and converted when that event has converted = TRUE. Use the period from 2025-01-01 through 2025-03-31, inclusive.
segment, exposed_customers, converted_customers, and conversion_rate_pct.| Column | Type | Description |
|---|---|---|
| customer_idPK | INT | Unique customer identifier |
| customer_name | VARCHAR(100) | Customer name |
| segment | VARCHAR(50) | Customer marketing segment |
| Column | Type | Description |
|---|---|---|
| event_idPK | INT | Unique campaign event identifier |
| customer_id | INT | Customer associated with the campaign event |
| campaign_name | VARCHAR(100) | Rivian marketing campaign name |
| event_date | DATE | Date of campaign exposure or conversion event |
| converted | BOOLEAN | Whether the campaign event resulted in a conversion |