What is the difference between having and where clause?
Answers were Sorted based on User's Feedback
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 |
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 |
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 |
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 |
What are the advantages of partitioning?
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
How to create a new login name in ms sql server?
What does normalization do to data?
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?
What is dirty page?
What is global temp table?
What is the purpose of the model database?
what is hash nonclustered index
Explain the commands in sql server?
What is sql server schema compare? How we can compare two database schemas?
What is an indexing strategy?