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
What are the acid properties?
New concepts of sql server 2005 use in your project.
Tell me something about security and sql azure?
What is attribute relationships, why we need it? : sql server analysis services, ssas
What is Service Broker in sql server 2012?
How to create a scrollable cursor with the scroll option?
How to create function without parameter in sql server?
What is meant by referential integrity?
What is xdr?
How to insert and update data into a table with "insert" and "update" statements?
What is star, snowflake and star flake schema? : sql server analysis services, ssas
What is a natural primary key?
Indexes are updated automatically is the full-text index also updated automatically?
Would you store your query in a ssrs report or a database server? State the reason why?
Can an automatic recovery be initiated by a user?