Ðàçðàáîòêà áàç äàííûõ â Delphi. 11 Óðîêîâ

       

 Óïîðÿäî÷èâàíèå ñ èñïîëüçîâàíèåì íîìåðîâ ñòîëáöîâ


SELECT first_name, last_name, dept_no,

       job_code, salary * 1.1

FROM employee

ORDER BY 5                ïîëó÷èòü ñïèñîê ñîòðóäíèêîâ,
                                                                       óïîðÿäî÷åííûé ïî èõ çàðïëàòå
                                                                       ñ 10% íàäáàâêîé

FIRST_NAME   LAST_NAME     DEPT_NO JOB_CODE            

============ ============= ======= ======== ===========

Ann          Bennet        120     Admin        25228.5

Kelly        Brown         600     Admin          29700

Sue Anne     O'Brien       670     Admin        34402.5

Mark         Guckenheimer  622     Eng            35200

Roger        Reeves        120     Sales     36982.6875

Bill         Parker        623     Eng            38500

Äîïóñêàåòñÿ èñïîëüçîâàíèå íåñêîëüêèõ óðîâíåé âëîæåííîñòè ïðè óïîðÿäî÷èâàíèè âûâîäèìîé èíôîðìàöèè ïî ñòîëáöàì; ïðè ýòîì ðàçðåøàåòñÿ ñìåøèâàòü îáà ñïîñîáà.

SELECT first_name, last_name, dept_no,

       job_code, salary * 1.1

FROM employee

ORDER BY dept_no, 5 DESC, last_name
                          ïîëó÷èòü ñïèñîê ñîòðóäíèêîâ,
                                                                       óïîðÿäî÷åííûé ñíà÷àëà ïî
                                                                       íîìåðàì îòäåëîâ,
                                                                       â îòäåëàõ - ïî óáûâàíèþ èõ
                                                                       çàðïëàòû (ñ 10%),
                                                                       à â ïðåäåëàõ îäíîé çàðïëàòû -        ïî ôàìèëèÿì

FIRST_NAME  LAST_NAME  DEPT_NO JOB_CODE            

=========== ========== ======= ======== ===============

Oliver H.   Bender     000     CEO               234135

Terri       Lee        000     Admin            59172.3

Mary S.     MacDonald  100     VP             122388.75

Michael     Yanowski   100     SRep     48400.000000001

Luke        Leung      110     SRep             75685.5

Janet       Baldwin    110     Sales        67801.59375

Takashi     Yamamoto   115     SRep     8228000.0000001

Yuki        Ichida     115     Eng      6600000.0000001




Ñîäåðæàíèå ðàçäåëà