+ 2
ORDER BY ______ ;🆚 ORDER BY ______ ASC;
Hello everybody, According to this “By default, the ORDER BY keyword sorts the results in ascending order.” So my question regarding this is, how different are ORDER BY ______ ; and ORDER BY ______ ASC;? And which one is the best to use and why? Thanks
5 odpowiedzi
+ 2
You can sort the result either ascending or descending. None is better than the other. It depends on the case specific requirements. If you e.g. want to request the highest test results, descending order of total points column is useful. If you want a list of friends who have birthday within the next month, ascending order by name or date of birth is more helpful.
+ 2
I'm not an SQL specialist too. Just I want to share some reflections. I think, It may be interesting when you order data without unique key, so you will have duplicated rows or objects. Same name field for example.
+ 2
Ordering the result does not affect the total number of results and doesn't create duplicate values.
+ 1
Mohamed Assaleh The ORDER BY keyword sorts the records in ascending order by default.
+ 1
I generally just use the standard ORDER BY ______; and have not experienced getting duplicate records or values todate