SQL - GROUP BY and HAVING
Given the table orders with columns customer_id and total, what will this query return?
SELECT customer_id, SUM(total) AS total_spent FROM orders GROUP BY customer_id HAVING SUM(total) > 1000;
Given the table orders with columns customer_id and total, what will this query return?
SELECT customer_id, SUM(total) AS total_spent FROM orders GROUP BY customer_id HAVING SUM(total) > 1000;
15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions