What is the difference between whereclause and having clause

Showing Answers 1 - 4 of 4 Answers

Renuka Rajput

  • Aug 1st, 2006
 

The difference between 'where' clause and 'having' clause is

1.U can use group function/aggregate functions in having clause but

  u cannot use group function/aggregate functions in where clause.

  Was this answer useful?  Yes

Anurag Puranik

  • Aug 1st, 2006
 

WHERE clause is used to only for those columns which are not in group while

HAVING clause is used to resticted the group functions.

  Was this answer useful?  Yes

Anurag Puranik

  • Aug 1st, 2006
 

The WHERE clause is used to restricted only those columns which are not in group while HAVING clause is use to restricted the group functions.

  Was this answer useful?  Yes

Kiran Bondre

  • Aug 1st, 2006
 

The fundamental difference between "WHERE" and "HAVING" is this:

 "WHERE" selects input rows before groups and aggregates are computed (thus, it controls which rows go into the aggregate computation),

whereas "HAVING" selects group rows after groups and aggregates are computed. Thus, the "WHERE" clause must not contain aggregate functions; it makes no sense to try to use an aggregate to determine which rows will be inputs to the aggregates.

On the other hand, the "HAVING" clause always contains aggregate functions. (Strictly speaking, you are allowed to write a "HAVING" clause that doesn't use aggregates, but it's seldom useful. The same condition could be used more efficiently at the "WHERE" stage.)

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions