WHERE clause vs HAVING clause.
WHERE clause is used to filter records and HAVING is used for aggregate functions.
Example for HAVING:
SELECT employee_name,SUM(salary) FROM employee
GROUP BY employee
HAVING SUM(salary) < 2000
Example for WHERE:
Select * from employee
Where employee_id=100;
WHERE clause vs HAVING clause.
HAVING clause is used with group function and it is written after GROUP BY clause. The WHERE clause is used when you want to specify a condition for columns. If WHERE clause is used with GROUP BY, it is used before GROUP BY clause.