QuestionQ18

VerifiedAnalyzing Queries

A data analyst needs to identify product categories that satisfy two conditions:

  1. Each category has more than 10 products.
  2. The category’s average product price exceeds $50.

Which SQL statement uses aggregate functions to return only the categories that meet these conditions?

Explanation

HAVING filters grouped results using aggregate expressions. Grouping by category and applying COUNT(*) > 10 AND AVG(price) > 50 in the HAVING clause returns only categories satisfying both aggregate criteria.

Community Discussion

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