mysql SQL语句积累

原创
2016-06-07 18:05:34 768浏览

mysql SQL语句积累,学习mysql的朋友可以参考下。

--重命名表

rename table t_softwareport to software_port;

--建立外键

alter table software_port add constraint fk_software_port_softwareprocessid foreign key (softwareprocessid) references software_process (id) on delete restrict on update restrict;

--删除列
alter table software_type drop column upid, drop column orderid;

--修改列名
alter table software_process change software_id softwareid int(11) not null;

--更改列编码

alter table cms_contentbody modify column offical_site_name varchar(30) character set utf8 collate utf8_unicode_ci not null;

--增加列

alter table cms_flash add name varchar(30) not null unique;

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。