Data Types for MariaDB Community Server 10.6
Contents
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 Type | Class | Description |
---|---|---|
BIGINT | Integer | Integer from -9223372036854775808 to 9223372036854775807 when signed, or from 0 to 18446744073709551615 when unsigned |
BIT | Bit | Bit data |
BOOL | Integer | See TINYINT |
BOOLEAN | Integer | See TINYINT |
INT | Integer | Integer from -2147483648 to 2147483647 when signed, or from 0 to 4294967295 when unsigned |
INT1 | Integer | See TINYINT |
INT2 | Integer | See SMALLINT |
|INT3 | Integer | See MEDIUMINT |
INT4 | Integer | See INT |
INT8 | Integer | See BIGINT |
INTEGER | Integer | See INT |
MEDIUMINT | Integer | Integer from -8388608 to 8388607 when signed, or from 0 to 16777215 when unsigne |
MIDDLEINT | Integer | See MEDIUMINT |
SERIAL | Alias | This is an alias for BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE |
SMALLINT | Integer | Integer from -32768 to 32767 when signed, or from 0 to 65535 when unsigned |
TINYINT | Integer | Integer from -128 to 127 when signed, or from 0 to 255 when unsigned |
Non-integer Numeric Types
Data Type | Class | Description |
---|---|---|
DEC | Fixed Num | See DECIMAL |
DECIMAL | Fixed Num | Fixed-point number |
DOUBLE | Float | Double-precision floating-point number |
DOUBLE PRECISION | Float | See DOUBLE |
FIXED | Fixed Num | See DECIMAL |
FLOAT | Float | Single-precision floating-point number |
FLOAT4 | Float | See FLOAT |
FLOAT8 | Float | See DOUBLE |
NUMBER | SQL/PL | See DECIMAL |
NUMERIC | Fixed Num | See DECIMAL |
REAL | Float | See DOUBLE |
String Types
Data Type | Class | Description |
---|---|---|
BINARY | String | Fixed-length string for binary data with limit up to 255 bytes |
BLOB | String | String for variable-length binary data up to 65,535 bytes |
CHAR | String | Fixed-length string with limit up to 255 bytes |
CHAR BYTE | String | See BINARY |
CHAR VARYING | String | See VARCHAR |
CHARACTER | String | See CHAR |
CHARACTER VARYING | String | See VARCHAR |
CLOB | SQL/PL | See LONGTEXT |
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 |
JSON | String | An alias of LONGTEXT with a default json_valid() CHECK (check added in MariaDB Community Server 10.4.3) |
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 |
LONGBLOB | String | String for variable-length binary data up to 4,294,967,295 bytes |
LONGTEXT | String | String for variable-length text data up to 4,294,967,295 bytes |
MEDIUMBLOB | String | String for variable-length binary data up to 16,777,215 bytes |
MEDIUMTEXT | String | String for variable-length text data up to 16,777,215 bytes |
NATIONAL CHAR | String | Fixed-length string of specific character set with limit up to 255 bytes |
NATIONAL CHAR VARYING | String | See NATIONAL VARCHAR |
NATIONAL CHARACTER | String | See NATIONAL CHAR |
NATIONAL CHARACTER VARYING | String | See NATIONAL VARCHAR |
NATIONAL VARCHAR | String | Variable-length string of specific character set with limit up to 65,535 bytes |
NATIONAL VARCHARACTER | String | See NATIONAL VARCHAR |
NCHAR | String | See NATIONAL CHAR |
NCHAR VARCHAR | String | See NATIONAL VARCHAR |
NCHAR VARCHARACTER | String | See NATIONAL VARCHAR |
NCHAR VARYING | String | See NATIONAL VARCHAR |
NVARCHAR | String | See NATIONAL VARCHAR |
RAW | SQL/PL | See VARBINARY |
TEXT | String | String for variable-length text data up to 65,535 bytes |
TINYBLOB | String | String for variable-length binary data up to 255 bytes |
TINYTEXT | String | String for variable-length text data up to 255 bytes |
VARBINARY | String | Variable-length string for binary data with limit up to 65,535 bytes |
VARCHAR | String | Variable-length string with limit up to 65,535 bytes |
VARCHAR2 | SQL/PL | See VARCHAR |
VARCHARACTER | String | See VARCHAR |
Date & Time Types
Data Type | Class | Description |
---|---|---|
DATE | Date | Year, month, day |
DATE (with time portion) | SQL/PL | See DATETIME |
DATETIME | Date/Time | Year (1000-9999), month, day, hours, minutes, seconds |
SQL_TSI_YEAR | Date | See YEAR |
TIME | Time | Hours, minutes, seconds |
TIMESTAMP | Date/Time | Accepts a datetime value consisting of year (1970-2038), month, day, hours, minutes, seconds, and microseconds |
YEAR | Date | Two-digit or four-digit year |
Geometry Types
Data Type | Class | Description |
---|---|---|
GEOMETRY | Geometry | Accepts collection data; and point, line, polygon single or multi |
GEOMETRYCOLLECTION | Geometry | WKB Geometry Collection |
LINESTRING | Geometry | WKB LineString from WKB Point coordinate data |
MULTILINESTRING | Geometry | WKB MultiLineString from WKB LineString data |
MULTIPOINT | Geometry | WKB MultiPoint from WKB Point coordinate data |
MULTIPOLYGON | Geometry | WKB MultiPolygon from WKB Polygon data |
POINT | Geometry | WKB Point coordinate data |
POLYGON | Geometry | WKB Polygon from WKB LineString data |
Other Types
Data Type | Class | Description |
---|---|---|
ENUM | Set | A single value from up to 65,535 pre-selected options |
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 |
SET | Set | One or more comma-separated values from a set of up to 64 pre-selected options |
TYPE OF | SQL/PSM | This 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.