The Queries in this page solved at the library database. It is a sample database generated by randomly records. You can download it from the link. You will see more than 500 examples in the future. You can filter from the search panel above by selecting sql statements. I hope you will like it

SQL Order By Select Examples

1-) List the students according to their names

Solution 1)

Select * from students 
       order by name

Solution 2)

Select * from students 
       order by 2


ETİKETLER

Select - Order By -
2-) List all students according to their names reverse

Solution 1)

Select * from students 
       order by name desc


ETİKETLER

Select - Order By -
3-) List all students according to their class then by name

Solution 1)

Select * from students 
       order by sinif,gender


ETİKETLER

Select - Order By -
4-) List all students randomly ordered

Solution 1)

Select * from students 
       order by newid()


ETİKETLER

Select - Order By -
5-) List the student whose age is the biggest

Solution 1)

Select * from students 
       order by birthdate


ETİKETLER

Select - Order By -
Library Database
Database