'How does SELECT return a unsorted result set?
I was just trying to display the result set of a SELECT query in reverse order when I came by this link: Select last row in MySQL
In one of the answers it is mentioned that relational databases do not have a first or last row. So my question is if we typed in SELECT * FROM table_name, is it necessary that the result set will be in the same order in which the data was inputted into the database?
Also, if someone could tell me how to display the results of the above query in PHP in reverse order(without using any sorting in the query itself), it would be great.
Solution 1:[1]
You can use do it in simple way
SELECT * FROM your_table ORDER BY id DESC
I hope this can help you
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Abdelilah Aassou |
