What is the difference between HAVING clause and the WHERE
clause?
Answer Posted / mayursinh zala
'Where' clause applies to the individual rows whereas 'Having' clause is used to test some condition on the group(usually aggregate methods) rather than on individual rows.
Specifies a search condition for a group or an aggregate. HAVING can be used only with the SELECT statement. HAVING is typically used in a GROUP BY clause. When GROUP BY is not used, HAVING behaves like a WHERE clause.
So you can use having WITHOUT group by clause. This is a sample, although it might make no sense of business value:
select max(state) from States having count(State) > 60
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Difference between drill down and drill through report.
Can you leave a union at any time?
What is indexing explain it with an example?
What happens if null values are involved in boolean operations?
How network traffic be reduced by using the stored procedure?
How to add more data to the testing table in ms sql server?
What is recursion? Is it possible for a stored procedure to call itself or recursive stored procedure?
How you can change a cross join into an inner join?
Can multiple columns be used in sql group by clause in ms sql server?
what are defaults? : Sql server database administration
How to define and use table alias names in ms sql server?
How many databases instances are there in sql server 2000?
Can you force a query to use a specific index?
Why and when do stored procedure recompile?
Does server sql treat char as a variable-length or fixed-length column?