1、Mysql修改字段的默认值:
alter table tablename alter column drop default; (若本身存在默认值,则先删除)
alter table tablename alter column set default 0;(若本身不存在则可以直接设定)
2、修改字段的备注:
alter table dq_permission_group_permission modify column trial_type tinyint(1) comment '备注内容';
3、查询表内某字段重复值的数量:
select mobile,count(*) as sumcount from user group by mobile having sumcount>1; (先用手机号分组,再用having来过滤大于1的,查出来的就是重复记录)
4、修改字段的长度:
alter table pre_common_attachments modify column user_id int(50);
5、查看表内索引:
show indexex from table;
show keys from table;