My experiences with MYSQL (2)

Source: Internet
Author: User

My experiences with MYSQL (1)

My experiences with MYSQL (III)

My experiences with MYSQL (4)

Display width

 

You can specify the display width for All Integer Data Types in MYSQL, but not for SQLSERVER.

 

 

Create a table

  tb_emp( id ())

The data type of the id field is BIGINT (1). Note the following number 1, which indicates the display width specified by the data type and the number of digits that can be displayed.

For example, assume that an INT type field () is declared ()

This statement indicates that data in the year field usually only shows the width of four digits.

 

An error is reported in SQLSERVER.

 ())
Message, level, status, column, parameter, or variable: the column width cannot be specified for the data type.

 

 

The display width is irrelevant to the value range of the data type. The display width only specifies the maximum number of digits that MYSQL may display. If the number of digits is smaller than the specified width, a space is entered.

If you insert a value greater than the display width, as long as the value does not exceed the value range of this type of integer, the value can still be inserted and displayed.

For example, if you insert a value of 19999 into the year field and use the select statement to query data, MYSQL displays a full value of 19999 with five digits instead of a four-digit value.

 

 

If the display width is not specified, MYSQL specifies the default width for each type.

 

Tips: The display width is only used for display, and the value range and occupied space cannot be limited. For example, INT (3) occupies 4 bytes of storage space, and the maximum allowed value is not 999, but an INT integer.

The maximum value allowed.

 

If anything is wrong, you are welcome to make a brick o

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.