It is the last clause of select statement responsible to arrange the records in a proper manner either ascending or descending order. To do so order by clause provides two attributes, asc and desc. Order by clause in SQL default order is asc.
Syntax for Order By clause in SQL
SELECT <EXP>
FROM <T_NAME>
ORDER BY <COL_NAME>[ASC|DESC]];
Better to read the previous topic to get good knowledge about SQL.
Wildcard Operators in SQL
Operator in Transact SQL
Data Query Language
Single column-wise ordering
SELECT EMPNO, ENAME, SAL, JOB, DEPTNO FROM EMP
ORDER BY DEPTNO DESC;
Multi column-wise ordering
SELECT EMPNO, ENAME , JOB, DEPTNO FROM EMP
ORDER BY DEPTNO, SAL DESC;
Select Statement Syntax
Select <exp>
From <t_name>
[where<cond>]
[group<col_name>]
[having by <group col_name>]
order by <col_name>[asc|desc]];