SQL HAVING CLAUSE
HAVING clause is used with aggregate functions.WHERE cannot be used with aggregate functions.
The aggregate functions are the one that generate a single value from values in a column.
Example:
AVG(),COUNT(), FIRST(), LAST(), MAX(),MIN() amd SUM()..SYNTAX :
SELECT column_name, aggregate_function(column_name) FROM table_name WHERE column_name operator value HAVING aggregate_function(column_name) operator value
id | name | age | city | bill |
1 | Tom | 34 | Paris | 5300 |
2 | Jhony | 51 | London | 400 |
3 | Ram | 64 | Delhi | 20000.7 |
4 | Simon | 23 | Portland | 32.65 |