Which statement is true regarding the following SQL statements?

View the Exhibit and examine the description of the ORDER_ITEMS table. The following SQL statement was written to retrieve the rows for the PRODUCT_ID that has a UNIT_PRICE of more than 1,000 and has been ordered more than five times:
SELECT product_id, COUNT(order_id) total, unit_price FROM order_items
WHERE unit_price>1000 AND COUNT(order_id)>5
GROUP BY product_id, unit_price;
Which statement is true regarding this SQL statement?

View the Exhibit and examine the description of the ORDER_ITEMS table.

The following SQL statement was written to retrieve the rows for the PRODUCT_ID that has a UNIT_PRICE of more than 1,000 and has been ordered more than five times:

SELECT product_id, COUNT(order_id) total, unit_price FROM order_items
WHERE unit_price>1000 AND COUNT(order_id)>5
GROUP BY product_id, unit_price;

Which statement is true regarding this SQL statement?

A.
The statement would execute and give you the desired result.

B.
The statement would not execute because the aggregate function is used in the WHERE clause.

C.
The statement would not execute because the WHERE clause should have the OR logical operator instead of AND.

D.
The statement would not execute because in the SELECT clause, the UNIT_PRICE column is placed after the column having the aggregate function.



Leave a Reply 1

Your email address will not be published. Required fields are marked *