sqlÖÐdropʲôÒâ˼
sql ÖÐµÄ drop ÏÂÁîÓÃÓÚɾ³ýÊý¾Ý¿â¹¤¾ß£¨ÀýÈç±í¡¢ÊÓͼ¡¢Ë÷Òý£©£¬°üÀ¨ÒÔÏÂÓÃ;£ºÉ¾³ý²»ÔÙÐèÒª»ò¹ýʱµÄ¹¤¾ß¡£É¾³ý¹ýʧ»òË𻵵Ť¾ß¡£ÐÞ¸ÄÊý¾Ý¿â½á¹¹¡£
SQL ÖÐ DROP µÄ¼ÄÒå
DROP ÊÇ SQL ÖÐÓÃÓÚɾ³ýÊý¾Ý¿â¹¤¾ß£¨Èç±í¡¢ÊÓͼ¡¢Ë÷Òý£©µÄÏÂÁî¡£
ÓÃ;
DROP ÏÂÁîÖ÷ÒªÓÃÓÚÒÔÏÂÇéÐΣº
ɾ³ý²»ÔÙÐèÒª»ò¹ýʱµÄ¹¤¾ß¡£
ɾ³ý¹ýʧ»òË𻵵Ť¾ß¡£
ÐÞ¸ÄÊý¾Ý¿â½á¹¹¡£
Óï·¨
DROP ÏÂÁîµÄÓï·¨ÈçÏ£º
DROP [OPTION] <object_type><object_name>;</object_name></object_type>
µÇ¼ºó¸´ÖÆ
ÆäÖУº
OPTION ¿ÉÑ¡£¬Ö¸¶¨É¾³ý²Ù×÷µÄÐÐΪ¡£ÀýÈ磬CASCADE ÓÃÓÚ¼¶ÁªÉ¾³ýÏà¹Ø¹¤¾ß¡£
Ö¸¶¨ÒªÉ¾³ýµÄ¹¤¾ßÀàÐÍ£¬ÀýÈç TABLE¡¢VIEW¡¢INDEX¡£
Ö¸¶¨ÒªÉ¾³ýµÄ¹¤¾ßµÄÃû³Æ¡£
×¢ÖØÊÂÏî
DROP ²Ù×÷ÊDz»¿ÉÄæµÄ£¬Òò´ËÉóÉ÷ʹÓá£
ÔÚɾ³ý±í֮ǰ£¬È·±£±¸·ÝÊý¾Ý¡£
ÈôÊÇҪɾ³ýÓëÆäËû¹¤¾ßÏà¹ØÁªµÄ±í£¬ÇëʹÓà CASCADE Ñ¡Ïî¡£
ÈôÊǹ¤¾ß²»±£´æ£¬DROP ÏÂÁ±¬·¢¹ýʧ¡£
ʾÀý
ɾ³ýÃûΪ customers µÄ±í£º
DROP TABLE customers;
µÇ¼ºó¸´ÖÆ
ɾ³ýÃûΪ customer_index µÄË÷Òý£º
DROP INDEX customer_index;
µÇ¼ºó¸´ÖÆ
ɾ³ýÃûΪ my_view µÄÊÓͼ£º
DROP VIEW my_view;
µÇ¼ºó¸´ÖÆ
ÒÔÉϾÍÊÇsqlÖÐdropʲôÒâ˼µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡