MySQL data types (maximum and minimum)

MySQL data types (maximum and minimum)

1, integer

MySQL Data Types Meaning (Signed)
tinyint(m) A byte range (-128 to 127)
smallint(m) 2 byte range (-32768 to 32767)
mediumint(m) 3 byte range (~ -8388608 8388607)
int(m) 4 byte range (-2147483648 to 2147483647)
bigint(m) Range of 8 bytes (18 + -9.22 * 10 th)


Unsigned range if the increase, the maximum value is doubled, as tinyint unsigned ranges (0 to 255).

 

int (m) where m is the display width of a SELECT query result set, I do not know what is the use of this m.

 int accounted for 10, can not save phone number (11)

2, float (float and double) floating-point stored in the database are approximations

MySQL Data Types meaning
float(m,d) Total single precision floating point precision of eight bits (4 bytes) m number, d decimal places
double(m,d) The total 16-bit double precision floating point precision (8 bytes) m number, d decimal places


Field is defined as a set float (5,3), if a number is inserted 123.45678, actually stored in the database is 123.457, but also the total number of the actual subject, i.e., six.

3, fixed point designated type is stored in the database the exact value

Float stored in the database are approximations, and the fixed-point type stored in the database the exact value.

decimal (m, d) Parameters m <65 is the total number, d <30 and d <m is a decimal.

 

4, character string (char, varchar, _text)

MySQL Data Types meaning
char(n) Fixed length, up to 255 characters
varchar(n) Variable length, up to 65535 bytes
tinytext Variable length, up to 255 characters
text Variable length, up to 65,535 characters.
mediumtext Variable length, a maximum power of 24 characters -1 2
longtext Variable length, up to 32 characters power of 2 -1

Guess you like

Origin www.cnblogs.com/leijiangtao/p/11912035.html