MySQL data types
• datatypes are rules that define what data may be
stored in a column and how that data is actually
stored.
• Major MySQL datatypes are
▫ String
▫ Numeric
▫ Date and time
▫ Binary
String Datatypes
• Fixed-length strings :
▫ fixed number of characters.
• variable-length strings:
▫ text of variable length
• manipulate fixed length faster than variable
length.
String datatypes
Datatype Description
Char Fixed-length string from 1- 255 Chars long. size must be
specified at create time.
VARCHAR same as Char but the size is maximum.
Enum Accepts one of a predefined set of upto 64K strings.
SET Accepts zero or more of a predefined set of upto 64K strings.
TEXT variable length string with the maximum size of 64 K
MEDIUMTEXT TEXT with maximum size of 16K
TINYTEXT TEXT with maximum size of 255 BYTES
LONGTEXT TEXT with maximum size of 4GB