mysql alter Óï¾äÓ÷¨,Ìí¼Ó¡¢Ð޸ġ¢É¾³ý×ֶεÈ
http://www.blogjava.net/Alpha/archive/2007/07/23/131912.html
//Ö÷¼ü549830479
alter table tabelname add new_field_id int(5) unsigned default 0 not null auto_increment ,add primary key (new_field_id);
//Ôö¼ÓÒ»¸öÐÂÁÐ549830479
alter table t2 add d timestamp;
alter table infos add ex tinyint not null default '0';
Àý2:alter table msglogabstract add subcaption int(255) default 0;
//ɾ³ýÁÐ549830479
alter table t2 drop column c;
//ÖØÃüÃûÁÐ549830479
alter table t1 change a b integer;
//¸Ä±äÁеÄÀàÐÍ549830479
alter table t1 change b b bigint not null;
alter table infos change list list tinyint not null default '0';
//ÖØÃüÃû±í549830479
alter table t1 rename t2;
¼ÓË÷Òý549830479
mysql> alter table tablename change depno depno int(5) not null;
mysql> alter table tablename add index Ë÷ÒýÃû (×Ö¶ÎÃû1[£¬×Ö¶ÎÃû2 …]);
mysql> alter table tablename add index emp_name (name);
¼ÓÖ÷¹Ø¼ü×ÖµÄË÷Òý549830479
mysql> alter table tablename add primary key(id);
¼ÓΨһÏÞÖÆÌõ¼þµÄË÷Òý549830479
mysql> alter table tablename add unique emp_name2(cardnumber);
ɾ³ýij¸öË÷Òý549830479
mysql>alter table tablename drop index emp_name;
ÐÞ¸Ä±í£º549830479
Ôö¼Ó×ֶΣº549830479
mysql> ALTER TABLE table_name ADD field_name field_type;
ÐÞ¸ÄÔ×Ö¶ÎÃû³Æ¼°ÀàÐÍ£º549830479
mysql> ALTER TABLE table_name CHANGE old_field_name new_field_name field_type;
ɾ³ý×ֶΣº549830479
mysql> ALTER TABLE table_name DROP field_name;
Ïà¹ØÎĵµ£º
ת×Ô http://www.supidea.com/post/mysql_design_database.aspx
MySQLÊý¾Ý¿âÉè¼ÆÔÔò
MySQL¶ÔÓÚ³ÉΪһ¸ö·Ç³£¿ìËÙµÄÊý¾Ý¿â·þÎñÆ÷ÓÐ×ŵ±Ö®ÎÞÀ¢µÄÃûÉù£¬ËüÒ²·Ç³£ÈÝÒ×ÉèÖúÍʹÓá£Ëæ×ÅËü×÷ÎªÍøÕ¾ºó¶ËÊý¾Ý¿âµÃÉùÍûÈÕÔö£¬ÆäЧ¹ûÔÚÈ¥Ä꿪ʼÓÐÃ÷ ÏÔÌá¸ß¡£µ«ÊǺܶàMySQLÓû§¸ü¶àµØÖªµÀÈçºÎ´´½¨Ò»¸öÊý¾Ý¿â²¢±àд¶ÔËüµÄ²éѯ¡£¾ÍÏñ³ÉÇ ......
µ±ÓÃshow processlist;¿´µ½ÈçÏÂÐÅϢʱ:
LL | login | NULL |
| 697 | unauthenticated user | 218.26.219.186:26944 | NULL | Connect | NULL | login | NULL & ......
1£¬Mysql²åÈë¶þ½øÖÆ´ó¶ÔÏó³öÏÖÒì³££¬²åÈë¶þ½øÖƳöÏÖÒì³££¬Ôõô½â¾öcom.mysql.jdbc.exceptions.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
½â¾ö°ì·¨£ºurl=url=+"?useUnicode=true& ......
ÏÂÃæÏÈÀ´¿´¿´Àý×Ó£º
table
id name
1 a
2 b
3 c
4 c
5 b
¿â½á¹¹´ó¸ÅÕâÑù£¬ÕâÖ»ÊÇÒ»¸ö¼òµ¥µÄÀý×Ó£¬Êµ¼ÊÇé¿ö»á¸´Ôӵöࡣ
±ÈÈçÎÒÏëÓÃÒ»ÌõÓï¾ä²éѯµÃµ½name²»Öظ´µÄËùÓÐÊý¾Ý£¬ÄǾͱØÐëʹÓÃdistinctÈ¥µô¶àÓàµÄÖØ¸´¼Ç¼ ......