51代码网ORACLEMYSQLSQL SERVER其它数据库java/jspasp/asp.netC/C++/VC++APP应用其它语言服务器应用
您现在的位置: 51代码网 >> mysql >> 文章正文

int(1)和int(10)在mysql占的大小都是4字节么

更新时间:2012-8-4:  来源:51代码网

int(1)和int(10)在mysql占的大小都是4字节么

int(1)和int(10)占用字节数都是4个字节。
对 都是4字节  

int1和int10的区别在于如果表定义加上zerofill后再客户端显示长度不同

mysql> create table test5(a int(10) zerofill); 
Query OK, 0 rows affected (0.00 sec)

mysql> insert into test5 values(1);
Query OK, 1 row affected (0.00 sec)

mysql> select * from test5;
+------------+
| a |
+------------+
| 0000000001 |
+------------+
1 row in set (0.00 sec)

mysql> create table test6(a int(20) zerofill);  
Query OK, 0 rows affected (0.00 sec)

mysql> insert into test6 values(1);  
Query OK, 1 row affected (0.00 sec)

mysql> select * from test6;
+----------------------+
| a |
+----------------------+
| 00000000000000000001 |
+----------------------+
1 row in set (0.00 sec)

mysql>

  • 上一篇文章:
  • 下一篇文章: 没有了
  • 赞助商链接
    推荐文章
  • 此栏目下没有推荐文章
  • {
    设为首页 | 加入收藏 | 友情链接 | 网站地图 | 联系站长 |