MySQL Learning experience 2

Source: Internet
Author: User

1tinyint small~ medium~ int big~ float double Dec (m,d) fixed-point number range is determined by MD for bit (M) bit type bit (1) bit (64).

2zerofill padding 0 such as ALTER TABLE T1 modify ID1 int zerofill;1 becomes 000001 the assumption is that int (6) in the case of INT (6) you enter 8 digits and do not stage Zerofill will automatically add UNS to the column change IGN Properties

3auto_increment can be used when generating unique identifiers and sequential values.

such as CREATE TABLE AI (id INT auto_increment not NULL, PRIMARY KEY (id));

or create TABLE AI (ID INT auto_increment not NULL PRIMARY KEY);

CREATE TABLE AI (id INT auto_increment not NULL, UNIQUE (ID));

4 fixed-point number in MySQL string storage is more precise than floating-point number m stands for M-digits (integer + decimal) d is the number after the decimal point, also known as precision and scale

5mysql when the value is saved to rounding such as float (7,4) Insert 999.00009 get 999.0001 dec at unspecified precision when default to (10,0) in traditional SQL beyond the qualified data cannot be inserted Dec MySQL will alarm

The 6bit field can be used to view the Select Bin (id) in bin () and Hex (), Hex (ID) from T2, and inserting data in fields with insufficient number of bits is not feasible.

MySQL Learning experience 2

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.