Write an SQL query to analyze a dataset and then write another query to go over it.
Use the supplied campaigns and ad_events tables. The first query should create a campaign-level analysis for January 2025. The second query should review campaigns with at least one impression by ranking them within each objective by click-through rate.
campaign_id, campaign_name, objective, impressions, clicks, spend, ctr_pct, and objective_rankobjective, objective_rank, then campaign_id2025-01-01 inclusive through 2025-02-01 exclusive.spend with two decimal places and use 0.00 when no event costs exist.ctr_pct to two decimal places.ctr_pct, place NULL values last, and assign equal values the same rank.| Column | Type | Description |
|---|---|---|
| campaign_idPK | INT | Unique campaign identifier |
| campaign_name | VARCHAR(100) | Campaign name |
| objective | VARCHAR(30) | Campaign objective |
| Column | Type | Description |
|---|---|---|
| event_idPK | INT | Unique event identifier |
| campaign_id | INT | Campaign associated with the event |
| event_date | DATE | Date on which the event occurred |
| event_type | VARCHAR(20) | Event category |
| cost | DECIMAL(10,2) | Cost associated with the event |