Loading lesson path
Concept visual
Start at both ends
The data type of a column defines what value the column can hold: integer, character, money, date and time, binary, and so on. Each column in a database table is required to have a name and a data type. An SQL developer must decide what type of data that will be stored inside each column when creating a table. The data type is a guideline for SQL to understand what type of data is expected inside of each column, and it also identifies how SQL will interact with the stored data. Always check the documentation! Data types might have different names in different databases. And even if the name is the same, the size and other details may be different! MySQL Data Types (Version 8.4) In MySQL there are three main data types: String, Numeric, and Date and Time.
Formula
A fixed - length string (can contain letters, numbers, and special characters).size specifies the column length in characters, from 0 to 255. Default size is 1
Formula
A variable - length string (can contain letters, numbers, and special characters).size specifies the maximum column length in characters, from 0 to 65535
Similar to CHAR(), but stores binary byte strings. size specifies the column length in bytes. Default size is 1
Similar to VARCHAR(), but stores binary byte strings. size specifies the maximum column length in bytes.
A BLOB column with a maximum length of 65535 bytes
A BLOB column with a maximum length of 255 bytes
A BLOB column with a maximum length of 16777215 bytes
A BLOB column with a maximum length of 4294967295 or 4GB bytes
Holds a string with a maximum length of 65535 bytes
A TEXT column with a maximum length of 255 characters
A TEXT column with a maximum length of 16777215 characters
A TEXT column with a maximum length of 4294967295 or 4GB bytes ENUM(val1, val2, val3, ...) A string object that can have only one value, chosen from the list of possible values (val1, val2, val3,..). You can list up to 65535 values. If a value is inserted that is not in the list, a blank value will be inserted SET(val1, val2, val3, ...) A string object that can have zero or more values, chosen from the list of possible values (val1, val2, val3,..). You can list up to 64 values
size )
Formula
A bit - value type.size indicates the number of bits per value, from 1 to 64. The default value for size is 1.
size )
Formula
A very small integer. Signed range is from - 128 to 127. Unsigned range is from 0 to 255.size specifies the minimum display width (max display width is 255)
A value of zero is considered as false, nonzero values are considered as true.
size )
Formula
A small integer. Signed range is from - 32768 to 32767. Unsigned range is from 0 to 65535.size specifies the minimum display width (max display width is 255)