Bit[(m)] bits (101001), M represents the length of bits (1-64), default M=1 tinyint[(m)] [unsigned] [zerofill] small integer, data type is used to hold a Range of integers: Signed:-128 ~ 127. Unsigned: 0 ~ 255 Special: MySQL has no boolean value and is constructed using tinyint (1). int[(M)][unsigned][zerofill] integer, data type is used to hold some range of integer numeric ranges: Signed: 2147483648 ~ 21474 83647 unsigned: 0 ~ 4294967295 Special: M in integer type is only for display and has no limit on storage range. For example: Int (5), when inserting data 2 o'clock, the data is displayed as: 00002 bigint[(m)][unsigned][zerofill] Large integer, data type is used to hold some range of integer numeric ranges: Signed:-9223372036854775808 ~ 9223372036854775807 unsigned: 0 ~ 18 446744073709551615 decimal[(m[,d]) [unsigned] [Zerofill] Accurate decimal values, M is the total number of digits (minus sign), D is the number of decimal points. The M maximum value is 65,d maximum of 30. Special: The reason why this type of decaimal is needed for accurate numerical calculations is that it stores the exact value internally as a string. float[(m,d)] [UNSIGNED] [Zerofill] single precision floating point number (non-accurate decimal value)), M is the total number of digits, and D is the number after the decimal point. Unsigned: -3.402823466E+38 to-1.175494351e-38, 0 1.175494351E-38 to 3 .402823466E+38 signed: 0 1.175494351E-38 to 3.402823466E+38 * The larger the value, the less accurate * * * * * * * * double[(M,D)] [UNSIGNED] [Zerofill] double-precision floating-point number (not accurate decimal value), M is the total numbers, D is the number after the decimal point. Unsigned: -1.7976931348623157E+308 to-2.2250738585072014e-308 0 2.225 0738585072014E-308 to 1.7976931348623157E+308 signed: 0 2.22507385850720 14E-308 to 1.7976931348623157E+308 * * * * * * * * The larger the value, the more inaccurate * * * CHAR (m) char data type is used to represent fixed-length strings and can contain up to 2 55 characters. where m represents the length of the string. PS: Even if the data is less than m length, the M-length varchar (m) Varchars data type is used for variable-length strings and can contain up to 255 characters. where m represents the maximum length of a string that is allowed to be saved by the data type, as long as a string that is less than the maximum value can be saved in that data type. Note: Although varchar is more flexible to use, the char data type is processed faster from the overall system performance, sometimesIt can even exceed 50% of the varchar processing speed. Therefore, users in the design of the database should be comprehensive consideration of various factors, in order to achieve the best balance text text data type used to save the large string of variable length, you can group more than 65535 (2**16 1) characters. Mediumtext a TEXT column with A maximum length of 16,777,215 (2**24? 1) characters. Longtext a TEXT column with A maximum length of 4,294,967,295 or 4GB (2**32? 1) characters. Enum enum type, an enum column can has a maximum of 65,535 distinct elements. (The practical limit is less than 3000.) Example: CREATE TABLE Shirts (name VARCHAR (+), size ENUM (' X-small ', ' SMA ll ', ' Medium ', ' large ', ' x-large ')); INSERT into shirts (name, size) VALUES (' Dress shirt ', ' large '), (' T-shirt ', ' Medium '), (' Polo shirt ', ' small '); Set set Type a set column can have a maximum of distinct members. Example: CREATE TABLE myset (Col SET (' A ', ' B ', ' C ', ' d ')); INSERT into MyseT (COL) VALUES (' A,d '), (' D,a '), (' A,d,a '), (' A,d,d '), (' d,a,d '); DATE Yyyy-mm-dd (1000-01-01/9999-12-31) Time HH:MM:SS (' -838:59:59 '/' 838:59:59 ') year YYYY (1901/2155) DATETIME yyyy-mm-dd HH:MM:SS (1000-01-01 00:00:00/9999-12-31 23:59:59 Y) TIMESTAMP YYYYMMDD HHMMSS (1970-01-01 00:00:00/2037 year)
Python-day11 Mysql Data type