Mysql Build table data type selection

Source: Internet
Author: User

Integer type:

tinyint, smallint, mediumint, int, bigint respectively use 8, 16, 24, 32, 64-bit storage space, in the case of ensuring that the storage value is sufficient, select the smallest data type

Real type (when a fractional part is included):

Decimal

String type:

VarChar type stores variable length strings

Char stores fixed-length string performance up to char (1) to store t/f Boolean

Date and Time type:

DateTime can hold a wide range of values 1001 to 9999 he encapsulates the date and time into a YYYYMMDDHHMMSS integer that is independent of the time zone use 8 bytes of storage space

Timestamp saved the number of milliseconds since midnight January 1, 1970 to 2038 storage values will typically change depending on the time zone should be used as much as possible timestamp than datetime performance

Special types of data:

Timestamp YYYYMMDDHHMMSS general use of int storage can be converted to a time type with from_unixtime function as a high efficiency

The IP address is generally stored in int (10) Inet_aton () ip-> digital Inet_ntoa () digital->ip

    


Mysql Build table data type selection

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.