First, the number type
A: Integral type
Mysql> Show CREATE TABLE A\g
1. Row ***************************
Table:a
Create table:create Table ' a ' (
' A ' int (ten) unsigned DEFAULT NULL,
' B ' int(TEN) unsigned DEFAULT NULL
) Engine=innodb DEFAULT charset=latin1
1 row in Set (0.00 sec)
Here's 10, what does that mean?
It doesn't make sense, it only works with 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 (column count mismatch value counts)
MySQL data type