Suppose I have a table containing the following data:
Name | Things
-------------
Foo | 5
Bar | 3
Baz | 8
If I want to insert a row, so that the final state of the table is:
Name | Things
-------------
Foo | 5
Qux | 6
Bar | 3
Baz | 8
Is this possible?
I understand we don’t typically rely on the order of rows in a table, but I’ve inherited some code that does precisely that. If I can insert to a location, I can avoid a significant refactor.
As you say, you can’t rely on the order of rows in a table (without an ORDER BY).
I would probably refactor the code anyway – there’s a chance it will break with no warning at some point in the future – surely better to deal with it now under controlled circumstances?