0 votes
in Sql by

What is the difference between the HAVING clause and WHERE clause?

2 Answers

0 votes
by

Both specify a search condition but Having clause is used only with the SELECT statement and typically used with GROUP BY clause.

If GROUP BY clause is not used then Having behaved like WHERE clause only.

0 votes
by
You can use Having Clause with the GROUP BY function in a query and WHERE Clause is applied to each row before, they are part of the GROUP BY function in a query.

Related questions

0 votes
0 votes
asked Sep 9, 2019 in Spark Sql by ivor2019
0 votes
asked Dec 24, 2023 in Sql by john ganales
...