×ðÁú¿­Ê±¹ÙÍøµÇ¼

sqlÖÐÐ޸ıíµÄÏÂÁî

sql ÖÐÐ޸ıíµÄÏÂÁîÓУºalter table£ºÖ´ÐÐÖÖÖÖÐ޸ıí²Ù×÷¡£add column£ºÌí¼ÓÐÂÁС£drop column£ºÉ¾³ýÁС£modify column£ºÐÞ¸ÄÁеÄÀàÐÍ¡¢Ô¼Êø»òĬÈÏÖµ¡£rename column£ºÖØÃüÃûÁС£add primary key£ºÌí¼ÓÖ÷¼üÔ¼Êø¡£add foreign key£ºÌí¼ÓÍâ¼üÔ¼Êø¡£alter table rename to£ºÖØÃüÃû±í¡£

SQL ÖÐÐ޸ıíµÄÏÂÁî

Ð޸ıíµÄÏÂÁîÊÇ SQL ÖÐÓÃÓÚ¸ü¸Ä±í½á¹¹µÄÏÂÁî¡£ÕâЩÏÂÁîÔÊÐíÄúÌí¼Ó¡¢É¾³ý»òÐ޸ıíÖеÄÁУ¬¸ü¸ÄÔ¼Êø£¬»òÖØÃüÃû±í¡£

Ö÷ÒªÏÂÁî

×î³£ÓõÄÐ޸ıíÏÂÁî°üÀ¨£º

ALTER TABLE£ºÓÃÓÚÖ´ÐÐÖÖÖÖÐ޸ıí²Ù×÷¡£

ADD COLUMN£ºÌí¼ÓÐÂÁС£

DROP COLUMN£ºÉ¾³ýÁС£

MODIFY COLUMN£ºÐÞ¸ÄÁеÄÀàÐÍ¡¢Ô¼Êø»òĬÈÏÖµ¡£

RENAME COLUMN£ºÖØÃüÃûÁС£

ADD PRIMARY KEY£ºÌí¼ÓÖ÷¼üÔ¼Êø¡£

ADD FOREIGN KEY£ºÌí¼ÓÍâ¼üÔ¼Êø¡£

ALTER TABLE RENAME TO£ºÖØÃüÃû±í¡£

ʹÓÃÒªÁì

Ð޸ıíÏÂÁîµÄ»ù±¾Ó﷨Ϊ£º

ALTER TABLE [±íÃû] [Ð޸IJÙ×÷];

µÇ¼ºó¸´ÖÆ

ÀýÈ磬ҪÌí¼ÓÒ»¸öÐÂÁÐ age µ½ users ±í£¬¿ÉÒÔÖ´ÐÐÒÔÏÂÏÂÁ

ALTER TABLE users ADD COLUMN age INT;

µÇ¼ºó¸´ÖÆ

Ҫɾ³ýÁÐ address£¬¿ÉÒÔÖ´ÐУº

ALTER TABLE users DROP COLUMN address;

µÇ¼ºó¸´ÖÆ

×¢ÖØÊÂÏî

Ô¼Êø²»¿ÉÎ¥·´£ºÐ޸ıíʱ£¬Äú²»¿ÉÎ¥·´ÏÖÓÐÔ¼Êø¡£ÀýÈ磬Äú²»¿Éɾ³ýÒýÓÃÏÖÓÐÍâ¼üÔ¼ÊøµÄÁС£

±¸·ÝÊý¾Ý£ºÔÚÖ´ÐÐÖØ´óÐ޸ıí²Ù×÷֮ǰ£¬Ê¼ÖÕ±¸·Ý±íÊý¾Ý¡£

Ëø±í£ºÔÚÖ´ÐÐijЩÐ޸ıí²Ù×÷ʱ£¬Êý¾Ý¿â¿ÉÄÜ»áËøס±í£¬×èÖ¹ÆäËûÓû§»á¼û¡£

ʹÓà WITH CHECK OPTION£ºÔÚÐ޸ıíÔ¼Êøʱ£¬Äú¿ÉÒÔʹÓà WITH CHECK OPTION À´Ç¿ÖÆÊý¾Ý¿â¼ì²éÏÖÓÐÊý¾ÝÊÇ·ñÖª×ãÐÂÔ¼Êø¡£

ÒÔÉϾÍÊÇsqlÖÐÐ޸ıíµÄÏÂÁîµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí£¬°æȨÕùÒéÓë±¾Õ¾Î޹أ¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í×ðÁú¿­Ê±¹ÙÍøµÇ¼ÂËÓÍ»úÍø¹Ù·½Ì¬¶È£¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ£¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢£¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢£¬ÇëÄúÁ¬Ã¦ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼ʵʱÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎ壬9:30-18:30£¬½ÚãåÈÕÐÝÏ¢

QR code
ÍøÕ¾µØͼ