MySQL field type detailed

Source: Internet
Author: User

One, non-numeric type

Type

Range

Description

Char (N) [binary]

n=1~255 characters
Binary: Distinguish case

Fixed length

Std_name Cahr (+) NOT NULL

VarChar (N) [binary]

n=1~255 characters
Binary: Distinguish case

Variable length

std_address varchar (256)

Tinyblob

Maximum length 255 characters (2^8-1)

Blob (binary Large objects) stores binary data and is case-sensitive

Memo text NOT NULL

Tinytext

Maximum length 255 characters (2^8-1)

Blob

Maximum length 65,535 characters (2^16-1)

Text

Maximum length 65,535 characters (2^16-1)

Mediumblob

Maximum length 16,777,215 characters (2^24-1)

Mediumtext

Maximum length 16,777,215 characters (2^24-1

Longblob

Maximum length 4,294,967,295 characters (2^32-1)

Longtext

Maximum length 4,294,967,295 characters (2^32-1)

Enum

The maximum number of collections is 65535

Enumeration (enumeration), enum radio, set check

Sex enum (1,0)
Habby set (' Play video games ', ' Sleep ', ' watch movies ', ' Listen to music ')

Set

The maximum number of collections is 64


Distinguish between null and not null:null to allow null values to be stored (NULL)

Second, the number type

Type

Range

Description

For example

TINYINT[M] [UNSIGNED]

-128~127
unsigned:0~255

Num tinyint unsigned

SMALLINT[M] [UNSIGNED]

-32768~32767
unsigned:0~ 65535

MEDIUMINT[M] [UNSIGNED]

-8388608~8388607
unsigned:0~16777215

INT[M] [UNSIGNED]

-2^31~2^31-1
Unsigned:0~2^32

BIGINT[M] [UNSIGNED]

-2^63~2^63-1
Unsigned:0~2^64

Float [(M,D)]

-3.4e+38~3.4e+38 (approx)

Note: M is length, D is decimal, Float 4 bytes,double 8 bytes

Double [(M,D)]

-1.79e+308~1.79e+308 (approx)

Decimal [(M,D)]

Distinguish Zerofill: When declaring a keyword Zerofill to fill 0 automatically, such as 000021

Iii. Date and time

Type

Range

Description

Date

Date (YYYY-MM-DD)

Time

Time (HH:MM:SS)

Datetime

Date and time combination (Yyyy-mm-dd hh:mm:ss)

TimeStamp

Yyyymmddhhmmss

Year

Year yyyy

MySQL field type detailed

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.