What is the difference between a HAVING CLAUSE and a WHERE
CLAUSE?
Answer Posted / ravindran
1.WHERE clause can be used with SELECT,INSERT and UPADATE statements,where as HAVING clause can only be used with the SELECT statements.
2.WHERE filter after rows before aggregation(GROUPING),
where as,HAVING filters groups,after the aggregations are performed.
3.Aggregate functions cannot be used in the WHERE clause,unless it is in a sub query containing in a HAVING clause,where as,aggregate functions can be used in having clause.
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What is a mutating table error and how can you get around it?
What is co-related sub query?
What are approximate numeric data types in ms sql server?
How to set a database state to offline in ms sql server?
Do you know what is recursion? Is it possible for a stored procedure to call itself or recursive stored procedure? How many levels of sp nesting is possible?
How to locate and take substrings with charindex() and substring() functions?
what are the types of indexes? : Sql server database administration
Can we shrink data file in sql server?
What are system databases into sql server (2005/2008)?
how would you write a sql query to compute a frequency table of a certain attribute involving two joins? What changes would you need to make if you want to order by or group by some attribute? What would you do to account for nulls?
How to apply filtering criteria at group level with the having clause in ms sql server?
How to connect a database with sql express.?
We need to perform what steps in the following order to work with a cursor?
Comment,Datatypes are unlimited
Benefits of Stored Procedures?