What is the difference between having and where clause?

Answers were Sorted based on User's Feedback



What is the difference between having and where clause?..

Answer / thirumal reddy

where clause used to impose conditions in any dml operation
ex:
selct * from emp where empid=10
having clause used to impose conditions on group data
ex:

select sum(sal),avg(sal),count(*) from emp
having avg(sal)>2000

Is This Answer Correct ?    9 Yes 0 No

What is the difference between having and where clause?..

Answer / sd

Where clause operates on the selection before the rows are
actually grouped.

Hence , Try to add as many condition as possible in where
clause instead of having to boost the SQL query performance.

Is This Answer Correct ?    8 Yes 2 No

What is the difference between having and where clause?..

Answer / vinay singh

We can't use Where clause with aggregate function and Having
clause always use with aggregate function.

**Vinay Singh

Is This Answer Correct ?    6 Yes 2 No

What is the difference between having and where clause?..

Answer / kundan ravi

having clause alwaye use with aggregate functions and where
clause use for conditions but not with aggregate functions.

Is This Answer Correct ?    2 Yes 3 No

Post New Answer

More SQL Server Interview Questions

What is the recovery model?

0 Answers  


What is the difference between osql and query analyzer?

0 Answers  


Write an SQL query to obtain the 2nd highest salary.

0 Answers   Akamai Technologies,


Define master database?

0 Answers  


Why should we go for stored procedures? Why not direct queries?

0 Answers  






Hi..here i would like to know the Backup and Restore models?

2 Answers   HCL,


What is the language structure to add a record to a table?

0 Answers  


What is a trace frag?

0 Answers  


What is inner join? Explain with an example?

0 Answers  


What is the use of commit?

0 Answers  


What are actions, how many types of actions are there, explain with example? : sql server analysis services, ssas

0 Answers  


Explain what is the purpose of sql profiler in sql server?

0 Answers  


Categories