Fields in SQL can have many different types. This part of the tutorial focuses on the different types supported by the MySQL database management system.
MySQL types
MySQL supports many types of values. The following table contains a few types supported by MySQL. For a full list look at W3 Schools' list which this list takes it's inspiration.
Data type | Description |
---|---|
INT(size) | An integer from -2147483648 to 2147483647. |
TINYINT(size) | An integer from -128 to 127. 0 to 255. |
VARCHAR(length) | A string (can contain alphanumeric and special characters). Can store up to 255 characters. |
TEXT | Holds a string with a maximum length of 65,535 characters |
FLOAT(size, decimal_length) | A small number with a floating decimal point. |
DOUBLE(size, decimal_length) | A large number with a floating decimal point. |
DECIMAL(size, decimal_length) | A DOUBLE stored as a string. |
CHAR(length) | A fixed length character array of up to 255 characters. |
BLOB | Binary Large OBject. Holds up to 65,535 bytes of data |
ENUM(option_1, option_2, option_3, ..., option_n) | A selection of options. If a value is inserted that is not in the list, a blank value will be inserted. |
DATE | A date in the format of YYYY-MM-DD. |
Did you know my courses are all printer-friendly? This means you can easily export them to PDF or print them for later use.