MySQL data type

Source: Internet
Author: User

MySQL data type

Integral type

Key words

Length

TINYINT

1Byte

SMALLINT

2Byte

Mediumint

3Byte

INT | INTEGER

4Byte

BIGINT

8Byte

Floating-point / fixed- point

Key words

Length

FLOAT

4

DOUBLE

8

DECIMAL (M, N)
Note:m indicates the total length of the number m(not decimal)
N indicates n digits after the decimal point
for Example:DECIMAL (7, 3) is 0000.000

M+2

Date type

Key words

Length

Meaning

Year

0000

Years

DATE

0000:00:00

Month Day

Time

00:00:00

Hours and seconds

Datetime

0000-00-00 00:00:00

Month and day time

TIMESTAMP

00000000000000

starting from 1970-01-01 08:00:01

String type / text type

Key words

Length

Meaning

CHAR (N)

N

string with a fixed length of N

VARCHAR (N)

Max is N

Variable-length string with a maximum length of N

Note: TheCHAR type automatically ignores left and right spaces, and theVARCHAR type automatically ignores the blank space.

Tinytext

1Byte characters

Actual stored character length +2

TEXT

2Byte characters

Actual stored character length +2

Mediumtext

4Byte characters

Actual stored character length +3

Longtext

8Byte characters

Actual stored character length +4

Enum type / collection type

Key words

Meaning

ENUM (' A ', ' B ', ' C ')   note: up to 65535 members

Data only allowed is a , b , c One of the

SET (' A ', ' B ', ' C ') Note: Up to five members

Data allowed is one or more of a,B,C

Note: Both the enumeration and the members of the collection are numbered starting with 1,and0 is an error.
Note: Both enumerations and collections automatically contain NULL members.

Binary type

Key words

Meaning

BINARY (M)

A binary type with a fixed length of MB

VARBINARY (M)

variable Long binary type with a maximum length of MB

BIT (M)

M -bit binary length data. Note: Max .

Tinyblob

255 a bit .

Blob

2^16-1 a byte

Mediumblob

2^24-1 a byte

Longblob

2^32-1 a byte

MySQL data type

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.