ORDER BY
The SQL ORDER BY clause is used to sort the data in ascending or descending order, based on one or more columns. The ORDER BY keyword sorts the records in ascending order by default.The ORDER BY clause can only be used in SELECT statements.
Syntax:
Select * from table_name where [Condition]
Order by expression DESC OR ASC
We can use more than one column in the ORDER BY clause to sort the data in ascending or descending form.
Let's Consider the Employee1 table having the following records:
The SQL ORDER BY clause is used to sort the data in ascending or descending order, based on one or more columns. The ORDER BY keyword sorts the records in ascending order by default.The ORDER BY clause can only be used in SELECT statements.
Syntax:
Select * from table_name where [Condition]
Order by expression DESC OR ASC
We can use more than one column in the ORDER BY clause to sort the data in ascending or descending form.
Let's Consider the Employee1 table having the following records:
Now We'll sort the result in descending order by Name and Gender:
No comments :
Post a Comment