Explain Having clause and Where clause?
Submitted by: AdministratorHaving Clause: This clause is used for specifying a search condition for a group or an aggregate. It can only be used with a SELECT statement. It's often used with GROUP BY clause without which its synonymous to a WHERE clause.
E.g.: SELECT Id, Name, Age FROM Customers
GROUP BY Age
HAVING Age>10
ORDER BYAge;
Where Clause: This clause is used to narrow down the dataset being dealt with following a condition.
SELECT Id, Name, Age FROM Customers
WHERE Age>10
It is strongly recommended to use a Where clause with every Select Statement to avoid a table scan and reduce the number of rows to be returned. It can be used with Select, Update, Delete etc statements.
Submitted by: Administrator
E.g.: SELECT Id, Name, Age FROM Customers
GROUP BY Age
HAVING Age>10
ORDER BYAge;
Where Clause: This clause is used to narrow down the dataset being dealt with following a condition.
SELECT Id, Name, Age FROM Customers
WHERE Age>10
It is strongly recommended to use a Where clause with every Select Statement to avoid a table scan and reduce the number of rows to be returned. It can be used with Select, Update, Delete etc statements.
Submitted by: Administrator
Read Online MS SQL Server Indexes Job Interview Questions And Answers
Top MS SQL Server Indexes Questions
☺ | Explain the types of indexes? |
☺ | Explain the purpose of indexes? |
☺ | Can you explain important index characteristics? |
☺ | Write down the syntax and an example for create, rename and delete index? |
☺ | Explain Having clause and Where clause? |
Top New MS SQL Server Categories
☺ | SQL Server Database Administrator Interview Questions. |
☺ | SQL Server Service Broker Interview Questions. |
☺ | SQL Server Locks Interview Questions. |
☺ | SQL Server Constraints Interview Questions. |
☺ | MS SQL Data Mining Interview Questions. |