sqlÖÐɾ³ýÒ»ÁеÄÏÂÁî
ÔÚ sql ÖУ¬Ê¹Óà alter table Óï¾ä¿ÉÒÔɾ³ýÒ»ÁУ¬Ó﷨Ϊ£ºalter table table_name drop column column_name;°ì·¨°üÀ¨£º¢Ù Ö¸¶¨ÒªÉ¾³ýÁеıíÃû£»¢Ú ʹÓà drop column ×Ó¾äÖ¸¶¨ÒªÉ¾³ýµÄÁÐÃû£»¢Û Ö´ÐÐÓï¾ä¡£ÀýÈ磬ɾ³ý±í customers ÖÐµÄ email ÁУ¬Óï¾äΪ£ºalter table customers drop column email;ɾ³ýÒ»ÁÐÊDz»¿ÉÄæ²Ù×÷£¬¿ÉÄÜ»áÓ°ÏìÆäËûÁеÄÔ¼ÊøºÍË÷Òý¡£
SQL ÖÐɾ³ýÒ»ÁеÄÏÂÁî
ÔÚ SQL ÖУ¬¿ÉÒÔͨ¹ý ALTER TABLE Óï¾äÀ´É¾³ý±íÖеÄÒ»ÁС£¸ÃÓï¾äµÄÓï·¨ÈçÏ£º
ALTER TABLE table_name DROP COLUMN column_name;
µÇ¼ºó¸´ÖÆ
ÆäÖУ¬table_name ÊÇҪɾ³ýÁеıíÃû£¬column_name ÊÇҪɾ³ýµÄÁÐÃû¡£
°ì·¨£º
Ö¸¶¨ÒªÉ¾³ýÁÐµÄ±í£ºÔÚ ALTER TABLE Óï¾äÖÐÖ¸¶¨ÒªÉ¾³ýÁеıíÃû¡£
Ö¸¶¨ÒªÉ¾³ýµÄÁУºÊ¹Óà DROP COLUMN ×Ó¾äÖ¸¶¨ÒªÉ¾³ýµÄÁÐÃû¡£
Ö´ÐÐÓï¾ä£ºÖ´ÐÐ ALTER TABLE Óï¾äÒÔɾ³ýÁС£
ʾÀý£º
ÒÔÏÂʾÀýɾ³ý customers ±íÖÐµÄ email ÁУº
ALTER TABLE customers DROP COLUMN email;
µÇ¼ºó¸´ÖÆ
×¢ÖØÊÂÏ
ɾ³ýÒ»ÁÐÊDz»¿ÉÄæµÄ²Ù×÷¡£Ò»µ©É¾³ý£¬¸ÃÁм°ÆäÖеÄÊý¾Ý½«ÓÀÊÀɥʧ¡£
ɾ³ýÒ»ÁпÉÄÜ»áÓ°Ïì±íÖÐÆäËûÁеÄÔ¼ÊøºÍË÷Òý¡£ÈôÊDZ£´æÒÀÀµÓÚ¸ÃÁеÄÍâ¼ü»òΨһ¼üÔ¼Êø£¬ÔòÔÚɾ³ý¸ÃÁÐ֮ǰÐèÒªÏÈɾ³ýÕâЩԼÊø¡£
ÒÔÉϾÍÊÇsqlÖÐɾ³ýÒ»ÁеÄÏÂÁîµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡