How would you adapt this query to limit results to Sponsored Products keyword targeting only? SELECT ad_product_type, targeting, customer_search_term, match_type, SUM(spend)/100000000 AS total_cost_dollars,((SUM(spend)/100000000)/SUM(impressions))*1000 AS avg_cpm, SUM(impressions) AS impressions, SUM(clicks) AS clicks, (SUM(clicks)/SUM(impressions)) AS ctr FROM sponsored_ads_traffic WHERE match_type IN(‘PHRASE’, ‘BROAD’, ‘EXACT’) GROUP BY 1,2,3,4

  • Adjust FROM statement to: FROM sponsored_products
  • Adjust WHERE statement to: WHERE match_type IN(‘PHRASE’, ‘BROAD’, ‘EXACT’) AND ad_product_type = ‘sponsored_products’
  • Add LIMIT clause: LIMIT sponsored_products
  • Adjust SELECT statement to include the sponsored_products field

The correct answer is:

  • Adjust WHERE statement to: WHERE match_type IN(‘PHRASE’, ‘BROAD’, ‘EXACT’) AND ad_product_type = ‘sponsored_products’