SQL ORDER BY Command

OBJECTIVE

In this chapter you will learn:

About order by statement
Syntax of order by statement
Example of order by statement

 

About order by statement

SQL order by statement is used to retrieve data from database table in ascending or descending order. By default retrieved data is displayed in assending order but if you want to display the data in decending order then you can use it.

 

Syntax of order by statement

Select * from table_name where condition order by column_name (ASC|DESC)

In the given syntax ASC is used for ascending order and DESC for descending order

Example of order by

 

assending order

 

decending order
SUMMARY

In this chapter you have learned about order by statement so try to use it yourself. In the next chapter you will learn about GROUP BY statement.

 


Leave a Reply

Your email address will not be published. Required fields are marked *