SQL tutorial | Interview questions | Oracle
Would you like to react to this message? Create an account in a few clicks or log in to continue.

How To Sort Output in Descending Order?

Go down

How To Sort Output in Descending Order? Empty How To Sort Output in Descending Order?

Post by Micheal Sun Jan 17, 2010 3:03 am

If you want to sort a column in descending order, you can specify the DESC keyword in the
ORDER BY clause. The following SELECT statement first sorts the department in descending
order, then sorts the salary in ascending order:
SQL> SELECT department_id, first_name, last_name, salary
FROM employees ORDER BY department_id DESC, salary;
DEPARTMENT_ID FIRST_NAME LAST_NAME SALARY
------------- --------------- --------------- ----------
Kimberely Grant 7000
110 William Gietz 8300
110 Shelley Higgins 12000
100 Luis Popp 6900
100 Ismael Sciarra 7700
100 Jose Manuel Urman 7800
100 John Chen 8200
100 Daniel Faviet 9000

Micheal
Admin

Posts : 243
Join date : 2010-01-10

http://sql-tutorial.co.cc

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum