MySql常用语句总结更新
2024-10-07 12:28:17
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;
最新文章
- bug描述技巧
- MFC - 微软基础类库和框架
- window计划任务
- Grunt vs Gulp
- 【转】【WPF】WPF 自定义快捷键命令(Command)
- Eclipse+Tomcat部署项目的一些总结
- 分页加查询的sql语句
- memcached并发处理
- JAVA中,数组的操作与排序
- iOS基础 - 文本属性Attributes
- error LNK2001:unresolved external symbol ";xxx:static xxx";
- js中__proto__和prototype的区别和关系?
- 两个Xml转换为DataSet方法(C#)
- substr函数的用法
- 树链剖分详解(洛谷模板 P3384)
- C#读取Excel文件的简单方法
- spring整合mybatis在使用.properties文件时候遇到的问题
- js判断变量的类型(使用闭包来玩一把)
- Kubernetes部署ELK并使用Filebeat收集容器日志
- Architecture And Framework
热门文章
- 刷题——一道全排列的题目(Permutations)
- 前端 CSS 盒子模型 padding 内边距 属性
- SpringBoot(四) -- SpringBoot与Web开发
- Greg and Array CodeForces 296C 差分数组
- 洛谷 P1073 最优贸易 &; [NOIP2009提高组](反向最短路)
- SpringMVC Controller单例和多例(转)
- hdu6357 Hills And Valleys (最长不下降子序列)
- TAB切换与内容伸展闭合的结合
- vue.js(18)--父组件向子组件传值
- Java编码技巧与代码优化