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 the Query Output?

Go down

How To Sort the Query Output? Empty How To Sort the Query Output?

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

If you want the returning rows to be sorted, you can specify a sorting expression in the ORDER
BY clause. The following select statement returns rows sorted by the values in the "manager_id"
column:
SQL> SELECT * FROM departments ORDER BY manager_id;
DEPARTMENT_ID DEPARTMENT_NAME MANAGER_ID LOCATION_ID
------------- ------------------------------ ---------- -----------
90 Executive 100 1700
60 IT 103 1400
100 Finance 108 1700
30 Purchasing 114 1700
50 Shipping 121 1500
80 Sales 145 2500
10 Administration 200 1700
20 Marketing 201 1800

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