The SQL HAVING Clause helps you to specify conditions that filter which group results should appear in the final results.ell.

SYNTAX

NOTE: HAVING Clause should always be followed by a GROUP BY Clause in a Query.

EXAMPLE

Following our approach with the PersonalInfo Table, let’s understand how HAVING CLAUSE is used. Below is the Demo Database

The query has grouped the Address, City and FirstName from PersonalInfo table to fetch count of PersonId>1

 

Figure 22.1. Select * from PersonalInfo;

 

Figure 22.2. HAVING CLAUSE ON PersonalInfo;

PRACTICE YOURSELF 

 

©2020 by Pavan Lalwani. 

  • Udemy
  • Facebook
  • Twitter
  • YouTube
  • Linkedin