整形

– 1. 创建数据表
create table my_int(
int_1 tinyint,
int_2 smallint,
int_3 mediumint,
int_4 int,
int_5 bigint
)charset utf8;
整形_第1张图片
– 2. 插入数据
insert into my_int values (10,1000,100000,1000000,100000000);
整形_第2张图片
– 3.插入错误数据
insert into my_int values (255,255,255,255,255);
insert into my_int values (127,255,255,255,255);
整形_第3张图片
– 4.无符号标识设定并插入数据
alter table my_int add int_6 tinyint unsigned first;
insert into my_int values (255,100,255,255,255,255);
整形_第4张图片
– 从左侧开始填充0
alter table my_int add int_7 tinyint zerofill first;
insert into my_int values (1,100,100,255,255,255,255);
整形_第5张图片
– 指定显示长度
alter table my_int add int_8 tinyint(2) zerofill first;
insert into my_int values (1,1,100,100,255,255,255,255);
整形_第6张图片

你可能感兴趣的:(整形)