Review the following ER diagram:
Which of the following SQL statements will return all rows for a given CUST_ID and PROD_ID
where sales of specific products on a given day are greater than 10?
Additionally the list should be ordered by CUST_LAST_NAME, CUST_FIRST_NAME and
PROD_NAME.
A.
SELECT a.cust_last_name, a.cust_first_name, b.prod_name, c.time_id
FROM customers a, products b, times c, sales e
WHERE a.cust_id=e.cust_id
AND b.prod_id=e.prod_id
AND c.time_id=e.time_id
B.
GROUP BY a.cust_last_name, a.cust_first_name, b.prod_name, c.time_id
HAVING COUNT(*) > 10
ORDER BY a.cust_last_name, a.cust_first_name, b.prod_name, c.time_id;
C.
SELECT a.cust_last_name, a.cust_first_name, b.prod_name, c.time_id, COUNT(*)
FROM customers a, products b, times c, sales e
WHERE a.cust_id=e.cust_id
AND b.prod_id=e.prod_id
AND c.time_id=e.time_id
GROUP BY a.cust_last_name, a.cust_first_name, b.prod_name, c.time_id
HAVING COUNT(*) > 10;
D.
SELECT a.cust_last_name, a.cust_first_name, b.prod_name, c.time_id, COUNT(*)
FROM customers a, products b, times c, sales e
WHERE a.cust_id=e.cust_id
AND b.prod_id=e.prod_id
AND c.time_id=e.time_id
GROUP BY a.cust_last_name, a.cust_first_name, b.prod_name, c.time_id
HAVING COUNT(*) > 10
ORDER BY a.cust_last_name, a.cust_first_name, b.prod_name, c.time_id;
E.
SELECT a.cust_last_name, a.cust_first_name, b.prod_name, c.time_id, COUNT(*) TOTAL
FROM customers a, products b, times c, sales e
WHERE a.cust_id=e.cust_id
AND b.prod_id=e.prod_id
AND c.time_id=e.time_id
GROUP BY a.cust_last_name, a.cust_first_name, b.prod_name, c.time_id
ORDER BY a.cust_last_name, a.cust_first_name, b.prod_name, c.time_id;
F.
SELECT a.cust_last_name, a.cust_first_name, b.prod_name, c.time_id,
COUNT(*) TOTAL
FROM customers a, products b, times c, sales e
WHERE a.cust_id=e.cust_id
AND b.prod_id=e.prod_id
AND c.time_id=e.time_id
AND total > 10
GROUP BY a.cust_last_name, a.cust_first_name, b.prod_name, c.time_id
ORDER BY a.cust_last_name, a.cust_first_name, b.prod_name, c.time_id;