Top keywords and advertisers


You're given the following table that shows spend by keyword, advertiser, and unique ad ID:

Table: keyword_summary

keyword ad_id advertiser_id total_spend
bicycle 1243213 1234 95
bike 1243213 1234 71
bike tires 1243213 1234 22
bike breaks 1243213 1234 95
bike accessories 1243213 1234 28
... ... ... ...

Using the table above, write a SQL query that returns each keyword along with the advertiser_id of the top spending advertiser, and total spend on the keyword (agnostic of advertiser). Sort the results in descending order by the total spend on the keyword.
You can view/query the data in an interactive SQL fiddle here.


Access restricted

Subscribe to premium account to see the solution.

Get premium now