HAVING in SQL queries explained
July 12, 08 by the programmerWhat is the “HAVING” keyword and what it is used for.
Because the WHERE keyword could not be used against aggregate functions (like SUM, COUNT…), HAVING was added to SQL so the results can be filtered by using aggregate functions as filter criteria
HAVING is always used with GROUP BY
Example:
SELECT product_name,SUM(product_quantity)
FROM products
GROUP BY product_name
HAVING SUM(product_quantity)>10000
