Basic types of MySQL

Source: Internet
Author: User

Recently depressed, the conversion between the underlying type and Java type is unclear, and by the way the information on the Internet lists some types to remind

Mysql

1, integers:

MySQL data type Meaning (Signed)
tinyint (m) 1 byte range ( -128~127)
smallint (m) 2 byte range ( -32768~32767)
Mediumint (M) 3 byte range ( -8388608~8388607)
Int (m) 4 byte range ( -2147483648~2147483647)
BigInt (M) 8 byte Range (18 +-9.22*10 of the X-square)

2, floating-point type:

MySQL data type Meaning
Float (m,d) Single-precision floating-point 8-bit precision (4 bytes) m total number, D decimal place
Double (m,d) Double-precision floating-point 16-bit precision (8 bytes) m total number, D decimal place

3, fixed point: Decimal (m,d) parameter m represents the total number of digits but less than 65,d less than 30. It is worth noting that floating-point type is the approximate value, fixed-point type actual value

4. Character Type:

MySQL data type Meaning
CHAR (n) Fixed length, up to 255 characters
VARCHAR (n) Fixed length, up to 65,535 characters
Tinytext Variable length, up to 255 characters
Text Variable length, up to 65,535 characters
Mediumtext Variable length, up to 2 of 24 square-1 characters
Longtext Variable length, up to 2 of 32 square-1 characters

5. Time Type:

MySQL data type Meaning
CHAR (n) Fixed length, up to 255 characters
VARCHAR (n) Fixed length, up to 65,535 characters
Tinytext Variable length, up to 255 characters
Text Variable length, up to 65,535 characters
Mediumtext Variable length, up to 2 of 24 square-1 characters
Longtext Variable length, up to 2 of 32 square-1 characters

It is important to note that timestamp is updated with other Automatic updates to this data and can be used as an update time

6, binary number: Blob is stored in binary mode, no case, the data can only be read as a whole, blo do not specify a character set.

Basic types of MySQL

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.