Difference between WHERE and HAVING Clause
WHERE and HAVING are SQL clauses used for searching purposes. Both are almost same, but have some difference that may arise confusion. This article describes what is the difference between the WHERE and HAVING clause?
WHERE Vs HAVING
Both WHERE & HAVING specifies a search condition used in SELECT statement. WHERE clause applies to individual rows.
Both WHERE & HAVING specifies a search condition used in SELECT statement. WHERE clause applies to individual rows.
HAVING clause applies only to groups as a whole.
A query can contain both a WHERE clause and a HAVING clause. The WHERE clause is applied first to the individual rows in the tables. The HAVING clause is then applied and make group with the rows that meet the conditions in the WHERE clause. Only the groups that meet the HAVING conditions appear in the query output.
HAVING clause is used for a group or an aggregate function used in SELECT statement.
That’s all about where and having.
No comments