Aryan, a database administrator, has grouped records of a table with the help of group by clause.

He needs to further filter groups of records generated through group by clause. 

Suggest suitable clause for it and properly explain its usage with the help of an example.


Share with your friends
Call

Having clause is used to further filter those groups of records which will be generated through group by clause. 

For example: 

Select max(marks) from student group by classes having classes in (10,12); 

Above given query will arrange records in groups according to the classes. Further filtering on these groups will happen through having clause, which will finally display the highest marks from classes 10 and 12.

Talk Doctor Online in Bissoy App