SQL - GROUP BY and HAVINGWhat does the HAVING clause do in an SQL query?AFilters groups after aggregationBFilters rows before aggregationCSorts the result setDJoins two tablesCheck Answer
Step-by-Step SolutionSolution:Step 1: Understand the role of HAVINGThe HAVING clause is used to filter groups created by GROUP BY after aggregation functions are applied.Step 2: Differentiate HAVING from WHEREWHERE filters rows before grouping, HAVING filters groups after aggregation.Final Answer:Filters groups after aggregation -> Option AQuick Check:HAVING filters groups = D [OK]Quick Trick: HAVING filters groups, WHERE filters rows before grouping [OK]Common Mistakes:MISTAKESConfusing HAVING with WHERE clauseThinking HAVING filters rows before aggregation
Master "GROUP BY and HAVING" in SQL9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More SQL Quizzes Advanced Joins - Join order and performance impact - Quiz 7medium Advanced Joins - Join order and performance impact - Quiz 5medium Aggregate Functions - COUNT function behavior - Quiz 10hard INNER JOIN - INNER JOIN with table aliases - Quiz 13medium Set Operations - INTERSECT for common rows - Quiz 2easy Table Constraints - UNIQUE constraint - Quiz 5medium Table Constraints - Composite primary keys - Quiz 9hard Table Relationships - Many-to-many with junction tables - Quiz 2easy Table Relationships - Referential integrity enforcement - Quiz 13medium Views - Dropping and altering views - Quiz 3easy