With SQL (Structured Query Language), a Having clause is like a Where clause for rows of data that have been aggregated into a single row of output. The system evaluates Where clauses by looking at the individual table rows before they are grouped by the aggregate function, and then it evaluates Having clauses after applying the function. So, if you want to check the value returned by the function, you must define Having criteria.
For example, suppose you need a list of the departments in which the minimum salary is greater than $100,000. In this case, you first use the aggregate function to group the departments based on the salary. Then, you use the Having clause to obtain the list of the departments in which the minimum salary is greater than $100,000.
In this topic, your manager has asked you to selectively define the query results of employees taking vacation time. She would like the query results to include the employees who are taking more than three days off. To accomplish this task, you will apply Having criteria.
Table of Contents