Mysql data type _ MySQL

Source: Internet
Author: User
Mysql data type bitsCN.com

Integer type:

The default value is signed. you can use unsigned to identify unsigned objects.

Create table tbl_int (a tinyint unsigned, // unsigned B tinyint // it is signed by default );

Define the display width:Data type (M) M indicates the minimum display width. The data display width is specified to achieve unified display.

      Must be filled with leading zeros. Format: data type(M) zerofill;

alter into tb1_int  add c tinyint(2) zerofill;

Decimal type:

FLOAT has a default precision of about 6 to 7 digits. when it is set to 8 digits, the precision will be lost. if the number of decimal places exceeds the limit, it will be rounded down.
DOUBLE has a default precision of 16 to 17 digits. if the number of digits exceeds 16, the number of digits with precision will be reduced to a value greater than the decimal number.

Control the value range:

Type (M, D) MRepresents the number of digits (excluding decimal places and symbols) DNumber of allowed decimal places

create table num_1(A Float(5,2),B double(8,2));

Floating point numbers support scientific notation:
1.2345*10 ^ 3-----1.2345E3

Date and time type:

YEAR Type:

The method for assigning values to fields of the YEAR type:

1. use 4 as a string or number to indicate the input format 'yyyy' or yyyy

                  

BitsCN.com

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.