日期:2014-05-16  浏览次数:20883 次

MySql 数据类型 smallint 怎么显示为 smallint(6)
mysql> create table sales_quantity (
    -> employee char(6) references employee,
    -> product char(6) references products,
    -> quantity smallint );
Query OK, 0 rows affected (0.00 sec)

mysql> show tables;
+-----------------+
| Tables_in_sales |
+-----------------+
| employee        |
| products        |
| sales_quantity  |
+-----------------+
3 rows in set (0.00 sec)

mysql> desc sales_quantity;
+----------+-------------+------+-----+---------+-------+
| Field    | Type        | Null | Key | Default | Extra |
+----------+-------------+------+-----+---------+-------+
| employee | char(6)     | YES  |     | NULL    |       |
| product  | char(6)     | YES  |     | NULL    |       |
| quantity | smallint(6) | YES  |     | NULL    |       |
+----------+-------------+------+-----+---------+-------+
3 rows in set (0.00 sec)

mysql>

如上的步骤啊, 怎么指定数据类型明明是 smallint, 结果显示却为 smallint(6)???

有什么影响吗?

MySQL

------解决方案--------------------
没什么影响,那个6是指定显示的宽度,不影响你使用的
别管它就好了