当前位置: 技术问答>linux和unix
MySql 数据类型 smallint 怎么显示为 smallint(6)
来源: 互联网 发布时间:2017-04-07
本文导语: 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...
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)???
有什么影响吗?
-> 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)???
有什么影响吗?
|
没什么影响,那个6是指定显示的宽度,不影响你使用的
别管它就好了
别管它就好了