Vishal Dusane
What is the difference between where clause and having Clause?
By Vishal Dusane in Databases & DBA on Sep 10 2016
  • Vishal Dusane
    Sep, 2016 10

    Where Clause: 1.Where Clause can be used other than Select statement also 2.Where applies to each and single row 3.In where clause the data that fetched from memory according to condition 4.Where is used before GROUP BY clause Ex:Using Condition for the data in the memory.Having Clause: 1.Having is used only with the SELECT statement. 2.Having applies to summarized rows (summarized with GROUP BY) 3.In having the completed data firstly fetched and then separated according to condition. 4.HAVING clause is used to impose condition on GROUP Function and is used after GROUP BY clause in the query Ex: when using the avg function and then filter the data like ava(Sales)>0

    • 3
  • Kashi Kalburgi
    Jan, 2018 3

    Where clause filter data before grouping where as Having clause filter after grouping.We can't use aggregate functions with where clause but we can use it with having clause.

    • 1
  • Mukesh Sagar
    Nov, 2017 17

    Where clause is used in simple select statement to filter data; whereas having clause is used to filter data obtained from grouping function output.

    • 1
  • Guest User
    Sep, 2017 14

    The HAVING clause was added to SQL because the WHERE keyword could not be used with aggregate functions. The difference between the two is in the relationship to the GROUP BY clause: WHERE comes before GROUP BY; SQL evaluates the WHERE clause before it groups records

    • 1
  • Mukesh Kumar
    Aug, 2017 29

    Where executes before query & having executes after query execution

    • 1
  • Awadhesh Jha
    Aug, 2017 8

    Having Keyword is used in GROUP BY clause only while Where keyword can be used according our necessary but in Group By Condition where clause can used before GROUP BY Clause for ex. select name,sum(marks) from student_details where marks>=50 group by name having marks 60 Here student_details is table which contains student's marks with name.

    • 1
  • Rehman Shahid
    May, 2017 14

    WHERE clause filters rows from the final result and HAVING clause is used with GROUP BY clause and filters groups from the final result

    • 1
  • Shalu Shalini
    Apr, 2017 1

    having clause is used with group by function whereas where may or may not use with group by clause

    • 1
  • Sreekanth Reddy
    Oct, 2018 23

    Where clause -- Filters each record of the Specified table. Having Clause -- Filters records after Grouping the specified table.

    • 0

Most Popular Job Functions