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: 515
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: 68718
Registered: March 2007
Location: Saint-Maur, France, https...
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: Tue Dec 03 09:33:40 CST 2024