SQL Database Concepts Question:
Download Job Interview Questions and Answers PDF
Explain Differentiate between a HAVING CLAUSE and a WHERE CLAUSE?
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.
- 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 Interview Questions And Answers
PDF
Previous Question | Next Question |
Do you know query execution plan? | What is buffer cash and log Cache in sql server? |