QuestionQ99

VerifiedReporting Aggregated Data Using the Group Functions

View the Exhibit and examine the structure of the SALES table.

Question Image

The following query is intended to retrieve all product IDs from the SALES table for which more than 55000 have been sold and that have been ordered more than 10 times.

Question Image

Which statement is true about this SQL statement?

Explanation

COUNT(*) is an aggregate function and cannot be used in a WHERE condition, which filters rows before GROUP BY forms product groups. A condition on the count of rows in each product group must be placed in the HAVING clause. COUNT(*) correctly counts all rows and does not need to appear in the select list.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!