You are viewing a single comment's thread. Return to all comments →
Can you just explain the desc part. I understood the whole part but didn't get this particular part
ORDER BY LENGTH(CITY) desc,
@adityaanand12345 normally it will be sorted in ascending order when you use ORDER but in this case we want to get the longest name so we use desc to sort it in descending order so we can get the first one.
The desc part just orders the query in descending order.
by default order by sorts in ascending order, U need to specify desc so that it does it in descending order ie A-Z!!
A-Z is ascending, and Z-A descending, I think.
order by clause used for sorting purpose like if you want to print something in ascending order or decending order , by default order by clause print ascending but if you want print name in descending order that time we use desc to sort