Hey so I’m looking into SQL and I’m having a hard time understanding HAVING. What is it’s function because all I’m understanding from it is that it just feels like a more complex version of LIMIT.
What are the differences and how can I use HAVING correctly?
HAVING clause filters groups (
WHERE filters rows).
LIMIT does just that, limits the number of items returned from your query.
SELECT employee, dept, SUM(salary) AS salary
GROUP BY dept
HAVING SUM(salary) >= 70000
Order of operations: