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.
Loading…
Try solving the question with the schema explorer and hints first. When ready, reveal the verified canonical query and step-by-step logic breakdown.
Ask questions, share alternate queries, and explore solutions
Your recent query executions and answer checks
This will insert the verified MySQL solution into your editor so you can study how each clause transforms the table.