Sapna Malik
What is the difference between a “where” clause and a “having” clause?
By Sapna Malik in Databases & DBA on Mar 25 2011
  • Rafnas T P
    Jan, 2016 27

    1. The Where can be used without the GROUP BY clause. The HAVING clause cannot be used without the GROUP BY clause. 2. The WHERE clause selects rows before grouping. The HAVING clause selects rows after grouping. 3. The WHERE clause cannot contain aggregate functions. The HAVING clause can contain aggregate functions. 4. The Having can used only with the select statement

    • 0
  • Deepak Verma
    Mar, 2011 29

    Both WHERE and HAVING clauses are used to filter the data. But WHERE Clause can't be used with Aggregate Functions, so HAVING Clause is introduced. The HAVING Clause is used to filter data (returned by GROUP BY Statement) after GROUP BY Statement and The WHERE Clause is used to filter data (returned by SELECT Statement) before GROUP BY Statement.

    * The use of WHERE Clause after GROUP BY Statement is restricted.
    * The use of HAVING Clause before GROUP BY Statement is restricted.

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS