ORDER BY keyword is sorting result by ascending or descending order record wise
ORDER BY is by default sort result ascending not require to type ASC but if result get in decending than type DESC keyword with ORDER BY
ORDER BY Syntax
SELECT col1, col2 FROM YourTableName ORDER BY YourTable Column Like col1 ASC or DESC
Example
SELECT * FROM City ORDER BY CityName DESC
Result sort by CityName Z to A wise if type ASC keyword result sort by CityName A to Z
Use multiple column name in ORDER BY
Example
1. SELECT * FROM Student ORDER BY StudentName, Dateofbirth DESC
2. SELECT * FROM Student ORDER BY StudentName ASC, Dateofbirth DESC
ORDER BY is by default sort result ascending not require to type ASC but if result get in decending than type DESC keyword with ORDER BY
ORDER BY Syntax
SELECT col1, col2 FROM YourTableName ORDER BY YourTable Column Like col1 ASC or DESC
Example
SELECT * FROM City ORDER BY CityName DESC
Result sort by CityName Z to A wise if type ASC keyword result sort by CityName A to Z
Use multiple column name in ORDER BY
Example
1. SELECT * FROM Student ORDER BY StudentName, Dateofbirth DESC
2. SELECT * FROM Student ORDER BY StudentName ASC, Dateofbirth DESC
No comments:
Post a Comment