Skip to main content

MySQL Main Data Types

SQL Numeric Data Types

DatatypeFromTo
bit01
tinyint0255
smallint-32,76832,767
int-2,147,483,6482,147,483,647
bigint-9,223,372,036,854,775,8089,223,372,036,854,775,807
decimal-10^38 +110^38 -1
numeric-10^38 +110^38 -1
float-1.79E + 3081.79E + 308
real-3.40E + 383.40E + 38

SQL Date and Time Data Types

DatatypeDescription
DATEStores date in the format YYYY-MM-DD
TIMEStores time in the format HH:MI:SS
DATETIMEStores date and time information in the format YYYY-MM-DD HH:MI:SS
TIMESTAMPStores number of seconds passed since the Unix epoch (‘1970-01-01 00:00:00’ UTC)
YEARStores year in 2 digit or 4 digit format. Range 1901 to 2155 in 4-digit format. Range 70 to 69, representing 1970 to 2069.

SQL Character and String Data Types

DatatypeDescription
CHARFixed length with maximum length of 8,000 characters
VARCHARVariable length storage with maximum length of 8,000 characters
VARCHAR(max)Variable length storage with provided max characters, not supported in MySQL
TEXTVariable length storage with maximum size of 2GB data