SQL Database Concepts Question:

Download Job Interview Questions and Answers PDF

Explain Differentiate between a HAVING CLAUSE and a WHERE CLAUSE?

Basic SQL Server Interview Question
Basic SQL Server Interview Question

Answers:

Answer #1
HAVING 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 #2
The HAVING clause was added to SQL because the WHERE keyword could not be used with aggregate functions.

Download Basic SQL Server Interview Questions And Answers PDF

Previous QuestionNext Question
Do you know query execution plan?What is buffer cash and log Cache in sql server?