Skip to main content
This means that the WHERE clause places conditions on selected columns, whereas the HAVING clause places conditions on groups created by the GROUP BY clause. Here’s an example showing the position of the HAVING clause in a SELECT query:
Basic HAVING clause example:
This query results in a table with columns for department, job title, and average salary. Each row represents the average salary for a unique combination of department and job title, and only those groups with an average salary of at least $50,000 are returned.