In the page on using LIMIT, we always have the DESC keyword in those queries. What purpose does this serve? When I remove DESC, the output is exactly the same. Does this apply only when there are multiple result rows returned perhaps?
DESC keyword is short for descending and is used to sort the the data in a descending order first. The sorted data is then returned from the SQL Query you enter on the terminal. Using it would obviously sort data and would affect the output regardless of how many rows we want to print.
As you can see from the screenshot below, I’ve used two commands;
- The first one uses
- Second command is used without the
The results are different in both.
Hope this clears your confusion, happy learning.
Thanks & regards
Dian Us Suqlain