Académique Documents
Professionnel Documents
Culture Documents
String Datatypes
The following are the String Datatypes in MySQL:
Data Type Syntax
Maximum Size
CHAR(size)
A fixed-length string
between 1 and 255
characters in length
size number of
characters to
store
VARCHAR(size)
A variable-length
string between 1
and 255 characters
in length
size number of
characters to
store
TINYTEXT(size)
Maximum size of
255 characters.
TEXT(size)
Maximum size of
65,535 characters.
MEDIUMTEXT(size
)
Maximum size of
16,777,215
characters.
LONGTEXT(size)
Maximum size of
4GB or
4,294,967,295
characters.
Maximum size of
255 characters.
BINARY(size)
Explanation
Maximum Size
Explanation
VARBINARY(size)
Maximum size of
255 characters.
Numeric Datatypes
The following are the Numeric Datatypes in MySQL:
Maximum Size
Explanation
BIT
TINYINT(m)
SMALLINT(m)
MEDIUMINT(m)
INT(m)
or
INTEGER(m)
BIGINT(m)
DECIMAL(m,d)
Default to 10,0
DEC(m,d)
NUMERIC(m,d)
FIXED(m,d)
FLOAT(m,d)
Decimal precision: 24
places
Default to 10,2, where 2 is
the number of decimals and
10 is the total number of
Date/Time Datatypes
The following are the Date/Time Datatypes in MySQL:
Data Type
Syntax
Maximum Size
Explanation
DATE
Format: 'YYYY-MMDD'.
DATETIME
Format: 'YYYY-MM-DD
HH:MM:SS'.
TIMESTAMP(m)
Format: 'YYYYMMDD
HHMMSS'.
TIME
Format: 'HH:MM:SS'.
YEAR[(2|4)]
Default is 4 digits.
Maximum Size
TINYBLOB
BLOB(size)
Binary Large
Objects
MEDIUMBLOB
Maximum size of
16,777,215 bytes.
LONGTEXT
ENUM
Explanation