Value range of various fields in MySQL

Source: Internet
Author: User

The following is the value range of each field in MySQL:

TINYINT
-128-127
TINYINT UNSIGNED
0-255
SMALLINT
-32768-32767
SMALLINT UNSIGNED
0-65535
MEDIUMINT
-8388608-8388607
MEDIUMINT UNSIGNED
0-16777215
INT or INTEGER
-2147483648-2147483647
Int unsigned or INTEGER UNSIGNED
0-4294967295
BIGINT
-9223372036854775808-9223372036854775807
BIGINT UNSIGNED
0-18446744073709551615
FLOAT
-3.402823466E + 38--1.175494351E-38
0
1.175494351E-38-3.402823466E + 38
DOUBLE, double precision, or REAL
-1.7976931348623157E + 308--2.225074255072014e-308
0
2.225074255072014e-308-1.7976931348623157E + 308
DECIMAL [(M, [D])] or NUMERIC (M, D)
It is determined by M (the length of the entire number, including the decimal point, the number of digits on the left of the decimal point, the number of digits on the right of the decimal point, but not the negative number) and D (the number of digits on the right of the decimal point, M is 10 by default, D is 0 by default
DATE
1000-01-01-9999-12-31
DATETIME
1000-01-01 00:00:00-9999-12-31 23:59:59
TIMESTAMP
2037 00:00:00-one day in December (I don't know which day, huh, huh)
TIME
-838: 59: 59' to 838: 59: 59
YEAR [(2 | 4)]
The default format is 4 bits. The value range of 4 bits is 1901-1970, 2069, and the value range of 2 bits is 70-69)
CHAR (M) [BINARY] Or NCHAR (M) [BINARY]
M ranges from 1 to 255. If BINARY is not available, it is case-insensitive. NCHAR indicates that the default character set is used. fill in space in the database, but the space at the end of the removal will be automatically removed.
[NATIONAL] VARCHAR (M) [BINARY]
M ranges from 1 to 255. spaces at the end of the database will be removed automatically.
TINYBLOB or TINYTEXT
255 (2 ^ 8-1) characters
BLOB or TEXT
65535 (2 ^ 16-1) characters
MEDIUMBLOB or MEDIUMTEXT
16777215 (2 ^ 24-1) characters
LONGBLOB or LONGTEXT
4294967295 (2 ^ 32-1) characters
ENUM ('value1', 'value2 ',...)
There can be a total of 65535 different values
SET ('value1', 'value2 ',...)
Up to 64 members


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.