SQL HAVING - Introduction and syntax
SQL - Dec 03, 2008 at 18:00 PM by Rajmeet Ghai
Explain the SQL HAVING statement. Write SQL syntax for the SQL HAVING statement
along with an example.
HAVING clause is used to specify some condition along with
aggregate functions.
Syntax:
SELECT column_name, aggregate_function(column_name)
FROM table_name
WHERE column_name operator value
GROUP BY column_name
HAVING aggregate_function(column_name) operator value
Example:
SELECT emp_id,SUM(salary) FROM employee
WHERE employee_name='tom’
GROUP BY emp_id
HAVING SUM(salary)>1500
|