Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: HAVING and WHERE clause
Hi Thomas:
Thank you for your detail explanation. It is very interesting to know that the BEFORE and AFTER aggregrate.
One more question, I read from somewhere, it said that SELECT COUNT(*) is less efficient than SELECT COUNT(1) or SELECT COUNT(ROWID). The reason is that Oracle will process more steps for * and less steps for ROWID or 1. Is it true?
Once again, thanks a lot for your guidance.
Thomas Kyte (tkyte_at_us.oracle.com) wrote:
: where will remove a row from a group calculation (where is processed BEFORE
: aggregates). You would use the where clause to exclude a row from being part of
: a group calculation.
: having will remove an already grouped result row (having is processed AFTER the
: aggregate).
: Its a misleading question -- a trick question if you will. HAVING is for
: processing the results of group calculations, eg: "select dept, count(*) from
: emp group by dept having count(*) > 3" to find all depts with more then 3 emps.
: Your eye is drawn toward the "exclude .. group calculation" and that leads you
: to the HAVING clause...
Received on Tue Jan 05 1999 - 23:08:15 CST
![]() |
![]() |