What are the data types of MySQL? This article will give you a detailed explanation of MySQL data types. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.
MySQL data types
MySQL common data types include numerical values, dates and times, and strings
Number
Integer Types (Exact Value)
Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT
int
tinyint
bigint
Fixed point types ( Fixed-Point Types (Exact Value) - DECIMAL, NUMERICDECIMAL(5,2): 5 represents precision, 2 represents scale; represents This column can store a total of 5 digits, accurate to 2 decimal places; Storage range: -999.99 ~ 999.99
NUMERIC is NUMERICExplanation: What is the precision? The decimal point integer digits cannot exceed the previous precision.
decimal(0) The default is decimal(10,0)
Floating-Point type (approximate value)-Floating
Floating-Point Types (Approximate Value) - FLOAT, DOUBLEfloat If you store 4bytesfloat (7,4), you will see a display like this: -999.9999. MySQL performs rounding when storing the value, so if you insert 999.00009 into a floating (7,4) column, the approximate result is 999.0001
If M and D are omitted, values are stored to the limits permitted by the hardware.
double stores 8 bytes
Time and date
Date 'YYYY-MM-DD'. The supported range is '1000-01-01' to '9999-12-31'
Date time combination 'YYYY-MM-DD HH:MM:SS' The supported range is '1000-01-01 00 :00:00' to'9999-12-31 23:59:59'.
##TIMESTAMP:Timestamp '1970-01-01 00:00:01.000000' UTC to '2038-01-19 03:14:07.999999' Note: It cannot be equal to '1970-01-01 00:00:00' and will return to zero;
TIME:Time'-838:59:59.000000' to '838:59:59.000000' Note: '11: 12' means '11:12:00', not '00:11:12' ; '1112' and 1112 as meaning '11:12:00; by default, out-of-range values will be automatically converted to close values , eg: '-850:00:00' and '850:00:00' are converted to '-838:59:59' and '838:59:59'; invalid time values will be converted to '00 :00:00'
YEAR:String
CHAR:
0 to 255 fixed length, padded with spaces when storing; delete the following spaces when reading, PAD_CHAR_TO_FULL_LENGTH sql mode enabled
VARCHAR:BLOB:
TEXT:
##BINARY and VARBINARY:
Summary: The above is all of this article Content, I hope it will be helpful to everyone's study. For more related tutorials, please visit mysql database graphic tutorial ,
MySQL video tutorialThe above is the detailed content of What are the MySQL data types? Detailed explanation of MySQL data types. For more information, please follow other related articles on the PHP Chinese website!