Home » SQL & PL/SQL » SQL & PL/SQL » using order by clause in create view
using order by clause in create view [message #339148] Wed, 06 August 2008 21:52 Go to next message
dassudip
Messages: 22
Registered: February 2005
Location: Delhi
Junior Member

Hi,
Can someone please clear the issue if using ORDER by clause in create view statement.

I created view with order by clause from a table and found it is absolutely possible and while selecting data from the view it is coming with the order of the definition.

In many forums I found 'order by' should not be used in view definitions. I fo not get what is the issue.

Regards,

dassudip
Re: using order by clause in create view [message #339152 is a reply to message #339148] Wed, 06 August 2008 22:26 Go to previous message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
>In many forums I found 'order by' should not be used in view definitions.
The above is very good advice.

>I fo not get what is the issue.
The issue is overhead or wasted effort.

In some/many regards a view is a "virtual" table.
How would anyone know the order of the results returned by view?
What happens when a user who wants the data in a different order?
Your view sorts the data one way & the the actual query sorts the data into the desired order.
How efficient is that?


Previous Topic: Parsing and searching for each row
Next Topic: How to solve the mentioned issue with a single query
Goto Forum:
  


Current Time: Tue Feb 18 13:26:53 CST 2025