One, integer
Integer and Smallint,mysql are supported in standard SQL to extend the tinyint, mediumint, and bigint.
MySQL supports specifying the display width of the data type, such as int (8), which specifies that the display width of type int is 8.
MySQL supports bool and Boolean in the SQL standard, but is converted to tinyint (1).
Second, floating point and fixed-point number
MySQL uses floating-point float, double, and fixed-point decimal to represent decimals.
MySQL supports specifying the precision and scale of floating and fixed-point numbers, precision refers to the total length of the data, and the scale refers to the length after the decimal point. For example, decimal (M,D) specifies a precision of M and a scale of D.
The storage space for a decimal is determined by its precision, and defaults to a 10-bit integer if not specified.
Third, date and time
Year, date, time, datetime, and timestamp represent dates and times.
In addition to TIMESTAMP using Current_time or Now () to get the current system time, TIMESTAMP uses current_timestamp, NULL, or does not specify a value to get the current system time.
Four, string
Both char and varchar types Specify a maximum length at creation time, for example, char (32) specifies that the maximum length of the string is 32. VarChar can dynamically allocate space within the maximum length.
TEXT can only hold character data, including Tinytext, TEXT, Mediumtext, and Longtext.
Enum and set are predefined list of strings, where the strings in the enum list are numbered in the order they are declared. Enum can only select single values from the list, and set can select multiple values.
Five or two binary
Both binary and barbinary types specify a maximum length at creation time, such as binary (32) specifying the maximum length of the binary number is 32. The varbinary can dynamically allocate space within the maximum length.
The bit type also specifies the maximum length when it is created, but the difference is that the maximum length supported by bit is 64.
BLOBs, Tinyblob, Mediumblob, and Longblob types are used to hold large data volumes of binary data, such as cases.
MySQL Notes: Data types