unsigned和zerofill的使用

发布时间 2023-11-30 10:46:28作者: 露予欢

unsigned(无符号):

顾名思义,使用它时不能带任何符号
zerofill(填充0):

默认空格位置用0来填充
代码:
create table student(
id int primary key auto_increment,
age int unsigned,
tell int zerofill
)
insert into student(age,tell)values(30,180)

 

运行结果
不使用unsigned和zerofill:
代码:
create table student2(
id int primary key auto_increment,
age int,
tell int
)
insert into student2(age,tell)values(-30,180)


运行结果