This is a read-only copy of the MariaDB Knowledgebase generated on 2025-05-11. For the latest, interactive version please visit https://mariadb.com/kb/.

Data Types for MariaDB Community Server 10.5

Overview

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

Integer Numeric Types

Data TypeClassDescription
BIGINTIntegerInteger from -9223372036854775808 to 9223372036854775807 when signed, or from 0 to 18446744073709551615 when unsigned
BITBitBit data
BOOLIntegerSee TINYINT
BOOLEANIntegerSee TINYINT
INTIntegerInteger from -2147483648 to 2147483647 when signed, or from 0 to 4294967295 when unsigned
INT1IntegerSee TINYINT
INT2IntegerSee SMALLINT
|INT3IntegerSee MEDIUMINT
INT4IntegerSee INT
INT8IntegerSee BIGINT
INTEGERIntegerSee INT
MEDIUMINTIntegerInteger from -8388608 to 8388607 when signed, or from 0 to 16777215 when unsigne
MIDDLEINTIntegerSee MEDIUMINT
SERIALAliasThis is an alias for BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE
SMALLINTIntegerInteger from -32768 to 32767 when signed, or from 0 to 65535 when unsigned
TINYINTIntegerInteger from -128 to 127 when signed, or from 0 to 255 when unsigned

Non-integer Numeric Types

Data TypeClassDescription
DECFixed NumSee DECIMAL
DECIMALFixed NumFixed-point number
DOUBLEFloatDouble-precision floating-point number
DOUBLE PRECISIONFloatSee DOUBLE
FIXEDFixed NumSee DECIMAL
FLOATFloatSingle-precision floating-point number
FLOAT4FloatSee FLOAT
FLOAT8FloatSee DOUBLE
NUMBERSQL/PLSee DECIMAL
NUMERICFixed NumSee DECIMAL
REALFloatSee DOUBLE

String Types

Data TypeClassDescription
BINARYStringFixed-length string for binary data with limit up to 255 bytes
BLOBStringString for variable-length binary data up to 65,535 bytes
CHARStringFixed-length string with limit up to 255 bytes
CHAR BYTEStringSee BINARY
CHAR VARYINGStringSee VARCHAR
CHARACTERStringSee CHAR
CHARACTER VARYINGStringSee VARCHAR
CLOBSQL/PLSee LONGTEXT
INET6BinaryStores an INET6 or mapped INET4 network address as a BINARY(16) internally while translating it into a CHAR(39) to the user
JSONStringAn alias of LONGTEXT with a default json_valid() CHECK (check added in MariaDB Community Server 10.4.3)
LONGStringSee MEDIUMTEXT
LONG CHAR VARYINGStringSee MEDIUMTEXT
LONG CHARACTER VARYINGStringSee MEDIUMTEXT
LONG VARBINARYStringSee MEDIUMBLOB
LONG VARCHARStringSee MEDIUMTEXT
LONG VARCHARACTERStringSee MEDIUMTEXT
LONGBLOBStringString for variable-length binary data up to 4,294,967,295 bytes
LONGTEXTStringString for variable-length text data up to 4,294,967,295 bytes
MEDIUMBLOBStringString for variable-length binary data up to 16,777,215 bytes
MEDIUMTEXTStringString for variable-length text data up to 16,777,215 bytes
NATIONAL CHARStringFixed-length string of specific character set with limit up to 255 bytes
NATIONAL CHAR VARYINGStringSee NATIONAL VARCHAR
NATIONAL CHARACTERStringSee NATIONAL CHAR
NATIONAL CHARACTER VARYINGStringSee NATIONAL VARCHAR
NATIONAL VARCHARStringVariable-length string of specific character set with limit up to 65,535 bytes
NATIONAL VARCHARACTERStringSee NATIONAL VARCHAR
NCHARStringSee NATIONAL CHAR
NCHAR VARCHARStringSee NATIONAL VARCHAR
NCHAR VARCHARACTERStringSee NATIONAL VARCHAR
NCHAR VARYINGStringSee NATIONAL VARCHAR
NVARCHARStringSee NATIONAL VARCHAR
RAWSQL/PLSee VARBINARY
TEXTStringString for variable-length text data up to 65,535 bytes
TINYBLOBStringString for variable-length binary data up to 255 bytes
TINYTEXTStringString for variable-length text data up to 255 bytes
VARBINARYStringVariable-length string for binary data with limit up to 65,535 bytes
VARCHARStringVariable-length string with limit up to 65,535 bytes
VARCHAR2SQL/PLSee VARCHAR
VARCHARACTERStringSee VARCHAR

Date & Time Types

Data TypeClassDescription
DATEDateYear, month, day
DATE (with time portion)SQL/PLSee DATETIME
DATETIMEDate/TimeYear (1000-9999), month, day, hours, minutes, seconds
SQL_TSI_YEARDateSee YEAR
TIMETimeHours, minutes, seconds
TIMESTAMPDate/TimeAccepts a datetime value consisting of year (1970-2038), month, day, hours, minutes, seconds, and microseconds
YEARDateTwo-digit or four-digit year

Geometry Types

Data TypeClassDescription
GEOMETRYGeometryAccepts collection data; and point, line, polygon single or multi
GEOMETRYCOLLECTIONGeometryWKB Geometry Collection
LINESTRINGGeometryWKB LineString from WKB Point coordinate data
MULTILINESTRINGGeometryWKB MultiLineString from WKB LineString data
MULTIPOINTGeometryWKB MultiPoint from WKB Point coordinate data
MULTIPOLYGONGeometryWKB MultiPolygon from WKB Polygon data
POINTGeometryWKB Point coordinate data
POLYGONGeometryWKB Polygon from WKB LineString data

Other Types

Data TypeClassDescription
ENUMSetA single value from up to 65,535 pre-selected options
ROWSQL/PSMThis declaration is only available inside a stored procedure
ROW TYPE OFSQL/PSMThis is special declaration only available inside a stored procedure
SETSetOne or more comma-separated values from a set of up to 64 pre-selected options
TYPE OFSQL/PSMThis is special declaration only available inside a stored procedure
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.