Home » SQL & PL/SQL » SQL & PL/SQL » precedence
precedence [message #576902] Sun, 10 February 2013 06:52 Go to next message
ghostrider
Messages: 3
Registered: February 2013
Location: India
Junior Member
Why is it necessary to precede group by before order by and not vice versa in a sql query??
as the foll code gives an error
select name from student order by age group by name;
Re: precedence [message #576903 is a reply to message #576902] Sun, 10 February 2013 06:56 Go to previous messageGo to next message
cookiemonster
Messages: 11068
Registered: September 2008
Location: Rainy Manchester
Senior Member
Because that's the way the people who came up with the sql standard decided it should be.
Re: precedence [message #576904 is a reply to message #576903] Sun, 10 February 2013 07:00 Go to previous messageGo to next message
ghostrider
Messages: 3
Registered: February 2013
Location: India
Junior Member
Thankyou for your reply but there must be a reason to it when they decided to do it!!
Re: precedence [message #576905 is a reply to message #576904] Sun, 10 February 2013 08:25 Go to previous message
Michel Cadot
Messages: 59405
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
The reason is that ORDER BY is NOT part of relational theory.

Regards
Michel
Previous Topic: what's wrong in this script
Next Topic: PL/sql script store data
Goto Forum:
  


Current Time: Mon Oct 20 22:29:24 CDT 2014

Total time taken to generate the page: 0.09888 seconds