对数据库表中字段的操作
以表user_info为例
1、添加字段
alter table user_info
add sex tinyint(1) default 0 comment '性别0-男 1-女',
add birth date not null comment '出生日期'
在指定字段password后添加字段:
alter table user_info
add mobile char(11) comment '手机号'after password
2、修改字段
alter table user_info
modify user_name varchar(50) unique comment'用户名',
modify passeword varchar(50) not null comment '密码'
3、删除字段
alter table user_info
drop birth,
drop mobile
4、添加约束
alter table address
add constraint yueshu foreign key (user_info_id) references user_info(id)
5、删除约束
alter table address
drop foreign key yueshu