Reputation: 207
I am inserting number of records in database its inserting correctly, but the order of the records not maintained. So is there any solution to solve this problem except ORDER BY clause.
Upvotes: 0
Views: 213
Reputation: 46482
There's no such thing like order of the records in a database. When using a SELECT without ORDER BY, the database returns the rows in an arbitrary order.
If you're unlucky enough, it returns them in the insertion order. Everything's fine... until some day a table compaction or whatever happens and the order is gone.
Never rely on it.
Upvotes: 3