Skip to main content

Posts

Showing posts with the label Order by clause

Order By Clause

This clause in a select statement arranges the data on a specified column in ascending or in descending order. This clause will work after the execution of select statement. By default it arranges the data in ascending order. In order to arrange the data in descending order , an option called DESC is used. Data is arranged in order over a required column for temporary. Order by clause can be specified with one or more columns.       Examples :-         Display empno, ename and salary of all the employees arranging salaries in ascending order.           Ans : Select empno, ename, sal from emp order by sal;           Display ename, job, salary, deptno, commission, and hiredate of all those employees  who are working as CLERK, SALESMAN and they have been hired in the year 81 and they don’t earn any commission. Arrange the data in ascending order of salary.    ...