Which of these queries will only include purchase records from the underlying table?
Choose an answer
Tap an option to check your answer.
Correct answer: SELECT campaign, COUNT(DISTINCT user_id) AS purchasers, SUM(purchases) AS purchases FROM.
Why this is the answer
The correct query, SELECT campaign, COUNT(DISTINCT userid) AS purchasers, SUM(purchases) AS purchases FROM conversions WHERE purchases 0 GROUP BY campaign, correctly filters the conversions table to include only records where purchases is greater than 0. This ensures that only actual purchase events are counted and summed. The GROUP BY campaign clause then aggregates these purchase records by campaign, allowing for analysis of purchasers and total purchases per campaign. The incorrect option lacks the WHERE purchases 0 clause, meaning it would include all conversion records, regardless of whether a purchase occurred, leading to an inaccurate count of purchasers and total purchases.
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