1.整型数据。
创建table t1,指定数值宽度为int和int(5):
mysql> create table t1 (id1 int,id2 int(5));
Query OK, 0 rows affected (0.31 sec)
mysql> desc t1;
+-------+---------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+---------+------+-----+---------+-------+
| id1 | int(11) | YES | | NULL | |
| id2 | int(5) | YES | | NULL | |
+-------+---------+------+-----+---------+-------+
2 rows in set (0.09 sec)
插入数值:
mysql> insert into t1 (id1,id2) values(1,1);
Query OK, 1 row affected (0.05 sec)
mysql> select * from t1;
+------+------+
| id1 | id2 |
+------+------+
| 1 | 1 |
+------+------+
1 row in set (0.00 sec)
修改字段类型:
……待续