How would you design a star schema for tracking user ad impressions and clicks across different platforms for Reddit?
Assume the schema includes user and platform dimensions plus a daily ad engagement fact table. Write a SQL query that summarizes all platforms, including platforms without activity.
platform_name, unique_users, total_impressions, total_clicks, and ctr_percenttotal_impressions descending, then platform_id ascending| Column | Type | Description |
|---|---|---|
| platform_idPK | INT | Surrogate key for an advertising platform |
| platform_name | VARCHAR(50) | Name of the Reddit ad delivery platform |
| platform_type | VARCHAR(30) | Platform classification |
| Column | Type | Description |
|---|---|---|
| user_idPK | INT | Reddit user identifier |
| user_name | VARCHAR(80) | Anonymized Reddit username |
| country_code | VARCHAR(2) | Two-letter user country code |
| Column | Type | Description |
|---|---|---|
| engagement_idPK | INT | Fact row identifier |
| user_id | INT | User associated with the daily engagement |
| platform_id | INT | Platform associated with the engagement |
| engagement_date | DATE | Date represented by the fact row |
| impressions | INT | Number of ad impressions |
| clicks | INT | Number of ad clicks |