What is SQL HAVING?
The SQL HAVING is a clause that enables conditions at the aggregate level. It is used instead of the WHERE clause when Aggregate Functions are used.
The SQL HAVING clause supports the same operators as the WHERE clause. Grouped results can be checked using this clause.
Why Use SQL HAVING?
The HAVING clause is used to SELECT information based aggregate information. For example, one may want to list sales representatives that have sales totaling over $10,000. This is very useful for analytical reporting.
How To Use SQL HAVING
SQL HAVING is used as follows.
SQL HAVING Syntax
SQL HAVING Example
The following example regions from the branch table that have total employee_count greater than 5.
Here are the contents of the table:
This SQL Statement with HAVING is executed:
Here is the result.
|HOME | SQL OVERVIEW | SQL BASICS | SQL ADMINISTRATION | SQL ADVANCED | SQL SYNTAX|
|Copyright© 1999-2014, First Place Software, Inc.|