Now SQL Tutorial will guide us that people may want to do is to limit the output
based on the corresponding sum (or any other aggregate functions).
e.g. we might want to see only the employees who have salary more then
1000$.
Instead of using the WHERE clause in the SQL statement, though, we need to
use the SQL HAVING clause, which is reserved for aggregate functions. The SQL HAVING
clause is typically placed near the end of the SQL statement, and a SQL statement
with the HAVING clause may or may not include the GROUP BY clause. The syntax for HAVING is,
Note: the GROUP BY clause is optional.
In our example, table Employees_Salary.
Table
Employees_Salary
| FirstName |
Month |
Salary |
| Austin |
January |
1000$ |
| Creston |
January |
1000$ |
| Kate |
January |
1000$ |
| Angela |
January |
1900$ |
| Bobbi |
January |
1000$ |
| Cute |
January |
1000$ |
| Austin |
February |
1100$ |
| Creston |
February |
1100$ |
| Kate |
February |
1100$ |
| Angela |
February |
1000$ |
| Bobbi |
February |
1200$ |
| Cute |
February |
1300$ |