Type | Bytes per record | Type of data |
tinyint | 1 | integers -127 through 127 |
smallint | 2 | integers -32768 to 32767 |
mediumint | 3 | integers -8388608 to 8388607 |
int | 4 | integers -2147483648 to 2147483647 |
bigint | 8 | integers -9223372036854775808 to 9223372036854775807 |
float | 4 | floating point numbers 3.402823466E+38 to -1.175494351E-38, 0, and 1.175494351E-38 to 3.402823466E+38 |
double | 8 | floating point numbers -1.7976931348623157E+308 to -2.2250738585072014E-308, 0, and 2.2250738585072014E-308 to 1.7976931348623157E+308 |
date | 3 | Stores a date 1000-01-01 to 9999-12-31. |
time | 3 | Stores a time -838:59:59 to 838:59:59. |
datetime | 8 | Stores a date and time 1000-01-01 00:00:00 to 9999-12-31 23:59:59. |
timestamp | 4 | Stores a timestamp. Setting this to a null causes it to store the current time. This is often used to record the last time a record was updated. Allowed values are the same as unixtime (1970-2037). |
year | 1 | Stores a year 1901 to 2155 (and 0000). Can be displayed with 2 or 4 digits. |
char (n) | n | Stores a string n chars. n <= 255. Note that this is case specific but not case sensitive. |
varchar (n) | numchars+1 | Like char except the length of the string can be up to n chars instead of exactly n chars. Note that this is case specific but not case sensitive. |
binary (n) | n | Stores a string n chars. n <= 255. Unlike char this allows any binary character and is case sensitive. |
varbinary (n) | numchars+1 | Like binary except the length of the string can be up to n chars instead of exactly n chars. Unlike varchar this allows any binary character and is case sensitive. |
blob/text | numchars+2 | Like varbinary/varchar except this allows up to 2^16 chars. |
mediumblob/mediumtext | numchars+3 | Like varbinary/varchar except this allows up to 2^24 chars. |
longblob/longtext | numchars+4 | Like varbinary/varchar except this allows up to 2^32 chars. |
enum | 1 or 2 depending on size of list | This is an enumeration of set string values. They can be any string you want and each record has one of the listed values. |
---|
set | 1,2,3,4, or 8 depending on the number of members | This is like enum except each record can have 0-64 of the set members. |
---|