| |
GeekInterview.com > Interview Questions > Oracle > SQL
| Print | |
Question: HAVING vs WHERE Clause
Answer: Where clause restricts rows, what does having clause restricts ? 1. only group results. 2. rows results. 3. both rows and groups result. |
| October 10, 2009 08:42:22 |
#9 |
| muniyuga |
Member Since: October 2009 Total Comments: 2 |
RE: HAVING vs WHERE Clause |
Having Clause: Restricts Aggregate or Group function result set. can be used with Group By Caluse Where Clause: Restricts the Rows returned.
Explaining Operation in SQL query:WHERE and GROUP BY ( HAVING) clause used
In this SQL query First Where clause returns/restricts the rows based on conditions Now the group by(Having) function acts(filters) on the result set returned by the Where clause.
NOTE: 1.Having expression should be "Group By expression" 2.Non Group By Column is not allowed in Select list of a query which is having Group By expression
Yugundhar K |
| |
Back To Question | |