Data Types for MariaDB Enterprise Server 10.6

Overview

Each column in a table has a specified data type that defines what kind of data can be stored in the column.

Data Type

Class

Description

TINYINT

Integer

Integer from -128 to 127 when signed, or from 0 to 255 when unsigned

SMALLINT

Integer

Integer from -32768 to 32767 when signed, or from 0 to 65535 when unsigned

MEDIUMINT

Integer

Integer from -8388608 to 8388607 when signed, or from 0 to 16777215 when unsigned

INT

Integer

Integer from -2147483648 to 2147483647 when signed, or from 0 to 4294967295 when unsigned

BIGINT

Integer

Integer from -9223372036854775808 to 9223372036854775807 when signed, or from 0 to 18446744073709551615 when unsigned

DECIMAL

Fixed Num

Fixed-point number

FLOAT

Float

Single-precision floating-point number

DOUBLE

Float

Double-precision floating-point number

CHAR

String

Fixed-length string with limit up to 255 bytes

NATIONAL CHAR

String

Fixed-length string of specific character set with limit up to 255 bytes

VARCHAR

String

Variable-length string with limit up to 65,535 bytes

NATIONAL VARCHAR

String

Variable-length string of specific character set with limit up to 65,535 bytes

TINYTEXT

String

String for variable-length text data up to 255 bytes

TEXT

String

String for variable-length text data up to 65,535 bytes

MEDIUMTEXT

String

String for variable-length text data up to 16,777,215 bytes

LONGTEXT

String

String for variable-length text data up to 4,294,967,295 bytes

JSON

String

A synonym of LONGTEXT with a default json_valid() CHECK (check added in MariaDB Community Server 10.4.3)

TINYBLOB

String

String for variable-length binary data up to 255 bytes

BLOB

String

String for variable-length binary data up to 65,535 bytes

MEDIUMBLOB

String

String for variable-length binary data up to 16,777,215 bytes

LONGBLOB

String

String for variable-length binary data up to 4,294,967,295 bytes

BINARY

String

Fixed-length string for binary data with limit up to 255 bytes

VARBINARY

String

Variable-length string for binary data with limit up to 65,535 bytes

BIT

Bit

Bit data

SET

Set

One or more comma-separated values from a set of up to 64 pre-selected options

ENUM

Set

A single value from up to 65,535 pre-selected options

TIME

Time

Hours, minutes, seconds

YEAR

Date

Two-digit or four-digit year

DATE

Date

Year, month, day

TIMESTAMP

Date/Time

Year, month, day, hours, minutes, seconds with dates from 1970 to 2038

DATETIME

Date/Time

Year, month, day, hours, minutes, seconds with dates from 1000 to 9999

POINT

Geometry

WKB Point coordinate data

LINESTRING

Geometry

WKB LineString from WKB Point coordinate data

MULTIPOINT

Geometry

WKB MultiPoint from WKB Point coordinate data

MULTILINESTRING

Geometry

WKB MultiLineString from WKB LineString data

MULTIPOLYGON

Geometry

WKB MultiPolygon from WKB Polygon data

POLYGON

Geometry

WKB Polygon from WKB LineString data

GEOMETRYCOLLECTION

Geometry

WKB Geometry Collection

GEOMETRY

Geometry

Accepts collection data; and point, line, polygon single or multi

SERIAL

Alias

This is an alias for BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE

INET6

Binary

Stores an INET6 or mapped INET4 network address as a BINARY(16) internally while translating it into a CHAR(39) to the user

ROW

SQL/PSM

This declaration is only available inside a stored procedure

ROW TYPE OF

SQL/PSM

This is special declaration only available inside a stored procedure

TYPE OF

SQL/PSM

This is special declaration only available inside a stored procedure

SQL_TSI_YEAR

Date

See YEAR

DEC

Fixed Num

See DECIMAL

FIXED

Fixed Num

See DECIMAL

NUMERIC

Fixed Num

See DECIMAL

FLOAT4

Float

See FLOAT

FLOAT8

Float

See DOUBLE

DOUBLE PRECISION

Float

See DOUBLE

REAL

Float

See DOUBLE

BOOL

Integer

See TINYINT

BOOLEAN

Integer

See TINYINT

INT1

Integer

See TINYINT

INT2

Integer

See SMALLINT

INT3

Integer

See MEDIUMINT

MIDDLEINT

Integer

See MEDIUMINT

INT4

Integer

See INT

INTEGER

Integer

See INT

INT8

Integer

See BIGINT

NUMBER

SQL/PL

See DECIMAL

DATE (with time portion)

SQL/PL

See DATETIME

RAW

SQL/PL

See VARBINARY

VARCHAR2

SQL/PL

See VARCHAR

CLOB

SQL/PL

See LONGTEXT

CHAR BYTE

String

See BINARY

NATIONAL CHARACTER

String

See NATIONAL CHAR

NCHAR

String

See NATIONAL CHAR

CHAR VARYING

String

See VARCHAR

CHARACTER

String

See CHAR

CHARACTER VARYING

String

See VARCHAR

NATIONAL CHAR VARYING

String

See NATIONAL VARCHAR

NATIONAL CHARACTER VARYING

String

See NATIONAL VARCHAR

NATIONAL VARCHARACTER

String

See NATIONAL VARCHAR

NCHAR VARCHAR

String

See NATIONAL VARCHAR

NCHAR VARCHARACTER

String

See NATIONAL VARCHAR

NCHAR VARYING

String

See NATIONAL VARCHAR

NVARCHAR

String

See NATIONAL VARCHAR

VARCHARACTER

String

See VARCHAR

LONG

String

See MEDIUMTEXT

LONG CHAR VARYING

String

See MEDIUMTEXT

LONG CHARACTER VARYING

String

See MEDIUMTEXT

LONG VARBINARY

String

See MEDIUMBLOB

LONG VARCHAR

String

See MEDIUMTEXT

LONG VARCHARACTER

String

See MEDIUMTEXT