# What are the different data types in MariaDB?

The primary difference 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](https://www.ionos.com/digitalguide/hosting/technical-matters/mariadb-create-database/) and fill it with tables using [MariaDB’s CREATE TABLE statement](https://www.ionos.com/digitalguide/hosting/technical-matters/mariadb-create-table/), 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 categories: numeric, date and time, strings, geometry and other miscellaneous data types that stand on their own.

## Numeric data types

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

## Date and time data types

<table>
  <thead>
    <tr>
      <th>Data type</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>`DATE`</td>
      <td>The date format is YYYY-MM-DD with a range from 1000-01-01 to 9999-12-31</td>
    </tr>
    <tr>
      <td>`TIME`</td>
      <td>Time specification in the range from -838:59:59.999999 to 838:59:59.999999</td>
    </tr>
    <tr>
      <td>`DATETIME`</td>
      <td>Time specification 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</td>
    </tr>
    <tr>
      <td>`TIMESTAMP`</td>
      <td>Timestamp in the format YYYY-MM-DD HH:MM; also supports microseconds</td>
    </tr>
    <tr>
      <td>`YEAR`</td>
      <td>Four-digit year specification with a range from 1901 to 2155 and the option 0000</td>
    </tr>
  </tbody>
</table>

## Strings

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

<table>
  <thead>
    <tr>
      <th>Data type</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>`CHAR`</td>
      <td>A string that contains characters based on [ASCII codes](https://www.ionos.com/digitalguide/server/know-how/ascii-codes-overview-of-all-characters-on-the-ascii-table/) ranging from 0 to 255</td>
    </tr>
    <tr>
      <td>`VARCHAR`</td>
      <td>A string with a range from 0 to 65,535</td>
    </tr>
    <tr>
      <td>`BINARY`</td>
      <td>Binary data</td>
    </tr>
    <tr>
      <td>`VARBINARY`</td>
      <td>A variable-length binary string</td>
    </tr>
    <tr>
      <td>`TINYBLOB`</td>
      <td>A small binary object up to 255 bytes</td>
    </tr>
    <tr>
      <td>`BLOB`</td>
      <td>A binary object up to 65,535 bytes</td>
    </tr>
    <tr>
      <td>`MEDIUMBLOB`</td>
      <td>A medium-sized binary object up to 16,777,215 bytes</td>
    </tr>
    <tr>
      <td>`LONGBLOB`</td>
      <td>A large binary object up to 4,294,967,295 bytes</td>
    </tr>
    <tr>
      <td>`TINYTEXT`</td>
      <td>A sequence of up to 255 characters</td>
    </tr>
    <tr>
      <td>`TEXT`</td>
      <td>A sequence of up to 65,535 characters</td>
    </tr>
    <tr>
      <td>`MEDIUMTEXT`</td>
      <td>A sequence of up to 16,777,215 characters</td>
    </tr>
    <tr>
      <td>`LONGTEXT`</td>
      <td>A sequence of up to 4,294,967,295 characters</td>
    </tr>
    <tr>
      <td>`ENUM`</td>
      <td>An enumeration type</td>
    </tr>
    <tr>
      <td>`SET`</td>
      <td>A string with distinct values</td>
    </tr>
  </tbody>
</table>

## Geometry data types

<table>
  <thead>
    <tr>
      <th>Data type</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>`GEOMETRY`</td>
      <td>A geometric value</td>
    </tr>
    <tr>
      <td>`POINT`</td>
      <td>A point on the X and Y coordinates</td>
    </tr>
    <tr>
      <td>`LINESTRING`</td>
      <td>A curve consisting of one or more points</td>
    </tr>
    <tr>
      <td>`POLYGON`</td>
      <td>A polygon</td>
    </tr>
    <tr>
      <td>`GEOMETRYCOLLECTION`</td>
      <td>A collection of multiple `GEOMETRY` values</td>
    </tr>
    <tr>
      <td>`MULTILINESTRING`</td>
      <td>Multiple `LINESTRING` values</td>
    </tr>
    <tr>
      <td>`MULTIPOINT`</td>
      <td>Multiple `POINT` values</td>
    </tr>
    <tr>
      <td>`MULTIPOLYGON`</td>
      <td>Multiple `POLYGON` values</td>
    </tr>
  </tbody>
</table>

## Miscellaneous data types in MariaDB

<table>
  <thead>
    <tr>
      <th>Data type</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>`AUTO_INCREMENT`</td>
      <td>Automatically fills a new field with the next higher count value; not an independent data type</td>
    </tr>
    <tr>
      <td>`NULL`</td>
      <td>An empty field; not an independent data type</td>
    </tr>
  </tbody>
</table>

Tip You can find out more about MariaDB in our Digital Guide. Among other things, we [compare MariaDB and MySQL](https://www.ionos.com/digitalguide/hosting/technical-matters/mariadb-vs-mysql/) and explain [how to install MariaDB](https://www.ionos.com/digitalguide/hosting/technical-matters/install-mysql-mariadb/).


This is a markdown version of: [https://www.ionos.com/digitalguide/hosting/technical-matters/mariadb-data-types/](https://www.ionos.com/digitalguide/hosting/technical-matters/mariadb-data-types/) for AI/LLM consumption.