厦门做网站多,网站抓取超时错误,小程序自己开发难吗,网站建设 费用高1.增加一个字段(一列)alter table table_name add column column_name type default value; type指该字段的类型,value指该字段的默认值例如:alter table mybook add column publish_house varchar(10) default ;2.更改一个字段名字(也可以改变类型和默认值)alter table tabl…1.增加一个字段(一列)alter table table_name add column column_name type default value; type指该字段的类型,value指该字段的默认值例如:alter table mybook add column publish_house varchar(10) default ;2.更改一个字段名字(也可以改变类型和默认值)alter table table_name change sorce_col_name dest_col_name type default value; source_col_name指原来的字段名称,dest_col_name指改后的字段名称例如:alter table Board_Info change IsMobile IsTelphone int(3) unsigned default 1;3.改变一个字段的默认值alter table table_name alter column_name set default value;例如:alter table book alter flag set default 0;mysql timestamp 类型字段。当一个表中数据类型为timestamp时,只能有一个列用CURRENT_TIMESTAMP设置为default值 (恶心不)若字段类型timestamp 需要修改默认值例如之前给的默认值CURRENT_TIMESTAMP现在需修改为null。使用 alter table book alter intime set default null; 修改不了。有两种方法可以修改a、先删掉这列再加一列。alter table tablename drop column cloumnname;alter table tablename add column columnname timestamp default value;例子alter table t_audit drop column SUBMITTIME;alter table t_audit add column SUBMITTIME timestamp null default NULL;b、删表重建表。 比较暴力。4.改变一个字段的数据类型alter table table_name change column column_name column_name type;例如:alter table userinfo change column username username varchar(20);5.向一个表中增加一个列做为主键alter table table_name add column column_name type auto_increment PRIMARY KEY;例如:alter table book add column id int(10) auto_increment PRIMARY KEY;6.数据库某表的备份,在命令行中输入:mysqldump -u root -p database_name table_name bak_file_name例如:mysqldump -u root -p f_info user_info user_info.dat7.导出数据select_statment into outfiledest_file;例如:select cooperatecode,createtime from publish limit 10 into outfile/home/mzc/temp/tempbad.txt;8.导入数据load data infilefile_name into table table_name;例如:load data infile/home/mzc/temp/tempbad.txt into table pad;9.将两个表里的数据拼接后插入到另一个表里。下面的例子说明将t1表中的com2和t2表中的com1字段的值拼接后插入到tx表对应的字段里。例如:insert into tx select t1.com1,concat(t1.com2,t2.com1) from t1,t2;10,删除字段alter table form1 drop column 列名;alter table t_audit drop column SUBMITTIME;alter table t_audit add column SUBMITTIME timestamp null default NULL;alter table t_audit alter SUBMITTIME timestamp not null;