码迷,mamicode.com
首页 > 数据库 > 详细

MySQL数据类型

时间:2017-11-27 12:43:01      阅读:182      评论:0      收藏:0      [点我收藏+]

标签:分享   null   inno   ble   fill   sele   from   warnings   mysql数据类型   

一、数字类型

A:整型

技术分享图片

  技术分享图片

mysql> show create table a\G
*************************** 1. row ***************************
Table: a
Create Table: CREATE TABLE `a` (
`a` int(10) unsigned DEFAULT NULL,
`b` int(10) unsigned DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
1 row in set (0.00 sec)

 

这里的10,表示什么意思

本身没有意义,只有与zerofill配合在一起,才会起作用

mysql> create table c( a int(3) zerofill,b int(3) zerofill);
Query OK, 0 rows affected (0.16 sec)

mysql> insert into c select 1,2;
Query OK, 1 row affected (0.00 sec)
Records: 1 Duplicates: 0 Warnings: 0

mysql> select * from c;
+------+------+
| a | b |
+------+------+
| 001 | 002 |
+------+------+
1 row in set (0.00 sec)

mysql> select a-b from c;
ERROR 1690 (22003): BIGINT UNSIGNED value is out of range in ‘(`testDB`.`c`.`a` - `testDB`.`c`.`b`)‘

mysql> insert into c select 1111;
ERROR 1136 (21S01): Column count doesn‘t match value count at row 1  (列计数不匹配值计数)

 

MySQL数据类型

标签:分享   null   inno   ble   fill   sele   from   warnings   mysql数据类型   

原文地址:http://www.cnblogs.com/51yuki/p/mysql08.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!