QuestionQ42

VerifiedReporting Aggregated Data Using the Group Functions

Refer to the exhibit and review the structure of the PROMOTIONS table.

Question Image

Review these two SQL statements:

Question Image

Which statement is true about these two SQL statements?

Explanation

WHERE filters individual rows before GROUP BY and SUM are applied. HAVING MIN(promo_end_date - promo_begin_date) > 30 filters whole PROMO_CATEGORY groups after grouping; because the minimum must exceed 30, every row in a retained category must have a date difference greater than 30. Both statements are valid but can return different results.

Learn more

Community Discussion

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