SQLQuokka
Start practicing
QuestionsLearnSandboxFeaturesRoadmapFAQ

Google Ads: Top 2 Performing Ads per Category

Unsolved

Google Ads Optimization engines surface highest performing creative copies within each industry segment. Write a SQL query using the `DENSE_RANK()` window function to determine the top 2 ranked advertisements by click-through rate (`clicks / impressions`) within each `category_name`. If ads within the same category share identical click-through rates, they must receive the same rank. Return `ad_id`, `category_name`, `headline`, `ctr_pct` (rounded to 2 decimal places), and `rank_in_category`. Sort the results by `category_name` ascending, then `rank_in_category` ascending, and finally `ad_id` ascending. Note: Window function support requires DuckDB / full SQL engine capabilities. This question is staged for the upcoming DuckDB browser engine.

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 category_ads
Full source dataset
8 rows total
Ready. Type a query to see live execution.
Clause: Auto-Sync · AlaSQL Engine