In PostgreSQL, the NUMERIC and DECIMAL types are synonyms so you can use them interchangeably: DECIMAL(p,s) If you prefer a shorter name, you can use the name DEC because DEC and DECIMAL are the same type: DEC(p,s) If precision is not required, you should not use the NUMERIC type ...
Numeric Types -https://www.postgresql.org/docs/10/static/datatype-numeric.html 2、货币类型 Monetary Types -https://www.postgresql.org/docs/10/static/datatype-money.html money固定小数点后2位,超过2位长度会四舍五入,仔细看会发现金额前面有货币类型,这个是根据服务端的lc_monetary设置的。 select'12....
numeric或decimal 变长 用户来声明精度 无限制 real 4字节 变精度,不精确 6位十进制数字精度 double precision 8字节 变精度,不精确 15位十进制数字精度 serial 4字节 自增整数 1 ~ 2的31次方 -1 bigserial 8字节 大范围自增整数 1 ~ 2的63次方-12.2...
PostgreSQL has a rich set of native data types available to users. Users can add new types to PostgreSQL using the CREATE TYPE command. PostgreSQL有一组丰富的本地数据类型可供用户使用。用户可以使用CREATE TYPE命令向PostgreSQL添加新类型。Each data type has an external representation determined by its...
postgres=# \df List of functionsSchema | Name | Result data type | Argument data types | Type---+---+---+---
In the rest of the document, we have discussed each of the PostgreSQL Data Types based on PostgreSQL 9.1 Version. Category - Numeric Types Category - Monetary Types Category - Character Types Category - Binary Data Types Category - Date/Time Types ...
Before considering a custom range type, we should check is one of PostgreSQL's built-in range types would accomplish what we're looking for. These include: int4range: Range of integer int8range: Range of bigint numrange: Range of numeric ...
Numeric data types that are exact contain integer data types and decimal data types. Approximate data types, on the other hand, contain floating-point data types—for instance, 2-, 4-, and 8-byte integers, 4- and 8-byte floating-point numbers, and selectable-precision decimals....
整数类型(integer types) integer,4字节,应该成为数字类型的首选,例如存储金额,可以以分为单位存储 smallint,2字节,更节省磁盘空间 bigint,8字节,能够存储的数字范围更大 任意精度类型(arbitrary precision numbers) 关键特性:占用存储空间可变 语法 NUMERIC(precision, scale) precision,总精度,可以存储的总位数 scale...
ARRAY(Types.ARRAY), BIT(Types.BIT), TINYINT(Types.TINYINT), SMALLINT(Types.SMALLINT), INTEGER(Types.INTEGER), BIGINT(Types.BIGINT), FLOAT(Types.FLOAT), REAL(Types.REAL), DOUBLE(Types.DOUBLE), NUMERIC(Types.NUMERIC), DECIMAL(Types.DECIMAL), ...