MySQL Different Data Types Tutorial
MySQL data types are :numeric,string,date,time and large object data type
NUMERIC Data Types
It supports the numeric data types (INT,FLOAT, REAL,DOUBLE and DECIMAL).
INT: A normal-sized integer that can be signed or unsigned. If signed, the allowable range is from -2147483648 to 2147483647. If unsigned, the allowable range is from 0 to 4294967295. You can specify a width of up to 11 digits.
TINYINT:Very small integer can be Signed or unsigned.
SMALLINT: Small integer can be signed or unsigned.
MEDIUMINT:Medium-sized integer can be signed or unsigned.
BIGINT:Big sized integer can be signed or unsigned.
FLOAT(m,d):It is unsigned.
DOUBLE(m,d):It cannot be unsigned.
DECIMAL(m,d): An unpacked floating-point number that cannot be unsigned.
Date and Time Data Types
Following are the function of MYSQL date and time.
DATE Displayed as 'yyyy-mm-dd'.
DATETIME Displayed as 'yyyy-mm-dd hh:mm:ss'.
TIMESTAMP(m) Displayed as 'YYYY-MM-DD HH:MM:SS'.
TIME Displayed as 'HH:MM:SS'.
YEAR[(2|4)] Default is 4 digits.
String Data Types
CHAR(size) :Maximum size of 255 characters. Where size is the number of characters to store. Fixed-length strings. Space padded on right to equal size characters.
VARCHAR(size) :Maximum size of 255 characters. Where size is the number of characters to store. Variable-length string.
TINYTEXT(size): Maximum size of 255 characters. Where size is the number of characters to store.
TEXT(size): Maximum size of 65,535 characters. Where size is the number of characters to store.
MEDIUMTEXT(size): Maximum size of 16,777,215 characters. Where size is the number of characters to store.
LONGTEXT(size): Maximum size of 4GB or 4,294,967,295 characters. Where size is the number of characters to store.
BINARY(size): Maximum size of 255 characters. Where size is the number of binary characters to store. Fixed-length strings. Space padded on right to equal size characters.
VARBINARY(size): Maximum size of 255 characters.
Where size is the number of characters to store. Variable-length string.
Large Object Data Types
Large object data consist of :TINYBLOB,BLOB,MEDIUMBLOB and LONGTEXT
TINYBLOB Maximum size of 255 bytes.
BLOB(size) Maximum size of 65,535 bytes.
MEDIUMBLOB Maximum size of 16,777,215 bytes.
LONGTEXT Maximum size of 4gb or 4,294,967,295 characters.