A database table is defined as orders(customer_id, amount), where one customer can have many order rows. Which of the following SQL queries correctly returns the customer_id of every customer whose TOTAL order amount across all their orders exceeds 10000?
SELECT customer_id FROM orders GROUP BY customer_id HAVING SUM(amount) > 10000;
SELECT customer_id FROM orders WHERE SUM(amount) > 10000 GROUP BY customer_id;
SELECT customer_id FROM orders WHERE amount > 10000;
SELECT customer_id FROM orders GROUP BY customer_id WHERE SUM(amount) > 10000;
The verified answer and full solution are one login away
Every answer here is machine verified, with a step-by-step solution that teaches the method. Your login also unlocks a 7-question mock preview in the real exam interface.
Log in to see the answerMore sql questions