MySQL Share record

Source: Internet
Author: User

Today the company has a MySQL share, do a record, perhaps a lot of things very simple, but it is difficult for people who do not know

1. Store with minimal cost

For example, if you can determine that a field is stored in numbers, and the number must be no more than 127 or 255, then you should use tinyint instead of int

When you store integer types, each type takes on a different byte:

tinyint 1smallint 2mediumint 3int 4bigint 8 Additional order for enumeration information no meaning in shaping parentheses the number is unintentional Righteousness 2. Decimal (n,m) for rounding out the part after the decimal point, maximum value n 1-65 m 0-30

Based on the above theory, there is no need to consider overflow due to database limitations because a 65-bit shaping cannot be handled in Java

3. Character keystroke long char (n) 0,255 unit char is defined as 0, only null and empty string can be placed to be longer varchar (n) 255*255 unit char actually UTF-8 can store 64K/3 varchar

MySQL Share record

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.