I don't know which db server do you use, but as I know the Oracle db doesn't guarantee the order of rows int the result set if you not specify an ORDER clause in the select. (even if you do 100 selects and it returns the same order, it's possible to have a different order at the next select).
In SQL Server the PK on a table has an associated 'clustered index' that keeps the data in the table ordered by that PK, so if there isn't an ORDER clause defined into SELECT it will returns the rows ordered by PK column/s or another column/s that have a 'clustered index' defined (it can be only one 'clustered index' defined for a table).
See the documentation for another db servers.
|