Skip to main content

Numeric

Integer Data Types

NameAliasSizeMin ValueMax Value
TINYINTINT81 byte-128127
SMALLINTINT162 bytes-3276832767
INTINT324 bytes-21474836482147483647
BIGINTINT648 bytes-92233720368547758089223372036854775807
tip

If you want unsigned integer, please use UNSIGNED constraint, this is compatible with MySQL, for example:

CREATE TABLE test_numeric(tiny TINYINT, tiny_unsigned TINYINT UNSIGNED)

Floating-Point Data Types

NameSizeMin ValueMax Value
FLOAT4 bytes-3.40282347e+383.40282347e+38
DOUBLE8 bytes-1.7976931348623157E+3081.7976931348623157E+308

Functions

See Numeric Functions.

Examples

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;

Result:

┌───────────────────────────────────────────────────────────────────┐
│ 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 │ │
└───────────────────────────────────────────────────────────────────┘
Did this page help you?
Yes
No
Explore Databend Cloud for FREE
Low-cost
Fast Analytics
Easy Data Ingestion
Elastic Scaling
Try it today