Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in SQL by (55.6k points)

Can anyone explain how to use order by in SQL?

1 Answer

0 votes
by (119k points)

Order by keyword is used to sort the query results in either ascending or descending order. By default, order by sorts the result-set in ascending order. Here is the syntax to use order by keyword in SQL:

SELECT column_list

FROM table_name

ORDER BY column(s) ASC|DESC;

Here is the statement to return the employee details in according to the descending order of their salaries:

SELECT E_ID, E_Name

FROM Employee

ORDER BY Salary DESC

You can go through this SQL Tutorial blog by Intellipaat for a detailed explanation of the order by clause.

Related questions

0 votes
1 answer
asked May 4, 2020 in SQL by Sudhir_1997 (55.6k points)
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked May 5, 2020 in SQL by Sudhir_1997 (55.6k points)

Browse Categories

...