MySQL data type
Data type specifies the particular type of data used with their possible value and the way of that values to be stored. Different datatype with their size and value are listed below:
Data Type | Maximum Size | Explanation |
CHAR(size) | Maximum size of 255 characters. | A fixed-length string between 1 and 255 characters in length. Defining a length is not required, but the default is 1. |
VARCHAR(size) | Maximum size of 255 characters. | A variable-length string between 1 and 255 characters in length. For example, VARCHAR(25). You must define a length when creating a VARCHAR field |
TEXT(size) | Maximum size of 65,535 characters. | Where size is the number of characters to store. |
INT(m) | Standard integer value. | If unsigned, the allowable range is from 0 to 4294967295. You can specify a width of up to 11 digits. |
FLOAT(m,d) | Single precision floating point number. | A floating-point number that cannot be unsigned. You can define the display length (M) and the number of decimals (D). This is not required and will default to 10,2, where 2 is the number of decimals and 10 is the total number of digits |
DOUBLE(m,d) | Double precision floating point number. | A double precision floating-point number that cannot be unsigned. Default to 16,4. |
DATETIME | Values range from ‘1000-01-01 00:00:00’ to ‘9999-12-31 23:59:59’. | A date and time combination in YYYY-MM-DD HH:MM:SS format, between 1000-01-01 00:00:00 and 9999-12-31 23:59:59 |
BLOB(size) | Maximum size of 65,535 bytes. | BLOBs are “Binary Large Objects” and are used to store large amounts of binary data, such as images or other types of files. |
ENUM | An enumeration, is used for creating a list of items from which the value must be selected (or it can be NULL). |