MySQL int(M)了解
来源:互联网 发布:购物车数据库表设计 编辑:程序博客网 时间:2024/06/03 01:28
MySQL int(M)了解
在MySQL创建表时,通常会看到某个int字段,定义为 a int(10) b int(11)....
疑问,那么这里的10,11..,是什么?
查询了下,只有在加 zerofill时,才能看出效果,否则,select结果出来一样,但是,
我们姑且叫了"宽度"
create table t1(Id int(3) zerofill) engine=InnoDB;
insert into t1 select 1;
insert into t1 select 11;
insert into t1 select 111;
insert into t1 select 1111;
查询如下:mysql> select * from t1;
+------+
| Id |
+------+
| 001 |
| 011 |
| 111 |
| 1111 |
+------+
7 rows in set (0.00 sec)
create table t2(Id int(3))engine=InnoDB;
insert into t2 select 1;
insert into t2 select 11;
insert into t2 select 111;
查询结果如下:
mysql> select * from t2;
+------+
| Id |
+------+
| 1 |
| 11 |
| 111 |
+------+
3 rows in set (0.00 sec)
综上所述:当你输入11时,会默认给你存储011,那么int(3)中3就是一数据长度(宽度),当你不足3位时,帮你补全,超过
3,也无影响;如int(1)和int(10)存储格式上有点区别,使用时没有不同,只在zerofill下才可看出点点效果.
int类型是有无unsigned(符号),存储数据范围不同;
0 0
- MySQL int(M)了解
- mysql中的int(M)
- MySQL数据类型 int(M)中M含义
- mysql int(m)与int(m)的区别
- 彻底了解mysql int类型
- 关于mysql中的int(m)
- MySQL数据类型 int(M) 表示什么意思?
- MySQL数据类型 int(M) 表示什么意思?
- mysql 中的 int(m)与zerofill使用
- mysql中int(M)中的M的含义
- logstash 通过mysql 慢日志了解(?m)
- Mysql中int(M)、tinyint(M)的M详解
- MySQL----int(M)讲解 (int(3)与int(11)的区别)
- MySQL----int(M)讲解 (int(3)与int(11)的区别)
- MySQL----int(M)讲解 (int(3)与int(11)的区别)
- mysql中int类型的宽度M解析
- int(m)什么意思
- 详细了解 int? 类型
- Android [LED]如何配置LCD背光和LED,调试方法 M
- 天然脑黄金的八种食物
- [easyui]复合表头隐藏列时表头出现错位的修复
- IOS多线程及队列的使用
- Android UI thread / main thread
- MySQL int(M)了解
- 使用dtree生成的树结构,ajax动态加载子节点后,如何绑定右键菜单续
- Spring3:如何配置静态文件映射?
- Android USB OTG功能如何打开及实现
- 2013-12-11 17:58:25
- 二叉树的遍历(前序、中序、后序、层次)
- Akka 对比 Storm
- EJB3: JBOSS 企业版、JBOSS服务器构架、EJB2.0 HelloWrold实例
- 第十六周-(项目二(1))指来指去。