The order of rows returned in a query result is undefined. The order by clause can be used to sort the rows. If you use the order by clause, it must be the last clause of the SQL statement.
Arrange employee records in ascending order of their sal ?
SQL> select * from emp order by sal;
Arrange employee records in ascending of their deptno and with in dept arrange records in descending order of their sal ?
SQL> select * from emp order by deptno,sal desc;
Note : In ODER BY clause we can use column name or column position.
No comments:
Post a Comment