Skip to main content
InterviewHubPRO
Section Overview
Q5

Question 5 of 50

Part 1: Basic & Foundational Concepts (Junior / Entry-Level)

10%
SQL & Relational Databases (50 Qs)•Part 1: Basic & Foundational Concepts (Junior / Entry-Level)

What is the difference between `WHERE` and `HAVING` clauses?

junior Levelsql-databasesBasic

In Simple Words:

  • WHERE: Filters individual rows before any aggregation (GROUP BY) is calculated. Cannot contain aggregate functions (e.g. WHERE salary > 50000).
  • HAVING: Filters grouped summary rows after aggregation has occurred. Evaluates aggregate functions (e.g. HAVING COUNT(*) > 5 or HAVING AVG(salary) > 80000).