MySQL learning note--2. Column type

Source: Internet
Author: User

1.tinyint

Takes one byte and has a value range of -128~127

unsigned: unsigned, i.e. no negative (0~255)

Used in the representation of Boolean type/weight data

2.int //integral type

Accounted for four bytes

Zerofill: 0 padding without specifying unsigned

3.decimal (m,d) //floating-point

Compared to float, it is more precise

M,d: Total number of digits, number of decimal places

4.char (m) //fixed-length

The value range of M is 0~255

For data that is not long enough, the space is added automatically, although it is wasteful, but faster

5.varchar (m) //variable-length

The value range of M is 0~65535

6.text //text type

Its query speed is slow, try to use char or varchar instead

7.blob //binary type

For storing data such as images, audio, etc.

8.date //Date

Year-month-day range: 1000-01-01~9999-12-31

9.time //Time

Hours: minutes: seconds

10.datetime //Date Time

Year-month-day time: minutes: seconds

11.year //year

Range: 1901~2155 and 0000

12. Precautions

Try to use fixed length type, query efficiency is high; less use varchar, text length

Logon time does not use a datetime type and still uses the int type to store timestamps

@zhnoah
Source: http://www.cnblogs.com/zhnoah/
This article is owned by me and the blog Park, Welcome to reprint, but without the consent of the author must retain this paragraph, and in the article page obvious location to the original
The right to pursue legal liability.

MySQL learning note--2. Column type

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.