MySQL adding (num) to smallint column -


when create table in mysql specifying smallint column, use show create table or mysqldump, mysql has added (5) after smallint definition, below.

i'm guessing doesn't matter far data concerned, can explain why , if/how can stop doing this?

as aside, attempting change existing database table exactly match of new sql script. alter new sql script, i'd prefer alter existing table if possible (think software install versus software upgrade).

drop table if exists `test`;  create table `test` (   `id` int(10) unsigned not null auto_increment,   `status` varchar(100) not null default '',   `port` smallint unsigned not null default '0',   primary key (`id`) ) engine=innodb default charset=utf8;  show create table test;  create table `test` (   `id` int(10) unsigned not null auto_increment,   `status` varchar(100) not null default '',   `port` smallint(5) unsigned not null default '0',   primary key (`id`) ) engine=innodb default charset=utf8 

no, can't stop show create table including display width attribute integer types.

if value display width not included in column declaration of integer type, mysql supplies default value it. value of 5 default value smallint unsigned.

the display width doesn't have affect on values can stored or retrieved. client applications can make use of value formatting resultset.

reference: http://dev.mysql.com/doc/refman/5.6/en/numeric-type-attributes.html


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -