This topic describes the data types supported by AnalyticDB for MySQL and their differences from MySQL data types.

Data types supported by AnalyticDB for MySQL

Data type Description
BOOLEAN Valid values: 0 and 1. A BOOLEAN value is 1 bit in size.
  • 0: indicates false.
  • 1: indicates true.
TINYINT Valid values: -128 to 127. A TINYINT value is 1 byte in size.
SMALLINT Valid values: -32768 to 32767. A SMALLINT value is 2 bytes in size.
INT or INTEGER Valid values: -2147483648 to 2147483647. An INT value is 4 bytes in size.
BIGINT Valid values: -9223372036854775808 to 9223372036854775807. A BIGINT value is 8 bytes in size.
FLOAT Valid values: -3.402823466E+38 to -1.175494351E-38, 0, and 1.175494351E-38 to 3.402823466E+38. The FLOAT type follows the IEEE standard. A FLOAT value is 4 bytes in size.
DOUBLE Valid values: -1.7976931348623157E+308 to -2.2250738585072014E-308, 0, 2.2250738585072014E-308 to 1.7976931348623157E+308. The DOUBLE type follows the IEEE standard. A DOUBLE value is 8 bytes in size.
DECIMAL(M,D) M is the maximum precision, and its value range is 1 to 1000. D is the decimal scale. The value of D must be less than or equal to that of M.
VARCHAR A VARCHAR value can be up to 16 MB in size. You do not need to specify the size when you use VARCHAR.
DATE Valid values: '0001-01-01' to '9999-12-31'. A DATE value is in the 'YYYY-MM-DD' format and is 4 bytes in size.
TIME Valid values: '00:00:00' to '23:59:59'. A TIME value is in the 'HH:MM:SS' format and is 8 bytes in size.
DATETIME Valid values: '0001-01-01 00:00:00.000' to '9999-12-31 23:59:59.999'. A DATETIME value is in the 'YYYY-MM-DD HH:MM:SS' format. It is 8 bytes in size and in the UTC format.
Note By default, DATETIME uses UTC time. You cannot change the time zone for DATETIME values.
TIMESTAMP Valid values: '0001-01-01 00:00:00.000' to '9999-12-31 23:59:59.999'. A TIMESTAMP value is in the 'YYYY-MM-DD HH:MM:SS' format. It is 4 bytes in size and in the UTC format.
Note By default, TIMESTAMP uses the time zone of the database system. You can specify the time zone for each session.
JSON For more information, see JSON.
MULTIVALUE Multi-value column fields such as 1,2,3 and 1:a;2:bare supported. For more information, see Multi-value column.

Comparison with MySQL data types

AnalyticDB for MySQL MySQL Difference
BOOLEAN BOOL and BOOLEAN No difference.
TINYINT TINYINT No difference.
SMALLINT SMALLINT No difference.
INT and INTEGER INT and INTEGER No difference.
BIGINT BIGINT No difference.
FLOAT FLOAT[(M,D)] No difference.
DOUBLE DOUBLE[(M,D)] No difference.
DECIMAL DECIMAL AnalyticDB for MySQL supports a maximum precision of 1000 digits, whereas MySQL supports a maximum precision of only 65 digits.
VARCHAR VARCHAR The VARCHAR type in AnalyticDB for MySQL corresponds to the CHAR, VARCHAR, TEXT, MEDIUMTEXT, and LONGTEXT types in MySQL.
DATE DATE MySQL supports the value 0000-00-00, whereas AnalyticDB for MySQL automatically converts the value 0000-00-00 to NULL.
TIME TIME AnalyticDB for MySQL is precise to the millisecond. MySQL supports custom precision levels.
DATETIME DATETIME MySQL supports the value 0000-00-00 00:00:00, whereas AnalyticDB for MySQL automatically converts the value 0000-00-00 00:00:00 to NULL.

AnalyticDB for MySQL is precise to the millisecond. MySQL supports custom precision levels.

TIMESTAMP TIMESTAMP AnalyticDB for MySQL is precise to the millisecond. MySQL supports custom precision levels.