MySQL Column Type Database
In this session you will learn how to support number of column in MySQL . MySQL supports the numeric type , Date and time type, and String type (char) database.
MySQL Numeric type and String type Database :
TYPE | BYTE | MINIMUM VALUE | MAXIMUM VALUE |
TINYINT | 1 Byte | -128 | 127 |
BIT | (M+7)/8 Byte | - | - |
SMALLINT | 2 Byte | -32768 | 32767 |
MEDIUMINT | 3 Byte | -8388608 | 8388607 |
INT(M) (UNSIGNED) (ZEROFILL) | 4 Byte | -2147483648 | 2147483647 |
INTERGER [M] | 4 Byte | - | - |
BIGINT [M] | 8 Byte | -9223372036854775808 |
9223372036854775807 |
FLOAT [precision] | 4 Byte | ||
FLOAT [(M, D)] | 8 Byte | ||
DOUBLE [(M,D)] | 8 Byte | ||
DOUBLE precision [(M, D)] | 8 Byte | -1.7976931348623157E+308 to-2.2250738585072014E-308, 0, | 2.2250738585072014E-308 to 1.7976931348623157E+308 |
REAL [(M, D)] | 8 Byte | ||
DECIMAL [(M ,D)] | M+2 Byte | -999.99 | 999.99 |
NUMERIC[(M,D)] | M+2 Byte | ||
VARCHAR | L+1 Byte | 0 | 255 |
CHAR | M Byte | 0 | 255 |
TINYBLOB | L+1 Byte | 0 | 256 |
TINYTEXT | L+1 Byte | 0 | 255 (2^8-1) Char |
BLOB OR TEXT | L+2 Byte | 0 | 65,535 (2^16-1)char |
MEDIUMBLOB | L+3 Byte | - | 16,777,215(2^24-1)char |
MEDIUMTEXT | L+3 Byte | - | 16,777,215(2^24-1)char |
LONGBLOB | L+4 Byte | - | 4,294,967,295(2^32-1)char |
LONGTEXT | L+4 Byte | - | 4,294,967,295 or 4GB |
ENUM ('value1, value2',..) | 1 or 2 Byte | 0 | 65,535 |
SET ('value1,' value 2,' .....) | 1 to 8 Byte | 0 | 64 |
MySQL Store the Date and Time Type
Column Type | Store Data |
DATE | 3 Byte |
DATETIME | 8 Byte |
TIMESTAMP | 4 Byte |
TIME | 3 Byte |
YEAR | 1 Byte |