Mr_Shaw
asked on
SQL ORDER BY
I have a written a query without putting an ORDER BY.
I noticed that every time I ran the query the order of the records would change.
I have now placed an ORDER BY in the query and the order is now the same every time it is run.
Is it normal for the order to change each time a query is executed if it does not have an ORDER BY?
I noticed that every time I ran the query the order of the records would change.
I have now placed an ORDER BY in the query and the order is now the same every time it is run.
Is it normal for the order to change each time a query is executed if it does not have an ORDER BY?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
To be precise, the behaviour without ORDER BY is not defined. The DBMS can retrieve records depending on how it gets them: via indexes, materialized views, memory, disk, physical storage and access abilities, aso.
ASKER
thanks.