You are writing a query and would like to know the total impressions that have been delivered per campaign, per supply_source, and per device_type. Which of the following represents how you should write the query?
Choose an answer
Tap an option to check your answer.
Correct answer: SELECT campaign, supply_source, device_type, SUM(impressions) AS impressions FROM dsp_impressions GROUP BY 1,2,3.
Why this is the answer
The correct query accurately aggregates impressions by campaign, supply source, and device type. SELECT campaign, supplysource, devicetype, SUM(impressions) AS impressions specifies the dimensions for grouping and calculates the sum of impressions. FROM dspimpressions correctly identifies the table containing the impression data. GROUP BY 1,2,3 groups the results by the first three selected columns (campaign, supplysource, devicetype), which is essential for getting the total impressions for each unique combination of these attributes. The first incorrect option, SELECT totalimpressions SUM(impressions) AS devicetype FROM campaign, supplysource GROUP BY 1,2,3, has incorrect syntax (totalimpressions SUM(impressions)) and an incorrect FROM clause, as it doesn't specify the table containing impression data. The third incorrect option, SELECT campaign, supplysource, SUM(impressions) AS impressions FROM devicetype GROUP BY 1,2, omits devicetype from the SELECT clause and GROUP BY clause, and incorrectly specifies devicetype as the FROM table.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed