SQLQuokka
Start practicing
QuestionsLearnSandboxFeaturesRoadmapFAQ

Ad Click-Through Rate (CTR)

Unsolved

An advertising analytics service measures ad performance using Click-Through Rate (CTR). CTR is defined as: `CTR = (Total Clicks / Total Impressions) * 100` Write a SQL query joining `campaign_ads` with `ad_events` to return each ad's `ad_id` and its calculated `ctr` percentage rounded to 2 decimal places. Sort the results by `ad_id` ascending. Edge cases tested: - If an ad received 0 impressions, return a CTR of 0.00 (division by zero must not throw an error). - An ad might have impressions but 0 clicks (CTR is 0.00). - Results must be rounded to exactly 2 decimal places.

SQL Query Editor (Ctrl+Enter to run)
0 characters · Valid
Canonical Solution Official

Official Solution is Hidden

Try solving the question with the schema explorer and hints first. When ready, reveal the verified canonical query and step-by-step logic breakdown.

Community Q&A & Discussion

Ask questions, share alternate queries, and explore solutions

0 comments
Asked By:
🏢 Google

Submission History

Your recent query executions and answer checks

Execution Pipeline:
FROM campaign_ads
Full source dataset
6 rows total
Ready. Type a query to see live execution.
Clause: Auto-Sync · AlaSQL Engine