QuestionQ245

VerifiedReporting Aggregated Data Using the Group Functions

Refer to the exhibit and examine the structure of the PROMOTIONS table. Evaluate the following SQL statement:

Question Image

The query above produces an error when it is executed. Which clause in the SQL statement causes the error?

Question Image

Explanation

In Oracle SQL, a select-list alias such as AVG_COST may be used in the ORDER BY clause, but not in other clauses of the same query, including GROUP BY. In addition, grouping for this result must use the nonaggregated selected column, PROMO_CATEGORY, rather than the aggregate alias.

Learn more

Community Discussion

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