Having clause is used with group by clause. Group by generally used for aggregate function so having is used to filter the data based on aggregate functions. While where can used for any general filter condition in query. For example There is a productorder table now we want the orders in which 3 or more products are ordered. Select order, count(product) From Productorder Group by order Having count (product) > 3 It is not possible through where clause.