MYSQL study notes four (data type)

A, MYSQL Based data types
supported by MySQL data types can be simply divided into three categories: the value, date / time and a character string (character) type.

Second, the value of type
Type Size range (signed) range (unsigned) Use
TINYINT 1 byte (-128,127) (0,255) small integer
SMALLINT 2 bytes (-32 768,32 767) (0, 65535) large integer
MEDIUMINT 3 bytes (-8388 608,8 388 607) (0,16 777,215) large integer
INT or iNTEGER 4 bytes (-2 147 483 147 483 647 648,2) (0 , 4294967295) large integer
BIGINT 8 bytes (-9,223,372,036,854,775,808,9 223,372,036,854,775 807) (0,18 446,744,073,709,551 615) maximum integer
FLOAT 4 bytes (-3.402 823 466 E + 38, -1.175 494 351 E- 38), 0, (1.175 494 351 E-38,3.402 823 466 351 E + 38) 0, (1.175 494 351 E-38,3.402 823 466 E + 38) single precision, floating point values
DOUBLE 8 bytes (-1.797 693 134 862 315 7 E + 308, -2.225 073 858 507 201 4 E-308), 0, (2.225 073 858 507 201 4 E-308,1.797 693 134 862 315 7 E + 308) 0, (2.225 073 858 507 201 4 E-308,1.797 693 134 862 315 7 E + 308) double precision floating-point values
DECIMAL of DECIMAL (M, D), if M> D, for the M + 2 otherwise D + 2 values are dependent on M and D is dependent on a small value the value of M and D,
three, date and time types
represent datetime values and the time of type DATETIME, DATE, TIMESTAMP, tIME, and YEAR.
Each type has a value of time effective range and a "zero" value of "zero" when the value of the specified unlawful MySQL can not be represented.

Type Size (byte) format uses a range
DATE 3 1000-01-01 / 9999-12-31 YYYY-MM -DD date value
TIME 3 '-838: 59: 59 ' / '838: 59: 59' HH: MM : SS time value or duration
YEAR 1 1901/2155 YYYY year value
DATETIME 8 1000-01-01 00: 00: 00 / 9999-12-31 23:59:59 YYYY-MM-DD HH: MM: SS date mixed and the time value
TIMESTAMP 4 1970-01-01 00: 00: 00/2038 , end time are 2,147,483,647 seconds, Beijing 2038-1-19 11:14:07 GMT, January 19, 2038 early morning 03:14 : 07 YYYYMMDD HHMMSS mixing date and time values, time stamp
four string type
string types CHAR, VARCHAR, BINARY, VARBINARY, BLOB, TEXT, ENUM and SET.

Type Size Used
CHAR 0-255 byte fixed-length string
VARCHAR 0-65535 bytes of variable-length string
TINYBLOB 0-255 255 byte binary string characters
TINYTEXT 0-255 bytes short text strings
BLOB 0 -65535 byte binary data in the form of long text
tEXT 0-65 535 bytes long text data
MEDIUMBLOB 0-16 777 215-byte binary text data in the form of medium length
MEDIUMTEXT 0-16 777 215-byte data length of the text medium
LONGBLOB 0 -4294967295 maximum byte binary form text data
LONGTEXT 0-4 294 967 295 bytes of text data greatly

Guess you like

Origin blog.51cto.com/14525650/2436570