Home » SQL & PL/SQL » SQL & PL/SQL » "Having clause" restrict row & groups or groups only ?
icon5.gif  "Having clause" restrict row & groups or groups only ? [message #254933] Mon, 30 July 2007 01:52 Go to next message
mbapoonam
Messages: 5
Registered: May 2006
Location: India
Junior Member
"Having clause" restrict row & groups or groups only ?

[Updated on: Mon, 30 July 2007 04:00]

Report message to a moderator

Re: "Having clause" restrict row & groups or groups only ? [message #254936 is a reply to message #254933] Mon, 30 July 2007 01:58 Go to previous messageGo to next message
scottwmackey
Messages: 505
Registered: March 2005
Senior Member
You might want to be a bit more verbose with your question.
Re: "Having clause" restrict row & groups or groups only ? [message #254939 is a reply to message #254933] Mon, 30 July 2007 02:05 Go to previous messageGo to next message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
If you want to restrict on rows you have to use WHERE.
HAVING is made to restrict groups.

Regards
Michel

[Edit: my previous post disappeared!]

[Updated on: Mon, 30 July 2007 02:19]

Report message to a moderator

icon5.gif  Re: "Having clause" restrict row & groups or groups only ? [message #254945 is a reply to message #254933] Mon, 30 July 2007 02:13 Go to previous message
mbapoonam
Messages: 5
Registered: May 2006
Location: India
Junior Member
This is the question in one of the 1z0-007 SQL paper .
And I found many different anwers for this question.
We use where clause to restrict rows.
but using 'Having clause ' in group by function , we can restrict only group or rows.

Having clause is used to restrict rows or groups ?

If it restrict rows then this query gives error like-
select last_name
from employees
having employee_id=100;


so is it true that 'having clause ' can restrict only group and not the rows

[Updated on: Mon, 30 July 2007 03:58]

Report message to a moderator

Previous Topic: group by to_number()
Next Topic: Need function which takes input as sql query and returns column number
Goto Forum:
  


Current Time: Sun Dec 04 08:31:24 CST 2016

Total time taken to generate the page: 0.32450 seconds