Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

mysqlÖÐÓÃÃüÁîÐ޸ıí½á¹¹µÄ·½·¨

ALTER [IGNORE] TABLE tbl_name alter_spec [, alter_spec …]
alter_specification:
       ADD [COLUMN] create_definition [FIRST | AFTER column_name ]
   or ADD INDEX [index_name] (index_col_name,…)
   or ADD PRIMARY KEY (index_col_name,…)
   or ADD UNIQUE [index_name] (index_col_name,…)
   or ALTER [COLUMN] col_name {SET DEFAULT literal | DROP DEFAULT}
   or CHANGE [COLUMN] old_col_name create_definition
   or MODIFY [COLUMN] create_definition
   or DROP [COLUMN] col_name
   or DROP PRIMARY KEY
   or DROP INDEX index_name
   or RENAME [AS] new_tbl_name
   or table_options
ALTER TABLEÔÊÐíÄãÐÞ¸ÄÒ»¸öÏÖÓбíµÄ½á¹¹¡£ÀýÈ磬Äã¿ÉÒÔÔö¼Ó»òɾ³ýÁС¢´´Ôì»òÏûÈ¥Ë÷Òý¡¢¸Ä±äÏÖÓÐÁеÄÀàÐÍ¡¢»òÖØÐÂÃüÃûÁлò±í±¾Éí¡£ÄãÒ²Äܸıä±íµÄ×¢ÊͺͱíµÄÀàÐÍ¡£¼û7.7 CREATE TABLE¾ä·¨¡£
Èç¹ûÄãʹÓÃALTER TABLEÐÞ¸ÄÒ»¸öÁÐ˵Ã÷µ«ÊÇDESCRIBE tbl_nameÏÔʾÄãµÄÁв¢Ã»Óб»Ð޸ģ¬Õâ¿ÉÄÜÊÇMySQLÒòΪÔÚ7.7.1 Òþº¬µÄÁÐ˵Ã÷¸Ä±äÖÐÃèÊöµÄÔ­ÒòÖ®Ò»¶øºöÂÔÁËÄãµÄÐ޸ġ£ÀýÈ磬Èç¹ûÄãÊÔͼ½«Ò»¸öVARCHAR¸ÄΪCHAR£¬MySQL½«ÈÔȻʹÓÃVARCHAR£¬Èç¹û±í°ü º¬ÆäËû±ä³¤µÄÁС£
ALTER TABLEͨ¹ýÖÆ×÷Ô­À´±íµÄÒ»¸öÁÙʱ¸±±¾À´¹¤×÷¡£ÐÞ¸ÄÔÚ¸±±¾ÉÏÊ©ÐУ¬È»ºóÔ­À´µÄ±í±»É¾³ý²¢ÇÒÖØÐÂÃüÃûÒ»¸öеġ£ÕâÑù×öʹµÃËùÓеÄÐÞ¸Ä×Ô¶¯µØתÏòµ½ÐÂ±í£¬Ã» ÓÐÈκÎʧ°ÜµÄÐ޸ġ£µ±ALTER TABLEÕýÔÚÖ´ÐÐʱ£¬Ô­À´µÄ×À¿É±»ÆäËû¿Í»§¶ÁÈ¡¡£¸üкÍдÈë±í±»ÑÓ³Ùµ½Ð±í×¼±¸ºÃÁËΪֹ¡£
ΪÁËʹÓÃALTER TABLE£¬ÄãÐèÒªÔÚ±íÉϵÄselect¡¢insert¡¢delete¡¢update¡¢createºÍdropµÄȨÏÞ¡£
IGNOREÊÇMySQL¶ÔANSI SQL92 µÄÒ»¸öÀ©³ä£¬Èç¹ûÔÚбíÖеÄΨһ¼üÉÏÓÐÖظ´£¬Ëü¿ØÖÆALTER TABLEÈçºÎ¹¤×÷¡£Èç¹ûIGNOREû±»Ö¸¶¨£¬¸±±¾±»·ÅÆú²¢ÇÒ»Ö¸´Ô­×´¡£Èç¹ûIGNORE±»Ö¸¶¨£¬ÄÇô¶ÔΨһ¼üÓÐÖظ´µÄÐУ¬Ö»ÓÐʹÓõÚÒ»ÐУ»ÆäÓ౻ɾ³ý¡£
Äã¿ÉÒÔÔÚµ¥¸öALTER TABLEÓï¾äÖз¢³ö¶à¸öADD¡¢ALTER¡¢DROPºÍCHANGE×Ӿ䡣ÕâÊÇMySQL¶ÔANSI SQL92µÄÒ»¸öÀ©³ä£¬SQL92ÔÚÿ¸öALTER TABLEÓï¾äÖÐÖ»ÔÊÐíÒ»¸ö×Ӿ䡣
CHANGE col_name¡¢DROP col_nameºÍDROP INDEXÊÇMySQL¶Ô ANSI SQL92 µÄÀ©³ä¡£
MODIFYÊÇ Oracle ¶ÔALTER TABLEµÄÀ©³ä¡£
¿ÉÑ¡µÄ´ÊCOLUM


Ïà¹ØÎĵµ£º

java µ÷ÓÃÃüÁî ±¸·ÝmysqlÊý¾Ý¿â

 ´úÂëÈçÏ£º
  1  String command  =   " cmd /c C:/Program Files/MySQL/MySQL Server 5.0/bin>mysqldump -h localhost -u root -p aijia > E:/aijia.dmp " ;
  2      try    {
  3     Process process& ......

mysqlÈÝÒ×±»ºöÂÔµÄÓ÷¨

1.ÔÚ´´½¨±íµÄͬʱ´´½¨Ë÷Òý
  CREATE TABLE material(id INT NOT NULL, name char(40) NOT NULL, resistance INT, INDEX index1(id,name), UNIQUE INDEX index2(name))
  µÚÒ»¸öË÷Òý£¬ÃûΪindex1£¬ÓÉidºÍnameÁ½¸ö×Ö¶Î×é³É¡£µÚ¶þ¸öË÷ÒýÖ»°üº¬name£¬²¢Ö¸Ã÷name×ֶεÄÖµ±ØÐëÊÇΨһµÄ¡£
2.²åÈëÊý¾Ý£¬¿ÉÒÔͨ¹ýÆäËûij ......

mysql³£ÓÃSQLÓï¾ä

Ò»¡¢±íµÄµ¼Èëµ¼³öÓï¾ä¼°Ê±¼ä×Ö·û´®²¿·Ö´¦Àíº¯Êý
µ¼³öÊý¾Ý¿âËùÓбíµÄ½á¹¹               mysqldump -uroot -proot db_name -d > d:/export_db.sql(½áβ²»Ó÷ֺÅ)
µ¼³öÊý¾Ý¿âij¸ö±íµÄ½á¹¹               mysqldump -uroot -proot db_n ......

mysql ÃüÁî

1¡¢MySQL³£ÓÃÃüÁî
create database name; ´´½¨Êý¾Ý¿â
use databasename; Ñ¡ÔñÊý¾Ý¿â
drop database name Ö±½Óɾ³ýÊý¾Ý¿â£¬²»ÌáÐÑ
show tables; ÏÔʾ±í
describe tablename; ±íµÄÏêϸÃèÊö
select ÖмÓÉÏdistinctÈ¥³ýÖظ´×Ö¶Î
mysqladmin drop databasename ɾ³ýÊý¾Ý¿âÇ°£¬ÓÐÌáʾ¡£
ÏÔʾµ±Ç°mysql°æ±¾ºÍµ±Ç°È ......

¸ã¶¨MySQLÊý¾Ý¿âÖÐÎÄÄ£ºý¼ìË÷ÎÊÌâ

ÔÚ MySQLÏ£¬ÔÚ½øÐÐÖÐÎÄÄ£ºý¼ìË÷ʱ£¬¾­³£»á·µ»ØһЩÓëÖ®²»Ïà¹ØµÄ¼Ç¼£¬Èç²éÕÒ "%a%" ʱ£¬·µ»ØµÄ¿ÉÄÜÓÐÖÐÎÄ×Ö·û£¬È´Ã»ÓÐa×Ö·û´æÔÚ¡£±¾ÈËÒÔÇ°Ò²ÔøÓöµ½¹ýÀàËÆÎÊÌ⣬¾­ÏêϸÔĶÁMySQLµÄManual£¬·¢ÏÖ¿ÉÒÔÓÐÒ»ÖÖ·½·¨ºÜ·½±ãµÄ½â¾ö²¢µÃµ½ÂúÒâµÄ½á¹û¡£
¡¡¡¡Àý×Ó£º
¡¡¡¡Ï£Íûͨ¹ý“±êÌ┶ÔÐÂÎÅ¿â½øÐмìË÷£¬¹Ø¼ü×Ö¿ÉÄÜ°üº¬Ê ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ