SQL HAVING – SQL Tutorial | Software Testing Material

SQL Having:

While using aggregate functions, we couldn’t use WHERE clause. We need to use SQL HAVING clause while using aggregate functions. The HAVING Clause places conditions on Groups created by the GROUP BY clause where as the WHERE Clause places conditions on the selected columns.


The HAVING clause must follow the GROUP BY clause in a query. If we use ORDER BY clause in a query then the HAVING clause must precede the ORDER BY clause.

To list out the number of customers in each country and that too the countries with more than 2 customers.

SQL Having

In the next tutorial, we will see How To Use LIKE OPERATOR in SQL

Check out the complete SQL Tutorial by clicking on below link:

SQL Tutorial – Complete

SQL Having

Rajkumar SM is a founder of SoftwareTestingMaterial. He is a certified Software Test Engineer by profession and blogger & youtuber by choice. He has an extensive experience in the field of Software Testing. He writes here about Software Testing which includes both Manual and Automation Testing. He loves to be with his wife and cute little kid 'Freedom'.

Leave a Comment

Share via
Copy link
Powered by Social Snap