SQL HAVING Clause
SQL HAVING Clause
The HAVING clause was added to SQL because the WHERE keyword could not be used with aggregate functions.
SQL HAVING Syntax
SQL HAVING Example
We have the following "Orders" table:
Now we want to find if any of the customers have a total order of less than 2000. We use the following SQL statement:
Now we want to find if the customers "Kumari" or "Jensen" have a total order of more than 1500. We add an ordinary WHERE clause to the SQL statement:
The result-set will look like this:
Comments
Post a Comment