The primary dif­fer­ence between the various data types in MariaDB is the values they can hold and, as a result, their size.

Which data types does MariaDB have?

MariaDB can store and map different types of data. Before you create a new database in MariaDB and fill it with tables using MariaDB’s CREATE TABLE statement, you should consider which data types are useful. These differ not only in terms of their possible values, but also in their size. Data types in MariaDB can be roughly divided into five cat­e­gories: numeric, date and time, strings, geometry and other mis­cel­la­neous data types that stand on their own.

Managed Database Services
Time-saving database services
  • En­ter­prise-grade ar­chi­tec­ture managed by experts
  • Flexible solutions tailored to your re­quire­ments
  • Leading security in ISO-certified data centers

Numeric data types

Data type De­scrip­tion
TINYINT Whole numbers from -128 to 127
SMALLINT Whole numbers from -32768 to 32767
MEDIUMINT Whole numbers from -8388608 to 8388607
INT Whole numbers from -2147483648 to 2147483647
BIGINT Whole numbers from -9223372036854775808 to 9223372036854775807
BOOLEAN The Boolean values “true” or “false”; synonym for TINYINT(1)
DECIMAL Decimal numbers with up to 65 digits
FLOAT Floating point numbers between -3.402823466E+38 and -1.175494351E-38, 1.175494351E-38 and 3.402823466E+38 or with the value 0
DOUBLE Floating point numbers between -1.7976931348623157E+308 and -2.2250738585072014E-308, 2.2250738585072014E-308 to 1.7976931348623157E+308 or with the value 0
BIT A bit

Date and time data types

Data type De­scrip­tion
DATE The date format is YYYY-MM-DD with a range from 1000-01-01 to 9999-12-31
TIME Time spec­i­fi­ca­tion in the range from -838:59:59.999999 to 838:59:59.999999
DATETIME Time spec­i­fi­ca­tion in the format YYYY-MM-DD HH:MM with a range from 1000-01-01 00:00:00.000000 to 9999-12-31 23:59:59.999999
TIMESTAMP Timestamp in the format YYYY-MM-DD HH:MM; also supports mi­crosec­onds
YEAR Four-digit year spec­i­fi­ca­tion with a range from 1901 to 2155 and the option 0000

Strings

In MariaDB, data types from the string category can contain different sequences of text, binary data and other files.

Data type De­scrip­tion
CHAR A string that contains char­ac­ters based on ASCII codes ranging from 0 to 255
VARCHAR A string with a range from 0 to 65,535
BINARY Binary data
VARBINARY A variable-length binary string
TINYBLOB A small binary object up to 255 bytes
BLOB A binary object up to 65,535 bytes
MEDIUMBLOB A medium-sized binary object up to 16,777,215 bytes
LONGBLOB A large binary object up to 4,294,967,295 bytes
TINYTEXT A sequence of up to 255 char­ac­ters
TEXT A sequence of up to 65,535 char­ac­ters
MEDIUMTEXT A sequence of up to 16,777,215 char­ac­ters
LONGTEXT A sequence of up to 4,294,967,295 char­ac­ters
ENUM An enu­mer­a­tion type
SET A string with distinct values

Geometry data types

Data type De­scrip­tion
GEOMETRY A geometric value
POINT A point on the X and Y co­or­di­nates
LINESTRING A curve con­sist­ing of one or more points
POLYGON A polygon
GEOMETRYCOLLECTION A col­lec­tion of multiple GEOMETRY values
MULTILINESTRING Multiple LINESTRING values
MULTIPOINT Multiple POINT values
MULTIPOLYGON Multiple POLYGON values

Mis­cel­la­neous data types in MariaDB

Data type De­scrip­tion
AUTO_INCREMENT Au­to­mat­i­cal­ly fills a new field with the next higher count value; not an in­de­pen­dent data type
NULL An empty field; not an in­de­pen­dent data type
Tip

You can find out more about MariaDB in our Digital Guide. Among other things, we compare MariaDB and MySQL and explain how to install MariaDB.

Go to Main Menu