SQL

ORDER BY Clause In SQL

Article SQL

The SQL ORDER BY Clause

The ORDER BY Clause is used to sort the result-set in ascending or descending order.

Syntax

The syntax for the ORDER BY clause in SQL is

     SELECT column1, column2, …
     FROM table_name
     ORDER BY column1, column2, … ASC|DESC;

Example

SELECT * FROM solo
ORDER BY Name;

ORDER BY Clause In SQL

ORDER BY Clause In SQL

The ORDER BY Clause sorts the records in ascending order by default. To sort the records in descending order, use the DESC keyword.

Example

SELECT * FROM solo
ORDER BY Name DESC ;

ORDER BY Clause In SQL

Conclusion

In this Code Snippet, you will understand how to use the ORDER BY Clause with ASC OR DESC Keyword.

Jyoti Mishra
Latest posts by Jyoti Mishra (see all)

Leave a Reply

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