Javatpoint Logo

91-9990449935

 0120-4256464

SQL ORDER BY CLAUSE WITH DESCENDING ORDER:

This statement is used to sort data in descending order. You should use the DESC attribute in your ORDER BY clause as follows.

Let's see an example of an employee table:

IDNAMEAGEADDRESSSALARY
1Himani gupta21Modinagar22000
2Shiva tiwari22Bhopal21000
3Ajeet bhargav45Meerut65000
4Ritesh yadav36Azamgarh26000
5Balwant singh45Varanasi36000
6Mahesh sharma26Mathura22000

This is an example to sort the result in descending order by NAME.

This would produce the following result.

IDNAMEAGEADDRESSSALARY
2Shiva tiwari22Bhopal21000
4Ritesh yadav36Azamgarh26000
6Mahesh sharma26Mathura22000
1Himani gupta21Modinagar22000
5Balwant singh45Varanasi36000
3Ajeet bhargav45Meerut65000