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 are the advantages of partitioning?

0 Answers  


i have table students with fields classname,studname select * from students classname studname 1 xxxxx 1 yyyy 1 zzzz 2 qqqq 2 tttt 3 dsds 3 www i want the output should be No of students in class 1 : 3 No of students in class 2 : 2 No of students in class 3 : 2

5 Answers   HCL, ZX,


How to create a new login name in ms sql server?

0 Answers  


What does normalization do to data?

0 Answers  


If you are given access to a SQL Server, how do you find if the SQL Instance is a named instance or a default instance?

0 Answers  






What is dirty page?

0 Answers  


What is global temp table?

0 Answers  


What is the purpose of the model database?

0 Answers  


what is hash nonclustered index

0 Answers  


Explain the commands in sql server?

0 Answers  


What is sql server schema compare? How we can compare two database schemas?

0 Answers  


What is an indexing strategy?

0 Answers  


Categories