-
数据库类型表
-
整数
tinyint:微整型
smallint:小整型
mediumint:中整型
int: 整型
bigint:大整型
默认整数类型是带符号的,即可以有正负值,此时,id 和 age 中都可以存储负数(但都不能超出范围):
create table user (id int, age tinyint) ;
整数类型设置形式如下,此时 age 字段中只能存储正整数了,不能存负数了:
create table user (id int unsigned, age tinyint unsigned) ;