trainingtrains Logo

91-9990449935

 0120-4256464

SQL ORDER BY CLAUSE WITH ASCENDING ORDER

This statement is used to sort data in ascending order. If you miss the ASC attribute, SQL ORDER BY query takes ascending order by default.

Let?s take an example of supplier

Let us take a CUSTOMERS table having the following records:

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

This is an example to sort the result in ascending order by NAME and SALARY.

This would produce the following result.

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