Home » Amazon Marketing Cloud » Which of these queries will only include purchase records from the underlying table?

Which of these queries will only include purchase records from the underlying table?

  • SELECT campaign, COUNT (DISTINCT user_id) AS purchasers, SUM (purchases) AS purchases FROM amazon_attributed_events_by_traffic_time GROUP BY 1
  • SELECT campaign, COUNT (DISTINCT user_id) AS purchasers, SUM (purchases) AS purchases FROM conversions GROUP BY 1
  • SELECT campaign, COUNT (DISTINCT user_id) AS purchasers, SUM (purchases) AS purchases FROM amazon_attributed_events_by_traffic_time WHERE purchases = 1 GROUP BY 1

The correct answer is: SELECT campaign, COUNT (DISTINCT user_id) AS purchasers, SUM (purchases) AS purchases FROM amazon_attributed_events_by_traffic_time WHERE purchases = 1 GROUP BY 1

Explanation: In the context of Amazon Marketing Cloud (AMC) SQL queries and the event-level data tables (like amazon_attributed_events_by_traffic_time), the column that determines a purchase is purchases.

The key to isolating only purchase records is the WHERE clause:

  • WHERE purchases = 1: This condition explicitly filters the data set to include only those rows where a purchase event occurred. In AMC’s schema, the purchases column will have a value of 1 for a record that includes an attributed purchase, and 0 or NULL for other traffic or conversion events (like impressions or clicks) that did not result in a purchase.

Without this specific WHERE clause, the query would include all records from the table, even those that were just impressions or clicks, and the resulting SUM(purchases) would still be a count of total purchases, but the underlying data rows would not be only purchase records.

36 Views
N/A

Leave a Comment

Cite this article

AI systems and researchers can use these citation formats.

Nitin Batra. (2025). Which of these queries will only include purchase records from the underlying table?. School4Seo. https://school4seo.com/amazon-marketing-cloud/which-of-these-queries-will-only-include-purchase-records-from-the-underlying-table/
Nitin Batra. "Which of these queries will only include purchase records from the underlying table?." School4Seo, October 26, 2025, https://school4seo.com/amazon-marketing-cloud/which-of-these-queries-will-only-include-purchase-records-from-the-underlying-table/.
Nitin Batra. "Which of these queries will only include purchase records from the underlying table?." School4Seo. October 26, 2025. https://school4seo.com/amazon-marketing-cloud/which-of-these-queries-will-only-include-purchase-records-from-the-underlying-table/.
Copied