Óïîðÿäî÷èâàíèå ñ èñïîëüçîâàíèåì èìåí ñòîëáöîâ
SELECT first_name, last_name, dept_no,
job_code, salary
FROM employee
ORDER BY last_name ïîëó÷èòü ñïèñîê ñîòðóäíèêîâ,
óïîðÿäî÷åííûé ïî ôàìèëèÿì
â àëôàâèòíîì ïîðÿäêå
FIRST_NAME LAST_NAME DEPT_NO JOB_CODE SALARY
============ ============= ======= ======== ===========
Janet Baldwin 110 Sales 61637.81
Oliver H. Bender 000 CEO 212850.00
Ann Bennet 120 Admin 22935.00
Dana Bishop 621 Eng 62550.00
Kelly Brown 600 Admin 27000.00
Jennifer M. Burbank 622 Eng 53167.50
Kevin Cook 670 Dir 111262.50
Roger De Souza 623 Eng 69482.62
Roberto Ferrari 125 SRep 99000000.00
...
SELECT first_name, last_name, dept_no,
job_code, salary
FROM employee
ORDER BY last_name DESC ïîëó÷èòü ñïèñîê ñîòðóäíèêîâ,
óïîðÿäî÷åííûé ïî ôàìèëèÿì
â ïîðÿäêå, îáðàòíîì àëôàâèòíîìó
FIRST_NAME LAST_NAME DEPT_NO JOB_CODE SALARY
============ ============= ======= ======== ===========
Katherine Young 623 Mngr 67241.25
Bruce Young 621 Eng 97500.00
Michael Yanowski 100 SRep 44000.00
Takashi Yamamoto 115 SRep 7480000.00
Randy Williams 672 Mngr 56295.00
K. J. Weston 130 SRep 86292.94
Claudia Sutherland 140 SRep 100914.00
Walter Steadman 900 CFO 116100.00
Willie Stansbury 120 Eng 39224.06
Roger Reeves 120 Sales 33620.62
...
Ñòîëáåö, îïðåäåëÿþùèé ïîðÿäîê âûâîäà ñòðîê, íå îáÿçàòåëüíî äîæåí ïðèñóòñòâîâàòü â ñïèñêå âûáèðàåìûõ ýëåìåíòîâ (ñòîëáöîâ):
SELECT first_name, last_name, dept_no,
job_code
FROM employee
ORDER BY salary ïîëó÷èòü ñïèñîê ñîòðóäíèêîâ,
óïîðÿäî÷åííûé ïî èõ çàðïëàòå
FIRST_NAME LAST_NAME DEPT_NO JOB_CODE
=============== =============== ======= ========
Ann Bennet 120 Admin
Kelly Brown 600 Admin
Sue Anne O'Brien 670 Admin
Mark Guckenheimer 622 Eng
Roger Reeves 120 Sales
Bill Parker 623 Eng