跳到主要内容

Numeric

整数类型

名称别名大小最小值最大值
TINYINTINT81 byte-128127
SMALLINTINT162 bytes-3276832767
INTINT324 bytes-21474836482147483647
BIGINTINT648 bytes-92233720368547758089223372036854775807
提示

如果需要无符号整数,请使用 UNSIGNED 约束(兼容 MySQL)。例如:

CREATE TABLE test_numeric(tiny TINYINT, tiny_unsigned TINYINT UNSIGNED)

浮点类型

名称大小最小值最大值
FLOAT4 bytes-3.40282347e+383.40282347e+38
DOUBLE8 bytes-1.7976931348623157E+3081.7976931348623157E+308

函数

请参阅 Numeric Functions

示例

CREATE TABLE test_numeric
(
tiny TINYINT,
tiny_unsigned TINYINT UNSIGNED,
smallint SMALLINT,
smallint_unsigned SMALLINT UNSIGNED,
int INT,
int_unsigned INT UNSIGNED,
bigint BIGINT,
bigint_unsigned BIGINT UNSIGNED,
float FLOAT,
double DOUBLE
);
DESC test_numeric;

结果:

┌───────────────────────────────────────────────────────────────────┐
│ Field │ Type │ Null │ Default │ Extra │
├───────────────────┼───────────────────┼────────┼─────────┼────────┤
│ tiny │ TINYINT │ YES │ NULL │ │
│ tiny_unsigned │ TINYINT UNSIGNED │ YES │ NULL │ │
│ smallint │ SMALLINT │ YES │ NULL │ │
│ smallint_unsigned │ SMALLINT UNSIGNED │ YES │ NULL │ │
│ int │ INT │ YES │ NULL │ │
│ int_unsigned │ INT UNSIGNED │ YES │ NULL │ │
│ bigint │ BIGINT │ YES │ NULL │ │
│ bigint_unsigned │ BIGINT UNSIGNED │ YES │ NULL │ │
│ float │ FLOAT │ YES │ NULL │ │
│ double │ DOUBLE │ YES │ NULL │ │
└───────────────────────────────────────────────────────────────────┘
欢迎体验 Databend Cloud

基于 Rust + 对象存储构建的新一代多模态数仓,一个平台即可进行 BI、向量、全文检索及地理空间分析。

支持标准 SQL,自动弹性伸缩,助您快速构建现代化数据平台。

注册即领 ¥200 代金券。

注册体验