1đź‘Ť
âś…
Basically, you can’t. SQL databases can and do change the order of records as needed to ensure efficiency and speed.
If you always want to display records in a certain order, you need to add the ordering yourself. You could do something like have a “created_at” column in which you store a timestamp when the record is created, and then sort by that column when you retrieve the records, using order_by
.
👤dpassage
Source:stackexchange.com