A Capital One analyst is querying a transactions table. Which SQL query correctly returns the top 3 customers by total spend in the last 30 days?
-
A
SELECT customer_id, SUM(amount) AS total FROM transactions WHERE date >= CURRENT_DATE - 30 GROUP BY customer_id ORDER BY total DESC LIMIT 3
-
B
SELECT customer_id, COUNT(amount) AS total FROM transactions WHERE date >= CURRENT_DATE - 30 GROUP BY customer_id ORDER BY total LIMIT 3
-
C
SELECT customer_id, SUM(amount) AS total FROM transactions GROUP BY customer_id ORDER BY total DESC LIMIT 3
-
D
SELECT customer_id, SUM(amount) AS total FROM transactions WHERE date <= CURRENT_DATE - 30 GROUP BY customer_id ORDER BY total DESC LIMIT 3