Order By Clause in SQL
Order By Clause in SQL-
The order by clause is basically used for display or arrange data from table column with ascending or descending order. If we want to display data with order format like alphabetical then order by clause is used mainly.
- The order by clause with any change by default in ascending order mainly.
- If we want to display data in descending order then we use DESC method for data display in descending order.
- After we want the data in ascending order then we can use ASC method for display data.
SELECT * FROM Emp ORDER BY Emp_Name, Salary DESC; OUTPUT-
SELECT * FROM Emp ORDER BY Emp_Name ASC, Emp_id DESC; OUTPUT-