MySQL data types
MySQL groups its column types into numeric, date and time, string, spatial and JSON types. Supported in the tables below means TableAI shows the value in the grid and lets you edit it where the column allows editing. MySQL checks the column type and constraints when it runs a change.
What are the MySQL numeric types?
Section titled “What are the MySQL numeric types?”| Type | What it stores | TableAI |
|---|---|---|
TINYINT |
1-byte integer, -128 to 127 (0 to 255 unsigned) | Supported |
SMALLINT |
2-byte integer, -32,768 to 32,767 (0 to 65,535 unsigned) | Supported |
MEDIUMINT |
3-byte integer, -8,388,608 to 8,388,607 (0 to 16,777,215 unsigned) | Supported |
INT, INTEGER |
4-byte integer, -2,147,483,648 to 2,147,483,647 (0 to 4,294,967,295 unsigned) | Supported |
BIGINT |
8-byte integer, -2^63 to 2^63-1 (0 to 2^64-1 unsigned) | Supported |
DECIMAL, NUMERIC |
Exact fixed-point number with a set precision and scale | Supported |
FLOAT |
Approximate single-precision number | Supported |
DOUBLE, REAL |
Approximate double-precision number | Supported |
BIT |
A bit-value of 1 to 64 bits | Supported |
BOOL, BOOLEAN |
Synonym for TINYINT(1); 0 is false, other values are true |
Supported |
What are the MySQL date and time types?
Section titled “What are the MySQL date and time types?”| Type | What it stores | TableAI |
|---|---|---|
DATE |
A calendar date | Supported |
TIME |
A time of day or an elapsed time, with optional fractional seconds | Supported |
DATETIME |
A date and time, with optional fractional seconds | Supported |
TIMESTAMP |
A date and time stored as UTC and converted to the session time zone, with optional fractional seconds | Supported |
YEAR |
A year | Supported |
What are the MySQL string and binary types?
Section titled “What are the MySQL string and binary types?”| Type | What it stores | TableAI |
|---|---|---|
CHAR(n) |
Fixed-length text, padded to n characters |
Supported |
VARCHAR(n) |
Variable-length text up to n characters |
Supported |
TINYTEXT |
Text up to 255 bytes | Supported |
TEXT |
Text up to 65,535 bytes | Supported |
MEDIUMTEXT |
Text up to 16,777,215 bytes | Supported |
LONGTEXT |
Text up to 4,294,967,295 bytes | Supported |
BINARY(n), VARBINARY(n) |
Fixed-length and variable-length byte strings | Supported |
TINYBLOB, BLOB, MEDIUMBLOB, LONGBLOB |
Byte strings with the same size limits as the four text types | Supported |
ENUM |
One value from a list declared in the column | Supported |
SET |
Zero or more values from a list declared in the column | Supported |
What are the MySQL JSON and spatial types?
Section titled “What are the MySQL JSON and spatial types?”| Type | What it stores | TableAI |
|---|---|---|
JSON |
A JSON document, validated and stored in a binary format | Supported |
GEOMETRY |
Any spatial value | Supported |
POINT, LINESTRING, POLYGON |
A single point, line or polygon | Supported |
MULTIPOINT, MULTILINESTRING, MULTIPOLYGON, GEOMETRYCOLLECTION |
A collection of spatial values | Supported |
How does TableAI show each MySQL value?
Section titled “How does TableAI show each MySQL value?”| Type | Value format in the grid |
|---|---|
| Integer types, including unsigned integers | Integer digits |
DECIMAL, NUMERIC |
Exact decimal text, including all supplied digits |
FLOAT, DOUBLE |
Floating-point numbers |
CHAR, VARCHAR, TEXT |
Text |
DATETIME, TIMESTAMP |
Date and time text, including supplied fractional seconds |
BIT |
A string of bits, padded to the column width when available |
JSON |
JSON text |
ENUM, SET |
The selected text values |
BINARY, VARBINARY, BLOB |
A binary size indicator in the grid |
| Spatial types | Well-known text (WKT) for supported geometries |
Use read results for inspecting cells and edit data safely for the editing steps.
Numbers and dates
Section titled “Numbers and dates”DECIMAL and NUMERIC retain the full decimal spelling returned by MySQL. For example, 12345678901234567890.1234567890 keeps its digits and scale. FLOAT and DOUBLE represent approximate numbers; use a decimal column when your data requires exact decimal arithmetic.
Date and timestamp text preserves the server’s representation, including fractional seconds and zero dates returned by MySQL. The server’s SQL mode determines which date values it accepts.
JSON, sets, and spatial values
Section titled “JSON, sets, and spatial values”Enter JSON using JSON syntax, such as {"tags":["fiction","history"]}. A JSON array remains a JSON value.
For ENUM and SET, use the values declared in the column definition. Inspect that definition through table structure before changing a value.
Spatial values use WKT, such as POINT(1 2). An SRID can appear as a prefix, for example SRID=4326;POINT(1 2). TableAI uses that SRID when constructing an edited spatial value.
NULL and column defaults
Section titled “NULL and column defaults”Use Set to NULL for SQL NULL, and Set to DEFAULT when you want MySQL to supply the column default. Empty text and the literal text NULL remain text values.
The full NULL and DEFAULT editing rules apply to MySQL. For file formats and their NULL options, see import and export.
Related
Section titled “Related”Use edit rejected for a type or constraint error, and error 1062 for a duplicate key. Return to the MySQL overview, or see how TableAI works as a MySQL client for Mac.