smallint专题

[MySQL]mysql中int、bigint、smallint 和 tinyint的区别和存储的范围

部门中有个字段存储的是十进制数字 , 但是表示的意思是转成二进制后 ,每一个位代表不同功能的开关状态 当超过32个功能开关的时候 , 就需要将int类型转换成bigint类型 , 原因就是int只能存储4个字节也就是2的32次方的整型值 , 装不下了, 下面就是具体的存的范围 bigint从 -2^63 (-9223372036854775808) 到 2^63-1 (9223372036854

PostgreSql 报错ERROR: cannot cast type smallint to boolean

一、现象 --表修改字段类型时报错postgres=# alter table t alter sex type boolean using sex::boolean;ERROR: cannot cast type smallint to booleanLINE 1: alter table t alter sex type boolean using sex::boolean; 二

sql中的int、bigint、smallint和tinyint四种数据类型

1、bigint:从-2^63(-9223372036854775808)到2^63-1(9223372036854775807) 的整型数据(所有数字),存储大小为8个字节。 2、int:从-2^31(-2147483648)到2^31-1(2147483647)的整型数据(所有数字)。存储为4个字节。 3、smallint:从-2^15(-32768)到2^15-1(32767)的整型数据