Skip to main content

Numeric

Integer Data Types

Basic Integer Numbers data types.

NameAliasesStorage SizeMin ValueMax ValueDescription
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

Basic Float32/Float64 data types.

NameAliasesStorage SizeMin ValueMax ValueDescription
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;
+-------------------+-------------------+------+---------+-------+
| Field | Type | Null | Default | Extra |
+-------------------+-------------------+------+---------+-------+
| tiny | TINYINT | NO | 0 | |
| tiny_unsigned | TINYINT UNSIGNED | NO | 0 | |
| smallint | SMALLINT | NO | 0 | |
| smallint_unsigned | SMALLINT UNSIGNED | NO | 0 | |
| int | INT | NO | 0 | |
| int_unsigned | INT UNSIGNED | NO | 0 | |
| bigint | BIGINT | NO | 0 | |
| bigint_unsigned | BIGINT UNSIGNED | NO | 0 | |
| float | FLOAT | NO | 0 | |
| double | DOUBLE | NO | 0 | |
+-------------------+-------------------+------+---------+-------+