SQL Database Concepts Question:

Explain Differentiate between a HAVING CLAUSE and a WHERE CLAUSE?

Tweet Share WhatsApp

Answers:

Answer #1HAVING CLAUSE

- HAVING CLAUSE is used only with the SELECT statement.
- It is generally used in a GROUP BY clause in a query.
- If GROUP BY is not used, HAVING works like a WHERE clause.

WHERE Clause

- It is applied to each row before they become a part of the GROUP BY function in a query.

Answer #2The HAVING clause was added to SQL because the WHERE keyword could not be used with aggregate functions.

Download Basic SQL Server PDF Read All 113 Basic SQL Server Questions
Previous QuestionNext Question
Do you know query execution plan?What is buffer cash and log Cache in sql server?