| |
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. |
| May 05, 2009 05:57:01 |
#6 |
| dbashashi |
Member Since: July 2006 Total Comments: 7 |
RE: HAVING vs WHERE Clause |
Hi there,
The WHERE clause restricts which rows are returned,while the HAVING clause operates on groups of rows.
HAVING is always used with GROUP BY and it must have a function in it and it restricts The rule says:- If a condition refers to an aggregate function, put that condition in the HAVING clause. Otherwise, use the WHERE clause. Another rule says:- You can't use HAVING unless you also use GROUP BY. |
| |
Back To Question | |