Question:What Are MySQL Data Types

Answer: MySQL server has many data types that cover many options to save on storage and limit the input from applications however the table below lists the most used types.

Type (length) Description
CHAR (length) Fixed length string size
VARCHAR (length) Variable length string (255 max length)
TEXT Character string (64k max)
INT (length) Integer (number) with limit set by the length, range can be set from -2147483648 to +2147483647
INT (length) UNSIGNED Integer number with limit set by the length, range from 0 to 4294967295
BIGINT Very large integer number, range from -9223372036854775808 to 9223372036854775870
BIGINT UNSIGNED Same as above but range from 0 to 18446744073709557615
DATE Date type as, YYYY-MM-DD
TIME Time type as, HH:MM:SS
DATATIME Date and time stored together as YYYY-MM-DD HH:MM:SS
ENUM Set value like yes or no
SERIAL Auto increment of BIGINT UNSIGNED (MySQL 5.0 and above)
DECIMAL (length, Dec) Decimal number, like 10.41

Posted

in

by