SQL is the standard language for Database Management System. It is used for storage, manipulation and retrieval of data in databases. There are so many features in MySQL that make our task so easy. So, In this tutorial we will be discussing one such concept called Group By and Having Clause in MySQL.
The GROUP BY statement as its name suggests, it groups the rows having the same values as summary rows. For instance, finding the number of classrooms in a particular school. It is used to group the result. The GROUP BY statement is most commonly used with aggregate functions such as COUNT, MAX, MIN, SUM, AVG etc. HAVING clause acts as a replacement for WHERE keyword because it can’t be used with the Aggregate functions.
HAVING clause is used for placing conditions on the groups created by GROUP BY statements. HAVING clause mainly helps us to identify the conditions that need to be fulfilled for having a particular group in the result. To know more about this amazing concept which makes our work so easy and interesting, Watch the complete tutorial.