Hello everybody!
I have a question concerning Exercise 3.

Here's the provided answer to it:

SELECT customerid, count(customerid), sum(price)
FROM items_ordered
GROUP BY customerid
HAVING count(customerid) > 1;


I achieved the same result by using different columns:

SELECT customerid, count(order_date) AS #orders, SUM(price)
FROM items_ordered
GROUP BY customerid
HAVING count(order_date) > 1;


But that's not the point. Although, if there's something that makes the former code superior, please let me know.

My question concerns the wording of the exercise. We are to find customers, number of orders and the sum of their orders if they purchased more than 1 ITEM. Thing is, either of the above queries will display the required information, if those customers made more than one ORDER, while one order might contain multiple items.

So wouldn't it be more accurate to run something like this below?

SELECT customerid, count(order_date) AS #orders, SUM(price)
FROM items_ordered
GROUP BY customerid
HAVING count(order_date) > 1 OR count(quantity) > 1;


Thank you!