Nutrition Co., a health snack company, would like to know the total impressions that have been delivered per campaign, per supply_source, per device_type. Which of the following represents how to write this query?
- SELECT campaign, supply_source, SUM(impressions) AS impressions FROM device_type GROUP BY 1,2
- SELECT campaign, supply_source, device_type, SUM(impressions) AS impressions FROM dsp_impressions GROUP BY 1,2,3
- SELECT total_impressions SUM(impressions) AS device_type FROM campaign, supply_source GROUP BY 1,2,3
Explanation:
The correct answer is **SELECT campaign, supply_source, device_type, SUM(impressions) AS impressions FROM dsp_impressions GROUP BY 1,2,3** because this query correctly aggregates the total impressions by campaign, supply source, and device type using the **dsp_impressions** table. The **dsp_impressions** table tracks impressions delivered through Amazon DSP, and the query groups the data by the relevant dimensions (campaign, supply source, and device type) while calculating the sum of impressions for each combination. This approach ensures that you can track how impressions are distributed across different campaigns, supply sources, and devices. The other options do not correctly group the data or reference the appropriate tables, making them incorrect for this analysis.