|
Ïðîãðàììèðîâàíèå >> Ïîíÿòèå sql
ÎÃÐÀÍÈ×ÅÍÈÅ ÏÅÐÂÈ×ÍÛÕ ÊËÞ×ÅÉ.................................................................................................................................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
|
© 2006 - 2024 pmbk.ru. Ãåíåðàöèÿ ñòðàíèöû: 0.001
Ïðè êîïèðîâàíèè ìàòåðèàëîâ ïðèâåòñòâóþòñÿ ññûëêè. |