Ì. Ãðóáåð | Ïîíèìàíèå SQL (1993) [PDF]
Àâòîð: Ì. Ãðóáåð
Æàíð: SQL. ßçûê çàïðîñîâ ê áàçàì äàííûõ
Ôîðìàò: PDF
Êà÷åñòâî: Èçíà÷àëüíî ýëåêòðîííîå (ebook)
Èëëþñòðàöèè: ×åðíî-áåëûå
Îïèñàíèå:"ÏÎÍÈÌÀÍÈÅ SQL" — ýòî ïîëíûé ó÷åáíèê ïî ïðîãðàììèðîâàíèþ íà Ñòðóêòóðèðîâàííîì ßçûêå
Çàïðîñîâ, íàïèñàííûé ñïåöèàëüíî äëÿ òåõ, êòî áóäåò èñïîëüçîâàòü SQL â ïðîöåññå ðàáîòû.
Äàæå åñëè ýòî âàø ïåðâûé îïûò ñ êîìïüþòåðàìè èëè óïðàâëåíèåì áàçàìè äàííûõ, êíèãà
"ÏÎÍÈÌÀÍÈÅ SQL" î÷åíü áûñòðî íàó÷èò âàñ ñâîáîäíî ðàáîòàòü ñ ðåàëüíîé SQL, èñïîëüçîâàíèþ
ïðîñòûõ çàïðîñîâ, à òàêæå ñíàáäèò âàñ ÿñíûìè ïîíÿòèÿìè îá àâòîìàòèçèðîâàííîì óïðàâëåíèè
áàçîé äàííûõ. Êíèãà äàñò âàì êðàòêîå, óäîáíîå â ÷òåíèè ââåäåíèå â ðåëÿöèîííûå áàçû äàííûõ.
Ïðåäîñòàâèò âàì îáó÷àþùèå ïðîãðàììû, ÷òîáû, îâëàäåâàÿ êîìàíäàìè SQL øàã çà øàãîì, ïîìî÷ü
âàì óçíàòü, êàê èçâëåêàòü è îáðàáàòûâàòü èíôîðìàöèþ, ñîäåðæàùóþñÿ â òàáëèöàõ äàííûõ.
ÂÂÅÄÅÍÈÅ Â ÐÅËßÖÈÎÍÍÓÞ ÁÀÇÓ ÄÀÍÍÛÕ ...........................................................................8
ÂÂÅÄÅÍÈÅ...................................................................................................................................................................................... 9
×ÒÎ ÒÀÊÎÅ — ÐÅËßÖÈÎÍÍÀß ÁÀÇÀ ÄÀÍÍÛÕ?...................................................................................................................... 9
ÑÂßÇÛÂÀÍÈÅ ÎÄÍÎÉ ÒÀÁËÈÖÛ Ñ ÄÐÓÃÎÉ......................................................................................................................... 10
ÏÎÐßÄÎÊ ÑÒÐÎÊ ÏÐÎÈÇÂÎËÅÍ.............................................................................................................................................. 10
ÈÄÅÍÒÈÔÈÊÀÖÈß ÑÒÐÎÊ (ÏÅÐÂÈ×ÍÛÅ ÊËÞ×È)................................................................................................................ 11
ÑÒÎËÁÖÛ ÈÌÅÍÓÞÒÑß È ÍÓÌÅÐÓÞÒÑß............................................................................................................................. 11
ÒÈÏÎÂÀß ÁÀÇÀ ÄÀÍÍÛÕ........................................................................................................................................................... 11
ÐÅÇÞÌÅ........................................................................................................................................................................................ 13
ÐÀÁÎÒÀ Ñ SQL............................................................................................................................................................................. 14
SQL: ÎÁÇÎÐ................................................................................................................................... 15
ÊÀÊ ÐÀÁÎÒÀÅÒ SQL? .................................................................................................................................................................. 16
×ÒÎ ÄÅËÀÅÒ ANSI ? .................................................................................................................................................................... 16
ÈÍÒÅÐÀÊÒÈÂÍÛÉ È ÂËÎÆÅÍÍÛÉ SQL................................................................................................................................. 17
ÑÓÁÏÎÄÐÀÇÄÅËÅÍÈß SQL........................................................................................................................................................ 17
ÐÀÇËÈ×ÍÛÅ ÒÈÏÛ ÄÀÍÍÛÕ .................................................................................................................................................... 18
SQL ÍÅÑÎÃËÀÑÎÂÀÍÍÎÑÒÈ.................................................................................................................................................... 19
×ÒÎ ÒÀÊÎÅ — ÏÎËÜÇÎÂÀÒÅËÜ? ............................................................................................................................................. 19
ÓÑËÎÂÈß È ÒÅÐÌÈÍÎËÎÃÈß.................................................................................................................................................. 20
ÐÅÇÞÌÅ........................................................................................................................................................................................ 20
ÐÀÁÎÒÀ Ñ SQL............................................................................................................................................................................. 21
ÈÑÏÎËÜÇÎÂÀÍÈÅ SQL ÄËß ÈÇÂËÅ×ÅÍÈß ÈÍÔÎÐÌÀÖÈÈ ÈÇ ÒÀÁËÈÖ.............................. 22
ÑÎÇÄÀÍÈÅ ÇÀÏÐÎÑÀ................................................................................................................................................................. 23
×ÒÎ ÒÀÊÎÅ ÇÀÏÐÎÑ ?................................................................................................................................................................ 23
ÃÄÅ ÏÐÈÌÅÍßÞÒÑß ÇÀÏÐÎÑÛ ?............................................................................................................................................ 23
ÊÎÌÀÍÄÀ SELECT....................................................................................................................................................................... 23
ÂÛÁÈÐÀÉÒÅ ÂÑÅÃÄÀ ÑÀÌÛÉ ÏÐÎÑÒÎÉ ÑÏÎÑÎÁ.............................................................................................................. 25
ÎÏÈÑÀÍÈÅ SELECT.................................................................................................................................................................... 25
ÏÐÎÑÌÎÒÐ ÒÎËÜÊÎ ÎÏÐÅÄÅËÅÍÍÎÃÎ ÑÒÎËÁÖÀ ÒÀÁËÈÖÛ .......................................................................................... 25
ÏÅÐÅÓÏÎÐßÄÎ×ÅÍÈÅ ÑÒÎËÁÖÀ ............................................................................................................................................ 26
ÓÄÀËÅÍÈÅ ÈÇÁÛÒÎ×ÍÛÕ ÄÀÍÍÛÕ........................................................................................................................................ 27
ÏÀÐÀÌÅÒÐÛ DISTINCT............................................................................................................................................................... 28
DISTINCT ÂÌÅÑÒÎ ALL............................................................................................................................................................... 28
ÊÂÀËÈÔÈÖÈÐÎÂÀÍÍÛÉ ÂÛÁÎÐ ÏÐÈ ÈÑÏÎËÜÇÎÂÀÍÈÈ ÏÐÅÄËÎÆÅÍÈÉ.................................................................... 28
ÐÅÇÞÌÅ........................................................................................................................................................................................ 29
ÐÀÁÎÒÀ Ñ SQL............................................................................................................................................................................. 30
ÈÑÏÎËÜÇÎÂÀÍÈÅ ÐÅËßÖÈÎÍÍÛÕ È ÁÓËÅÂÛÕ ÎÏÅÐÀÒÎÐÎÂ ÄËß ÑÎÇÄÀÍÈß ÁÎËÅÅ
ÈÇÎÙÐÅÍÍÛÕ ÏÐÅÄÈÊÀÒÎÂ..................................................................................................... 31
ÐÅËßÖÈÎÍÍÛÅ ÎÏÅÐÀÒÎÐÛ.................................................................................................................................................. 32
ÁÓËÅÂÛ ÎÏÅÐÀÒÎÐÛ................................................................................................................................................................ 33
ÐÅÇÞÌÅ........................................................................................................................................................................................ 37
ÐÀÁÎÒÀ Ñ SQL............................................................................................................................................................................. 37
ÈÑÏÎËÜÇÎÂÀÍÈÅ ÑÏÅÖÈÀËÜÍÛÕ ÎÏÅÐÀÒÎÐÎÂ Â ÓÑËÎÂÈßÕ......................................... 38
ÎÏÅÐÀÒÎÐ IN............................................................................................................................................................................... 39
ÎÏÅÐÀÒÎÐ BETWEEN................................................................................................................................................................ 40
ÎÏÅÐÀÒÎÐ LIKE........................................................................................................................................................................... 42
ÐÀÁÎÒÀ Ñ ÍÓËÅÂÛÌÈ (NULL) ÇÍÀ×ÅÍÈßÌÈ........................................................................................................................ 44
NULL ÎÏÅÐÀÒÎÐ......................................................................................................................................................................... 44
ÈÑÏÎËÜÇÎÂÀÍÈÅ NOT ÑÎ ÑÏÅÖÈÀËÜÍÛÌÈ ÎÏÅÐÀÒÎÐÀÌÈ ........................................................................................ 45
ÐÅÇÞÌÅ........................................................................................................................................................................................ 46
ÐÀÁÎÒÀ Ñ SQL............................................................................................................................................................................. 46
ÎÁÎÁÙÅÍÈÅ ÄÀÍÍÛÕ Ñ ÏÎÌÎÙÜÞ ÀÃÐÅÃÀÒÍÛÕ ÔÓÍÊÖÈÉ............................................ 47
×ÒÎ ÒÀÊÎÅ ÀÃÐÅÃÀÒÍÛÅ ÔÓÍÊÖÈÈ ?.................................................................................................................................... 48
ÊÀÊ ÈÑÏÎËÜÇÎÂÀÒÜ ÀÃÐÅÃÀÒÍÛÅ ÔÓÍÊÖÈÈ ?................................................................................................................... 48
ÑÏÅÖÈÀËÜÍÛÅ ÀÒÐÈÁÓÒÛ COUNT........................................................................................................................................ 49
ÈÑÏÎËÜÇÎÂÀÍÈÅ DISTINCT .................................................................................................................................................... 49
ÈÑÏÎËÜÇÎÂÀÍÈÅ COUNT ÑÎ ÑÒÐÎÊÀÌÈ, À ÍÅ ÇÍÀ×ÅÍÈßÌÈ....................................................................................... 50
ÂÊËÞ×ÅÍÈÅ ÄÓÁËÈÊÀÒΠ ÀÃÐÅÃÀÒÍÛÅ ÔÓÍÊÖÈÈ........................................................................................................ 50
ÀÃÐÅÃÀÒÛ ÏÎÑÒÐÎÅÍÍÛÅ ÍÀ ÑÊÀËßÐÍÎÌ ÂÛÐÀÆÅÍÈÈ............................................................................................... 51
ÏÐÅÄËÎÆÅÍÈÅ GROUP BY....................................................................................................................................................... 51
ÏÐÅÄËÎÆÅÍÈÅ HAVING............................................................................................................................................................ 53
ÍÅ ÄÅËÀÉÒÅ ÂËÎÆÅÍÍÛÕ ÀÃÐÅÃÀÒÎÂ................................................................................................................................. 54
ÐÅÇÞÌÅ........................................................................................................................................................................................ 55
ÐÀÁÎÒÀ Ñ SQL............................................................................................................................................................................. 55
ÔÎÐÌÈÐÎÂÀÍÈÅ ÂÛÂÎÄÎÂ ÇÀÏÐÎÑÎÂ................................................................................. 56
ÑÒÐÎÊÈ È ÂÛÐÀÆÅÍÈß............................................................................................................................................................ 57
ÓÏÎÐßÄÎ×ÅÍÈÅ ÂÛÂÎÄÀ ÏÎËÅÉ.......................................................................................................................................... 59
ÐÅÇÞÌÅ........................................................................................................................................................................................ 63
ÐÀÁÎÒÀ Ñ SQL............................................................................................................................................................................. 63
ÇÀÏÐÀØÈÂÀÍÈÅ ÌÍÎÃÎ×ÈÑËÅÍÛÕ ÒÀÁËÈÖ ÒÀÊ ÆÅ, ÊÀÊ ÎÄÍÎÉ................................... 64
ÎÁÚÅÄÈÍÅÍÈÅ ÒÀÁËÈÖ............................................................................................................................................................ 65
ÈÌÅÍÀ ÒÀÁËÈÖ È ÑÒÎËÁÖÎÂ.................................................................................................................................................. 65
ÑÎÇÄÀÍÈÅ ÎÁÜÅÄÈÍÅÍÈß ...................................................................................................................................................... 65
ÎÁÚÅÄÈÍÅÍÈÅ ÒÀÁËÈÖ ×ÅÐÅÇ ÑÏÐÀÂÎ×ÍÓÞ ÖÅËÎÑÒÍÎÑÒÜ...................................................................................... 66
ÎÁÚÅÄÈÍÅÍÈß ÒÀÁËÈÖ ÏÎ ÐÀÂÅÍÑÒÂÓ ÇÍÀ×ÅÍÈÉ Â ÑÒÎËÁÖÀÕ È ÄÐÓÃÈÅ ÂÈÄÛ ÎÁÚÅÄÈÍÅÍÈÉ ................... 67
ÎÁÚÅÄÈÍÅÍÈÅ ÁÎËÅÅ ÄÂÓÕ ÒÀÁËÈÖ.................................................................................................................................... 68
ÐÅÇÞÌÅ........................................................................................................................................................................................ 69
ÐÀÁÎÒÀ Ñ SQL............................................................................................................................................................................. 69
ÎÁÚÅÄÈÍÅÍÈÅ ÒÀÁËÈÖÛ Ñ ÑÎÁÎÉ........................................................................................ 70
ÊÀÊ ÄÅËÀÒÜ ÎÁÚÅÄÈÍÅÍÈÅ ÒÀÁËÈÖÛ Ñ ÑÎÁÎÉ ?............................................................................................................ 71
ÏÑÅÂÄÎÍÈÌÛ............................................................................................................................................................................. 71
ÓÑÒÐÀÍÅÍÈÅ ÈÇÁÛÒÎ×ÍÎÑÒÈ............................................................................................................................................... 72
ÏÐÎÂÅÐÊÀ ÎØÈÁÎÊ................................................................................................................................................................... 73
ÁÎËÜØÅ ÏÑÅÂÄÎÍÈÌÎÂ.......................................................................................................................................................... 74
ÅÙÅ ÁÎËÜØÅ ÊÎÌÏËÅÊÑÍÛÕ ÎÁÚÅÄÈÍÅÍÈÉ.................................................................................................................... 74
ÐÅÇÞÌÅ........................................................................................................................................................................................ 76
ÐÀÁÎÒÀ Ñ SQL............................................................................................................................................................................. 76
ÂÑÒÀÂÊÀ ÎÄÍÎÃÎ ÇÀÏÐÎÑÀ ÂÍÓÒÐÜ ÄÐÓÃÎÃÎ..................................................................... 77
ÊÀÊ ÐÀÁÎÒÀÅÒ ÏÎÄÇÀÏÐÎÑ? .................................................................................................................................................. 78
ÇÍÀ×ÅÍÈß, ÊÎÒÎÐÛÅ ÌÎÃÓÒ ÂÛÄÀÂÀÒÜ ÏÎÄÇÀÏÐÎÑÛ................................................................................................. 79
DISTINCT Ñ ÏÎÄÇÀÏÐÎÑÀÌÈ................................................................................................................................................... 79
ÏÐÅÄÈÊÀÒÛ Ñ ÏÎÄÇÀÏÐÎÑÀÌÈ ßÂËßÞÒÑß ÍÅÎÁÐÀÒÈÌÛÌÈ...................................................................................... 80
ÈÑÏÎËÜÇÎÂÀÍÈÅ ÀÃÐÅÃÀÒÍÛÕ ÔÓÍÊÖÈÉ Â ÏÎÄÇÀÏÐÎÑÀÕ.......................................................................................... 81
ÈÑÏÎËÜÇÎÂÀÍÈÅ ÏÎÄÇÀÏÐÎÑÎÂ, ÊÎÒÎÐÛÅ ÂÛÄÀÞÒ ÌÍÎÃÎ ÑÒÐÎÊ Ñ ÏÎÌÎÙÜÞ ÎÏÅÐÀÒÎÐÀ IN................. 82
ÏÎÄÇÀÏÐÎÑÛ ÂÛÁÈÐÀÞÒ ÎÄÈÍÎ×ÍÛÅ ÑÒÎËÁÖÛ.......................................................................................................... 84
ÈÑÏÎËÜÇÎÂÀÍÈÅ ÂÛÐÀÆÅÍÈÉ Â ÏÎÄÇÀÏÐÎÑÀÕ............................................................................................................. 84
ÏÎÄÇÀÏÐÎÑÛ Â ÏÐÅÄËÎÆÅÍÈÈ HAVING............................................................................................................................. 85
ÐÅÇÞÌÅ........................................................................................................................................................................................ 86
ÐÀÁÎÒÀ Ñ SQL............................................................................................................................................................................. 86
ÑÎÎÒÍÅÑÅÍÍÛÅ ÏÎÄÇÀÏÐÎÑÛ............................................................................................... 87
ÊÀÊ ÑÔÎÐÌÈÐÎÂÀÒÜ ÑÎÎÒÍÅÑÅÍÍÛÉ ÏÎÄÇÀÏÐÎÑ ....................................................................................................... 88
ÊÀÊ ÐÀÁÎÒÀÅÒ ÑÎÎÒÍÅÑÅÍÍÛÉ ÏÎÄÇÀÏÐÎÑ................................................................................................................... 88
ÈÑÏÎËÜÇÎÂÀÍÈÅ ÑÎÎÒÍÅÑÅÍÍÛÕ ÏÎÄÇÀÏÐÎÑÎÂ ÄËß ÍÀÕÎÆÄÅÍÈß ÎØÈÁÎÊ................................................... 91
ÑÐÀÂÍÅÍÈÅ ÒÀÁËÈÖÛ Ñ ÑÎÁÎÉ............................................................................................................................................ 91
ÑÎÎÒÍÅÑÅÍÍÛÅ ÏÎÄÇÀÏÐÎÑÛ Â ÏÐÅÄËÎÆÅÍÈÈ HAVING............................................................................................ 92
ÑÎÎÒÍÅÑÅÍÍÛÅ ÏÎÄÇÀÏÐÎÑÛ È ÎÁÜÅÄÈÍÅÍÈß............................................................................................................ 93
ÐÅÇÞÌÅ........................................................................................................................................................................................ 93
ÐÀÁÎÒÀ Ñ SQL............................................................................................................................................................................. 94
ÈÑÏÎËÜÇÎÂÀÍÈÅ ÎÏÅÐÀÒÎÐÀ EXISTS ................................................................................... 95
ÊÀÊ ÐÀÁÎÒÀÅÒ EXISTS?............................................................................................................................................................. 96
ÂÛÁÎÐ ÑÒÎËÁÖÎÂ Ñ ÏÎÌÎÙÜÞ EXISTS ............................................................................................................................. 97
ÈÑÏÎËÜÇÎÂÀÍÈÅ EXISTS Ñ ÑÎÎÒÍÅÑÅÍÍÛÌÈ ÏÎÄÇÀÏÐÎÑÀÌÈ................................................................................ 97
ÊÎÌÁÈÍÀÖÈß ÈÇ EXISTS È ÎÁÜÅÄÈÍÅÍÈß......................................................................................................................... 98
ÈÑÏÎËÜÇÎÂÀÍÈÅ NOT EXISTS................................................................................................................................................ 99
EXISTS È ÀÃÐÅÃÀÒÛ................................................................................................................................................................... 99
ÁÎËÅÅ ÓÄÀ×ÍÛÉ ÏÐÈÌÅÐ ÏÎÄÇÀÏÐÎÑÀ........................................................................................................................... 100
ÐÅÇÞÌÅ...................................................................................................................................................................................... 101
ÐÀÁÎÒÀ Ñ SQL........................................................................................................................................................................... 101
ÈÑÏÎËÜÇÎÂÀÍÈÅ ÎÏÅÐÀÒÎÐÎÂ ANY, ALL È SOME ............................................................ 102
ÑÏÅÖÈÀËÜÍÛÅ ÎÏÅÐÀÒÎÐÛ ANY èëè SOME..................................................................................................................... 103
ÈÑÏÎËÜÇÎÂÀÍÈÅ ÎÏÅÐÀÒÎÐÎÂ IN ÈËÈ EXISTS ÂÌÅÑÒÎ ÎÏÅÐÀÒÎÐÀ ANY............................................................. 104
ÊÀÊ ANY ÌÎÆÅÒ ÑÒÀÒÜ ÍÅÎÄÍÎÇÍÀ×ÍÛÌ....................................................................................................................... 105
ÑÏÅÖÈÀËÜÍÛÉ ÎÏÅÐÀÒÎÐ ALL............................................................................................................................................ 108
ÐÀÂÅÍÑÒÂÀ È ÍÅÐÀÂÅÍÑÒÂÀ................................................................................................................................................ 109
ÏÐÀÂÈËÜÍÎÅ ÏÎÍÈÌÀÍÈÅ ANY È ALL................................................................................................................................ 111
ÊÀÊ ANY, ALL, È EXIST ÏÎÑÒÓÏÀÞÒ Ñ ÎÒÑÓÒÑÒÂÓÞÙÈÌÈ È ÍÅÈÇÂÅÑÒÍÛÌÈ ÄÀÍÍÛÌÈ................................... 111
ÊÎÃÄÀ ÏÎÄÇÀÏÐÎÑ ÂÎÇÂÐÀÙÀÅÒÑß ÏÓÑÒÛÌ................................................................................................................. 111
ANY È ALL ÂÌÅÑÒÎ EXISTS Ñ ÏÓÑÒÛÌ ÓÊÀÇÀÒÅËÅÌ (NULL).......................................................................................... 112
ÈÑÏÎËÜÇÎÂÀÍÈÅ COUNT ÂÌÅÑÒÎ EXISTS........................................................................................................................ 113
ÐÅÇÞÌÅ...................................................................................................................................................................................... 114
ÐÀÁÎÒÀ Ñ SQL........................................................................................................................................................................... 114
ÈÑÏÎËÜÇÎÂÀÍÈÅ ÏÐÅÄËÎÆÅÍÈß UNION............................................................................. 115
ÎÁÚÅÄÈÍÅÍÈÅ ÌÍÎÃÎ×ÈÑËÅÍÍÛÕ ÇÀÏÐÎÑΠ ÎÄÈÍ............................................................................................... 116
ÊÎÃÄÀ ÂÛ ÌÎÆÅÒÅ ÄÅËÀÒÜ ÎÁÚÅÄÈÍÅÍÈÅ ÌÅÆÄÓ ÇÀÏÐÎÑÀÌÈ?............................................................................ 117
UNION È ÓÑÒÐÀÍÅÍÈÅ ÄÓÁËÈÊÀÒÎÂ................................................................................................................................... 118
ÈÑÏÎËÜÇÎÂÀÍÈÅ ÑÒÐÎÊ È ÂÛÐÀÆÅÍÈÉ Ñ UNION.......................................................................................................... 119
ÈÑÏÎËÜÇÎÂÀÍÈÅ UNION Ñ ORDER BY................................................................................................................................ 120
ÂÍÅØÍÅÅ ÎÁÚÅÄÈÍÅÍÈÅ...................................................................................................................................................... 121
ÐÅÇÞÌÅ...................................................................................................................................................................................... 125
ÐÀÁÎÒÀ Ñ SQL........................................................................................................................................................................... 125
ÂÂÎÄ, ÓÄÀËÅÍÈÅ È ÈÇÌÅÍÅÍÈÅ ÇÍÀ×ÅÍÈÉ ÏÎËÅÉ........................................................... 127
ÊÎÌÀÍÄÛ ÌÎÄÈÔÈÊÀÖÈÈ ßÇÛÊÀ DML............................................................................................................................... 128
ÂÂÎÄ ÇÍÀ×ÅÍÈÉ....................................................................................................................................................................... 128
ÂÑÒÀÂÊÀ ÏÓÑÒÛÕ ÓÊÀÇÀÒÅËÅÉ (NULL)............................................................................................................................... 128
ÈÌÅÍÎÂÀÍÈÅ ÑÒÎËÁÖÀ ÄËß ÂÑÒÀÂÊÈ (INSERT) ............................................................................................................. 129
ÂÑÒÀÂÊÀ ÐÅÇÓËÜÒÀÒÎÂ ÇÀÏÐÎÑÀ....................................................................................................................................... 129
ÈÇÌÅÍÅÍÈÅ ÇÍÀ×ÅÍÈÉ ÏÎËß.............................................................................................................................................. 131
ÌÎÄÈÔÈÖÈÐÎÂÀÍÈÅ ÒÎËÜÊÎ ÎÏÐÅÄÅËÅÍÍÛÕ ÑÒÐÎÊ................................................................................................. 131
ÊÎÌÀÍÄÀ UPDATE ÄËß ÌÍÎÃÈÕ ÑÒÎËÁÖÎÂ ..................................................................................................................... 131
ÈÑÏÎËÜÇÎÂÀÍÈÅ ÂÛÐÀÆÅÍÈÉ ÄËß ÌÎÄÈÔÈÊÀÖÈÈ..................................................................................................... 131
ÌÎÄÈÔÈÖÈÐÎÂÀÍÈÅ ÏÓÑÒÛÕ(NULL) ÇÍÀ×ÅÍÈÉ............................................................................................................. 132
ÐÅÇÞÌÅ...................................................................................................................................................................................... 132
ÐÀÁÎÒÀ Ñ SQL........................................................................................................................................................................... 133
ÈÑÏÎËÜÇÎÂÀÍÈÅ ÏÎÄÇÀÏÐÎÑÎÂ Ñ ÊÎÌÀÍÄÀÌÈ ÌÎÄÈÔÈÊÀÖÈÈ................................. 134
ÈÑÏÎËÜÇÎÂÀÍÈÅ ÏÎÄÇÀÏÐÎÑÎÂ Ñ INSERT..................................................................................................................... 135
ÍÅ ÂÑÒÀÂËßÉÒÅ ÄÓÁËÈÊÀÒÛ ÑÒÐÎÊ .................................................................................................................................. 136
ÈÑÏÎËÜÇÎÂÀÍÈÅ ÏÎÄÇÀÏÐÎÑÎÂ, ÑÎÇÄÀÍÛÕ ÂÎ ÂÍÅØÍÅÉ ÒÀÁËÈÖÅ ÇÀÏÐÎÑÀ................................................. 136
ÈÑÏÎËÜÇÎÂÀÍÈÅ ÏÎÄÇÀÏÐÎÑÎÂ Ñ DELETE.................................................................................................................... 137
ÈÑÏÎËÜÇÎÂÀÍÈÅ ÏÎÄÇÀÏÐÎÑÎÂ Ñ UPDATE................................................................................................................... 139
ÑÒÎËÊÍÎÂÅÍÈÅ Ñ ÎÃÐÀÍÈ×ÅÍÈßÌÈ ÏÎÄÇÀÏÐÎÑΠÊÎÌÀÍÄÛ DML....................................................................... 139
ÐÅÇÞÌÅ...................................................................................................................................................................................... 140
ÐÀÁÎÒÀ Ñ SQL........................................................................................................................................................................... 140
ÑÎÇÄÀÍÈÅ ÒÀÁËÈÖ................................................................................................................... 141
ÊÎÌÀÍÄÀ ÑÎÇÄÀÍÈß ÒÀÁËÈÖÛ ........................................................................................................................................... 142
ÈÍÄÅÊÑÛ.................................................................................................................................................................................... 143
ÓÍÈÊÀËÜÍÎÑÒÜ ÈÍÄÅÊÑÀ...................................................................................................................................................... 144
ÓÄÀËÅÍÈÅ ÈÍÄÅÊÑÎÂ............................................................................................................................................................. 144
ÈÇÌÅÍÅÍÈÅ ÒÀÁËÈÖÛ ÏÎÑËÅ ÒÎÃÎ, ÊÀÊ ÎÍÀ ÁÛËÀ ÑÎÇÄÀÍÀ................................................................................... 145
ÓÄÀËÅÍÈÅ ÒÀÁËÈÖ .................................................................................................................................................................. 145
ÐÅÇÞÌÅ...................................................................................................................................................................................... 146
ÐÀÁÎÒÀ Ñ SQL........................................................................................................................................................................... 146
ÎÃÐÀÍÈ×ÅÍÈÅ ÇÍÀ×ÅÍÈÉ ÂÀØÈÕ ÄÀÍÍÛÕ ........................................................................ 147
ÎÃÐÀÍÈ×ÅÍÈÅ ÒÀÁËÈÖ .......................................................................................................................................................... 148
ÎÁÚßÂËÅÍÈÅ ÎÃÐÀÍÈ×ÅÍÈÉ............................................................................................................................................... 148
ÈÑÏÎËÜÇÎÂÀÍÈÅ ÎÃÐÀÍÈ×ÅÍÈÉ ÄËß ÈÑÊËÞ×ÅÍÈß ÏÓÑÒÛÕ (NULL) ÓÊÀÇÀÒÅËÅÉ ............................................. 148
ÓÁÅÄÈÒÅÑÜ, ×ÒÎ ÇÍÀ×ÅÍÈß ÓÍÈÊÀËÜÍÛ......................................................................................................................... 149
ÓÍÈÊÀËÜÍÎÑÒÜ ÊÀÊ ÎÃÐÀÍÈ×ÅÍÈÅ ÑÒÎËÁÖÀ................................................................................................................. 149
ÓÍÈÊÀËÜÍÎÑÒÜ ÊÀÊ ÎÃÐÀÍÈ×ÅÍÈÅ ÒÀÁËÈÖÛ ................................................................................................................ 150
ÎÃÐÀÍÈ×ÅÍÈÅ ÏÅÐÂÈ×ÍÛÕ ÊËÞ×ÅÉ................................................................................................................................. 151
ÏÅÐÂÈ×ÍÛÅ ÊËÞ×È ÁÎËÅÅ ×ÅÌ ÎÄÍÎÃÎ ÏÎËß ............................................................................................................. 152
ÏÐÎÂÅÐÊÀ ÇÍÀ×ÅÍÈÉ ÏÎËÅÉ............................................................................................................................................... 152
ÈÑÏÎËÜÇÎÂÀÍÈÅ CHECK, ×ÒÎÁÛ ÏÐÅÄÎÏÐÅÄÅËßÒÜ ÄÎÏÓÑÒÈÌÎÅ ÂÂÎÄÈÌÎÅ ÇÍÀ×ÅÍÈÅ............................. 153
ÏÐÎÂÅÐÊÀ ÓÑËÎÂÈÉ, ÁÀÇÈÐÓÞÙÈÉÑß ÍÀ ÌÍÎÃÎ×ÈÑËÅÍÛÕ ÏÎËßÕ ..................................................................... 154
ÓÑÒÀÍÎÂÊÀ ÇÍÀ×ÅÍÈÉ ÏÎÓÌÎË×ÀÍÈÞ ........................................................................................................................... 154
ÐÅÇÞÌÅ...................................................................................................................................................................................... 156
ÐÀÁÎÒÀ Ñ SQL........................................................................................................................................................................... 156
ÏÎÄÄÅÐÆÊÀ ÖÅËÎÑÒÍÎÑÒÈ ÂÀØÈÕ ÄÀÍÍÛÕ..................................................................... 157
ÂÍÅØÍÈÉ ÊËÞ× È ÐÎÄÈÒÅËÜÑÊÈÉ ÊËÞ×......................................................................................................................... 158
ÌÍÎÃÎ-ÑÒÎËÁÖÎÂÛÅ ÂÍÅØÍÈÅ ÊËÞ×È........................................................................................................................... 158
ÑÌÛÑË ÂÍÅØÍÅÃÎ È ÐÎÄÈÒÅËÜÑÊÎÃÎ ÊËÞ×ÅÉ............................................................................................................ 159
ÎÃÐÀÍÈ×ÅÍÈÅ FOREIGN KEY................................................................................................................................................ 159
ÊÀÊ ÌÎÆÍÎ ÏÎËß ÏÐÅÄÑÒÀÂÈÒÜ Â ÊÀ×ÅÑÒÂÅ ÂÍÅØÍÈÕ ÊËÞ×ÅÉ............................................................................ 159
ÂÍÅØÍÈÉ ÊËÞ× ÊÀÊ ÎÃÐÀÍÈ×ÅÍÈÅ ÒÀÁËÈÖÛ................................................................................................................ 160
ÂÍÅØÍÈÉ ÊËÞ× ÊÀÊ ÎÃÐÀÍÈ×ÅÍÈÅ ÑÒÎËÁÖΠ............................................................................................................. 161
ÍÅ ÓÊÀÇÛÂÀÒÜ ÑÏÈÑÎÊ ÑÒÎËÁÖΠÏÅÐÂÈ×ÍÛÕ ÊËÞ×ÅÉ........................................................................................... 161
ÊÀÊ ÑÏÐÀÂÎ×ÍÀß ÖÅËÎÑÒÍÎÑÒÜ ÎÃÐÀÍÈ×ÈÂÀÅÒ ÇÍÀ×ÅÍÈß ÐÎÄÈÒÅËÜÑÊÎÃÎ ÊËÞ×À ................................... 161
ÏÅÐÂÈ×ÍÛÉ ÊËÞ× ÊÀÊ ÓÍÈÊÀËÜÍÛÉ ÂÍÅØÍÈÉ ÊËÞ×................................................................................................. 162
ÎÃÐÀÍÈ×ÅÍÈß ÂÍÅØÍÅÃÎ ÊËÞ×À...................................................................................................................................... 162
×ÒÎ ÑËÓ×ÈÒÑß, ÅÑËÈ ÂÛ ÂÛÏÎËÍÈÒÅ ÊÎÌÀÍÄÓ ÌÎÄÈÔÈÊÀÖÈÈ............................................................................. 162
ÂÊËÞ×ÅÍÈÅ ÎÏÈÑÀÍÈÉ ÒÀÁËÈÖÛ ..................................................................................................................................... 163
ÄÅÉÑÒÂÈÅ ÎÃÐÀÍÈ×ÅÍÈÉ..................................................................................................................................................... 164
ÂÍÅØÍÈÅ ÊËÞ×È, ÊÎÒÎÐÛÅ ÑÑÛËÀÞÒÑß ÎÁÐÀÒÍÎ Ê ÈÕ ÏÎÄ×ÈÍÅÍÛÌ ÒÀÁËÈÖÀÌ ......................................... 166
ÐÅÇÞÌÅ...................................................................................................................................................................................... 167
ÐÀÁÎÒÀ Ñ SQL........................................................................................................................................................................... 168
ÂÂÅÄÅÍÈÅ: ÏÐÅÄÑÒÀÂËÅÍÈß................................................................................................. 169
×ÒÎ ÒÀÊÎÅ ÏÐÅÄÑÒÀÂËÅÍÈÅ?.............................................................................................................................................. 170
ÊÎÌÀÍÄÀ CREATE VIEW ......................................................................................................................................................... 170
ÌÎÄÈÔÈÖÈÐÎÂÀÍÈÅ ÏÐÅÄÑÒÀÂËÅÍÈÉ............................................................................................................................. 172
ÈÌÅÍÎÂÀÍÈÅ ÑÒÎËÁÖÎÂ...................................................................................................................................................... 172
ÊÎÌÁÈÍÈÐÎÂÀÍÈÅ ÏÐÅÄÈÊÀÒÎÂ ÏÐÅÄÑÒÀÂËÅÍÈÉ È ÎÑÍÎÂÍÛÕ ÇÀÏÐÎÑÎÂ Â ÏÐÅÄÑÒÀÂËÅÍÈßÕ .............. 172
ÃÐÓÏÏÎÂÛÅ ÏÐÅÄÑÒÀÂËÅÍÈß............................................................................................................................................. 173
ÏÐÅÄÑÒÀÂËÅÍÈß È ÎÁÜÅÄÈÍÅÍÈß .................................................................................................................................... 174
ÏÐÅÄÑÒÀÂËÅÍÈß È ÏÎÄÇÀÏÐÎÑÛ...................................................................................................................................... 175
×ÒÎ ÍÅ ÌÎÃÓÒ ÄÅËÀÒÜ ÏÐÅÄÑÒÀÂËÅÍÈß ......................................................................................................................... 176
ÓÄÀËÅÍÈÅ ÏÐÅÄÑÒÀÂËÅÍÈÉ ................................................................................................................................................ 176
ÐÅÇÞÌÅ...................................................................................................................................................................................... 177
ÐÀÁÎÒÀ Ñ SQL........................................................................................................................................................................... 177
ÈÇÌÅÍÅÍÈÅ ÇÍÀ×ÅÍÈÉ Ñ ÏÎÌÎÙÜÞ ÏÐÅÄÑÒÀÂËÅÍÈÉ .................................................. 178
ÌÎÄÈÔÈÖÈÐÎÂÀÍÈÅ ÏÐÅÄÑÒÀÂËÅÍÈß............................................................................................................................. 179
ÎÏÐÅÄÅËÅÍÈÅ ÌÎÄÈÔÈÖÈÐÓÅÌÎÑÒÈ ÏÐÅÄÑÒÀÂËÅÍÈß............................................................................................. 180
ÌÎÄÈÔÈÖÈÐÓÅÌÛÅ ÏÐÅÄÑÒÀÂËÅÍÈß È ÏÐÅÄÑÒÀÂËÅÍÈß ÒÎËÜÊÎ_×ÒÅÍÈÅ........................................................ 181
×ÒÎ ßÂËßÅÒÑß ÌÎÄÈÔÈÖÈÐÓÅÌÛÌ ÏÐÅÄÑÒÀÂËÅÍÈÅÌ............................................................................................. 182
ÏÐÎÂÅÐÊÀ ÇÍÀ×ÅÍÈÉ, ÏÎÌÅÙÀÅÌÛÕ Â ÏÐÅÄÑÒÀÂËÅÍÈÅ.......................................................................................... 182
ÏÐÅÄÈÊÀÒÛ È ÈÑÊËÞ×ÅÍÍÛÅ ÏÎËß.................................................................................................................................. 183
ÏÐÎÂÅÐÊÀ ÏÐÅÄÑÒÀÂËÅÍÈÉ, ÊÎÒÎÐÛÅ ÁÀÇÈÐÓÞÒÑß ÍÀ ÄÐÓÃÈÕ ÏÐÅÄÑÒÀÂËÅÍÈßÕ........................................ 184
ÐÅÇÞÌÅ...................................................................................................................................................................................... 185
ÐÀÁÎÒÀ Ñ SQL........................................................................................................................................................................... 186
ÊÒÎ ×ÒÎ ÌÎÆÅÒ ÄÅËÀÒÜ Â ÁÀÇÅ ÄÀÍÍÛÕ .......................................................................... 188
ÏÎËÜÇÎÂÀÒÅËÈ........................................................................................................................................................................ 189
ÐÅÃÈÑÒÐÀÖÈß........................................................................................................................................................................... 189
ÏÐÅÄÎÑÒÀÂËÅÍÈÅ ÏÐÈÂÈËÅÃÈÉ......................................................................................................................................... 189
ÑÒÀÍÄÀÐÒÍÛÅ ÏÐÈÂÈËÅÃÈÈ................................................................................................................................................ 190
ÊÎÌÀÍÄÀ GRANT...................................................................................................................................................................... 190
ÃÐÓÏÏÛ ÏÐÈÂÅËÅÃÈÉ, ÃÐÓÏÏÛ ÏÎËÜÇÎÂÀÒÅËÅÉ.......................................................................................................... 191
ÎÃÐÀÍÈ×ÅÍÈÅ ÏÐÈÂÈËÅÃÈÉ ÍÀ ÎÏÐÅÄÅËÅÍÍÛÅ ÑÒÎËÁÖÛ ...................................................................................... 191
ÈÑÏÎËÜÇÎÂÀÍÈÅ ÀÐÃÓÌÅÍÒÎÂ ALL È PUBLIC................................................................................................................. 192
ÏÐÅÄÎÑÒÀÂËÅÍÈÅ ÏÐÈÂÅËÅÃÈÉ Ñ ÏÎÌÎÙÜÞ WITH GRANT OPTION....................................................................... 193
ÎÒÌÅÍÀ ÏÐÈÂÈËÅÃÈÉ............................................................................................................................................................ 194
ÈÑÏÎËÜÇÎÂÀÍÈÅ ÏÐÅÄÑÒÀÂËÅÍÈÉ ÄËß ÔÈËÜÒÐÀÖÈÈ ÏÐÈÂÅËÅÃÈÉ...................................................................... 194
ÊÒÎ ÌÎÆÅÒ ÑÎÇÄÀÂÀÒÜ ÏÐÅÄÑÒÀÂËÅÍÈß?..................................................................................................................... 194
ÎÃÐÀÍÈ×ÅÍÈÅ ÏÐÈÂÈËÅÃÈÈ SELECT ÄËß ÎÏÐÅÄÅËÅÍÍÛÕ ÑÒÎËÁÖÎÂ................................................................... 195
ÎÃÐÀÍÈ×ÅÍÈÅ ÏÐÈÂÅËÅÃÈÉ ÄËß ÎÏÐÅÄÅËÅÍÍÛÕ ÑÒÐÎÊ .......................................................................................... 195
ÏÐÅÄÎÑÒÀÂËÅÍÈÅ ÄÎÑÒÓÏÀ ÒÎËÜÊÎ Ê ÈÇÂËÅ×ÅÍÍÛÌ ÄÀÍÍÛÌ.............................................................................. 196
ÈÑÏÎËÜÇÎÂÀÍÈÅ ÏÐÅÄÑÒÀÂËÅÍÈÉ Â ÊÀ×ÅÑÒÂÅ ÀËÜÒÅÐÍÀÒÈÂÛ Ê ÎÃÐÀÍÈ×ÅÍÈßÌ......................................... 196
ÄÐÓÃÈÅ ÒÈÏÛ ÏÐÈÂÈËÅÃÈÉ.................................................................................................................................................. 197
ÒÈÏÈ×ÍÛÅ ÏÐÈÂÈËÅÃÈÈ ÑÈÑÒÅÌÛ................................................................................................................................... 197
ÑÎÇÄÀÍÈÅ È ÓÄÀËÅÍÈÅ ÏÎËÜÇÎÂÀÒÅËÅÉ ....................................................................................................................... 198
ÐÅÇÞÌÅ...................................................................................................................................................................................... 199
ÐÀÁÎÒÀ Ñ SQL........................................................................................................................................................................... 199
ÃËÎÁÀËÜÍÛÅ ÀÑÏÅÊÒÛ SQL .................................................................................................. 200
ÏÅÐÅÈÌÅÍÎÂÀÍÈÅ ÒÀÁËÈÖ.................................................................................................................................................. 201
ÏÅÐÅÈÌÅÍÎÂÀÍÈÅ Ñ ÒÅÌ ÆÅ ÑÀÌÛÌ ÈÌÅÍÅÌ.............................................................................................................. 201
ÎÄÍÎ ÈÌß ÄËß ÊÀÆÄÎÃÎ...................................................................................................................................................... 202
ÓÄÀËÅÍÈÅ ÑÈÍÎÍÈÌÎÂ......................................................................................................................................................... 202
ÊÀÊ ÁÀÇÀ ÄÀÍÍÛÕ ÐÀÑÏÐÅÄÅËÅÍÀ ÄËß ÏÎËÜÇÎÂÀÒÅËÅÉ?......................................................................................... 202
ÊÎÃÄÀ ÑÄÅËÀÍÍÛÅ ÈÇÌÅÍÅÍÈß ÑÒÀÍÎÂßÒÑß ÏÎÑÒÎßÍÍÛÌÈ?............................................................................. 204
ÊÀÊ SQL ÎÁÙÀÅÒÑß ÑÐÀÇÓ ÑÎ ÌÍÎÃÈÌÈ ÏÎËÜÇÎÂÀÒÅËßÌÈ .................................................................................... 205
ÒÈÏÛ ÁËÎÊÈÐÎÂÎÊ................................................................................................................................................................. 207
ÄÐÓÃÈÅ ÑÏÎÑÎÁÛ ÁËÎÊÈÐÎÂÊÈ ÄÀÍÍÛÕ......................................................................................................................... 208
ÐÅÇÞÌÅ...................................................................................................................................................................................... 209
ÐÀÁÎÒÀ Ñ SQL........................................................................................................................................................................... 209
ÊÀÊ ÄÀÍÍÛÅ SQL ÑÎÄÅÐÆÀÒÑß Â ÓÏÎÐßÄÎ×ÅÍÍÎÌ ÂÈÄÅ............................................ 210
ÊÀÒÀËÎÃ ÑÈÑÒÅÌÛ ................................................................................................................................................................. 211
ÒÈÏÈ×ÍÛÉ ÑÈÑÒÅÌÍÛÉ ÊÀÒÀËÎÃ...................................................................................................................................... 211
ÈÑÏÎËÜÇÎÂÀÍÈÅ ÏÐÅÄÑÒÀÂËÅÍÈÉ Â ÒÀÁËÈÖÀÕ ÊÀÒÀËÎÃÀ....................................................................................... 213
ÐÀÇÐÅØÈÒÜ ÏÎËÜÇÎÂÀÒÅËßÌ ÂÈÄÅÒÜ (ÒÎËÜÊÎ) ÈÕ ÑÎÁÑÒÂÅÍÍÛÅ ÎÁÚÅÊÒÛ.................................................... 213
ÊÎÌÌÅÍÒÀÐÈÉ Â ÑÎÄÅÐÆÀÍÈÈ ÊÀÒÀËÎÃÀ...................................................................................................................... 214
ÎÑÒÀËÜÍÎÅ ÈÇ ÊÀÒÀËÎÃÀ..................................................................................................................................................... 216
ÄÐÓÃÎÅ ÈÑÏÎËÜÇÎÂÀÍÈÅ ÊÀÒÀËÎÃÀ................................................................................................................................. 220
ÐÅÇÞÌÅ...................................................................................................................................................................................... 221
ÐÀÁÎÒÀ Ñ SQL........................................................................................................................................................................... 221
ÈÑÏÎËÜÇÎÂÀÍÈÅ SQL Ñ ÄÐÓÃÈÌ ßÇÛÊÎÌ (ÂËÎÆÅÍÍÛÉ SQL) ...................................... 222
×ÒÎ ÒÀÊÎÅ ÂËÎÆÅÍÈÅ SQL................................................................................................................................................... 223
ÇÀ×ÅÌ ÂÊËÀÄÛÂÀÒÜ SQL? ..................................................................................................................................................... 223
ÊÀÊ ÄÅËÀÞÒÑß ÂËÎÆÅÍÈß SQL .......................................................................................................................................... 224
ÈÑÏÎËÜÇÎÂÀÍÈÅ ÏÅÐÅÌÅÍÍÛÕ ÎÑÍÎÂÍÎÃÎ ßÇÛÊÀ  SQL....................................................................................... 224
ÎÁÚßÂËÅÍÈÅ ÏÅÐÅÌÅÍÍÛÕ................................................................................................................................................. 226
ÈÇÂËÅ×ÅÍÈÅ ÇÍÀ×ÅÍÈÉ ÏÅÐÅÌÅÍÍÛÕ............................................................................................................................. 226
ÊÓÐÑÎÐ....................................................................................................................................................................................... 227
SQL ÊÎÄÛ................................................................................................................................................................................... 229
ÈÑÏÎËÜÇÎÂÀÍÈÅ SQLCODE ÄËß ÓÏÐÀÂËÅÍÈß ÖÈÊËÀÌÈ............................................................................................ 230
ÏÐÅÄËÎÆÅÍÈÅ WHENEVER................................................................................................................................................... 230
ÌÎÄÈÔÈÖÈÐÎÂÀÍÈÅ ÊÓÐÑÎÐÎÂ......................................................................................................................................... 231
ÏÅÐÅÌÅÍÍÀß INDICATOR....................................................................................................................................................... 233
ÈÑÏÎËÜÇÎÂÀÍÈÅ ÏÅÐÅÌÅÍÍÎÉ INDICATOR ÄËß ÝÌÓËßÖÈÈ NULL ÇÍÀ×ÅÍÈÉ SQL ............................................. 234
ÄÐÓÃÎÅ ÈÑÏÎËÜÇÎÂÀÍÈÅ ÏÅÐÅÌÅÍÍÎÉ INDICATOR .................................................................................................... 235
ÐÅÇÞÌÅ...................................................................................................................................................................................... 235
ÐÀÁÎÒÀ Ñ SQL........................................................................................................................................................................... 236
ÎÒÂÅÒÛ ÄËß ÓÏÐÀÆÍÅÍÈÉ..................................................................................................... 238
Ãëàâà 1 ......................................................................................................................................................................................... 239
Ãëàâà 2 ......................................................................................................................................................................................... 239
Ãëàâà 3 ......................................................................................................................................................................................... 239
Ãëàâà 4 ......................................................................................................................................................................................... 239
Ãëàâà 5 ......................................................................................................................................................................................... 241
Ãëàâà 6 ......................................................................................................................................................................................... 241
Ãëàâà 7 ......................................................................................................................................................................................... 242
Ãëàâà 8 ......................................................................................................................................................................................... 243
Ãëàâà 9 ......................................................................................................................................................................................... 243
Ãëàâà 10 ....................................................................................................................................................................................... 244
Ãëàâà 11 ....................................................................................................................................................................................... 244
Ãëàâà 12 ....................................................................................................................................................................................... 245
Ãëàâà 13 ....................................................................................................................................................................................... 245
Ãëàâà 14 ....................................................................................................................................................................................... 246
Ãëàâà 15 ....................................................................................................................................................................................... 247
Ãëàâà 16 ....................................................................................................................................................................................... 248
Ãëàâà 17 ....................................................................................................................................................................................... 248
Ãëàâà 18 ....................................................................................................................................................................................... 249
Ãëàâà 19 ....................................................................................................................................................................................... 249
Ãëàâà 20 ....................................................................................................................................................................................... 250
Ãëàâà 21 ....................................................................................................................................................................................... 250
Ãëàâà 22 ....................................................................................................................................................................................... 251
Ãëàâà 23 ....................................................................................................................................................................................... 252
Ãëàâà 24 ....................................................................................................................................................................................... 252
Ãëàâà 25 ....................................................................................................................................................................................... 253
ÒÈÏÛ ÄÀÍÍÛÕ Â SQL ............................................................................................................... 257
ÒÈÏÛ ANSI.................................................................................................................................................................................. 258
ÝÊÂÈÂÀËÅÍÒÍÛÅ ÒÈÏÛ ÄÀÍÍÛÕ Â ÄÐÓÃÈÕ ßÇÛÊÀÕ...................................................................................................... 259
ÍÅÊÎÒÎÐÛÅ ÎÁÙÈÅ ÍÅÑÒÀÍÄÀÐÒÍÛÅ ÑÐÅÄÑÒÂÀ SQL................................................... 261
ÒÈÏÛ ÄÀÍÍÛÕ .......................................................................................................................................................................... 262
ÊÎÌÀÍÄÀ FORMAT.................................................................................................................................................................... 263
ÔÓÍÊÖÈÈ.................................................................................................................................................................................... 265
INTERSECT È MINUS................................................................................................................................................................. 266
ÀÂÒÎÌÀÒÈ×ÅÑÊÈÅ ÂÍÅØÍÈÅ ÎÁÜÅÄÈÍÅÍÈß.................................................................................................................. 267
ÎÒÑËÅÆÈÂÀÍÈÅ ÄÅÉÑÒÂÈÉ ................................................................................................................................................. 268
ÑÏÐÀÂÎ×ÍÈÊ ÏÎ ÊÎÌÀÍÄÀÌ È ÑÈÍÒÀÊÑÈÑÓ ..................................................................... 269
SQL ÝËÅÌÅÍÒÛ......................................................................................................................................................................... 270
SQL ÊÎÌÀÍÄÛ........................................................................................................................................................................... 275
ÒÀÁËÈÖÛ, ÈÑÏÎËÜÇÓÅÌÛÅ Â SQL.......................................................................................... 282
Ñêðèíøîòû:
Âðåìÿ ðàçäà÷è: Ïî âîçìîæíîñòè! (äî ïîÿâëåíèÿ ïåðâûõ 3-5 ñêà÷àâøèõ)