数值类型 整数类型有2字节的smallint,2字节int 8字节bigint ;精确数字类型numeric;非精确类型的浮点小数real和double precision 还有8字节的money(货币类型) 无MYSQL中的unsigned类型,也无mysql中的1字节长tinint和3字节长的mediumint整数类型 字符类型 有varchar(n),char(n),text三种类型 pg中最大可存储1G mysql中...
bigint int8 有符号的8字节整数 bigserial serial8 自动增长的8字节整数 bit [ (n) ] 定长位串 bit varying [ (n) ] varbit 变长位串 boolean bool 逻辑布尔值(真/假) box 平面上的普通方框 bytea 二进制数据(“字节数组”) character [ (n) ] char [ (n) ] 定长字符串 character varying [ ...
BigIntInt64Int64 Decimal(精度 <= 28)DecimalDecimal Decimal(精度 > 28)不支持String NumericDecimalDecimal RealSingleSingle DoubleDoubleDouble SmallSerialInt16Int16 SerialInt32Int32 BigSerialInt64Int64 MoneyDecimalString CharStringString VarcharStringString ...
BEGIN /* try to create a tableforthe new partition */ EXECUTE format('CREATE TABLE %I (LIKE tab INCLUDING INDEXES)','tab_'||to_char(NEW.ts,'YYYYMMDD')); /* * tell listener to attach the partition *(onlyifa new table was created) */ EXECUTE format('NOTIFY tab, %L', to_ch...
to_ascii(text [, encoding]) text 把text从其它编码转换为ASCII。 to_ascii(‘Karel’) Karel to_hex(number int/bigint) text 把number转换成其对应地十六进制表现形式。 to_hex(9223372036854775807) 7fffffffffffffff translate(string text, from text, to text) ...
常用的类型是integer,因为它提供了在表示范围、存储空间和性能之间的最佳平衡。只有在磁盘空间紧张的情况下才使用smallint。只有在integer太小的时候才使用bigint,因为在进行数学运算时,interger类型的数据bigint类型的数据要快。 SQL标准只定义了整数类型integer(或int)、smallint和bigint。
char_length(string) int 字串中的字符个数 char_length('jose') 4 convert(string using conversion_name) text 使用指定的转换名字改变编码。 convert('PostgreSQL' using iso_8859_1_to_utf8) 'PostgreSQL' lower(string) text 把字串转化为小写 lower('TOM') tom octet_length(string) int 字串中的字节...
select to_char(now(),'yyyy-mm-dd hh24:mi:ss') "巡检时间", current_database() AS db, schemaname, tablename,bs, reltuples::bigint AS tups, relpages::bigint AS pages, otta, ROUND(CASE WHEN otta=0 OR sml.relpages=0 OR sml.relpages=otta THEN 0.0 ELSE sml.relpages/otta::numer...
IntegerInt32Int32 BigIntInt64Int64 Decimal(精度 <= 28)DecimalDecimal Decimal(精度 > 28)不支持String NumericDecimalDecimal RealSingleSingle DoubleDoubleDouble SmallSerialInt16Int16 SerialInt32Int32 BigSerialInt64Int64 MoneyDecimalString CharStringString ...
bigint,8字节,能够存储的数字范围更大 任意精度类型(arbitrary precision numbers) 关键特性:占用存储空间可变 语法 NUMERIC(precision, scale) precision,总精度,可以存储的总位数 scale,小数点后的位数 NUMERIC类型适用于要求精确的场景,例如金融领域。 对NUMERIC类型的计算,如加、减、乘是精确的,但精确度的提升带来...