Having Clause
- Having Can be used with aggregate data.
- Having works on aggregate data.
- Along with having clause we can use aggregate functions(SUM,AVG,COUNT,etc..).
Syntax
SELECT column_name(s)
FROM table_nameWHERE condition
GROUP BY column_name(s)HAVING conditionORDER BY column_name(s);
Where Clause
- Where cannot be used with aggregate data.
- Where works on row's data
Syntax
SELECT column_name(s)
FROM table_name
WHERE condition
ORDER BY column_name(s);
If Having and where clause applies together in a single query first where clause will work and filter data.and then having clause will work
Comments
Post a Comment