MySQL data type

Source: Internet
Author: User
Tags mysql command line

 data type 1, Signed number calculation principle such as tinyint accounted for 1 bytes or 8 bits:-2 of 7 square =-128~2 7 -1=127tinyint of 1 bytes unsigned value range 0~255, signed number range -128~127smallint accounted for 2 bytes unsigned number of values range 0~ 65535, the number of signed values range -32768~32768mediumint 3 bytes unsigned number range 0~16777215, the number of signed value range -8388608~8388608int 4 bytes of unsigned value range 0~ 4294967295, signed number value range -2147483648~2147483647bigint 8 bytes unsigned number range 0~18446744073709551615, signed number range-9223372036854775808 ~92233720368547758072, the default display width is the same as the display width of the minimum value of the signed number. Because the minus sign here occupies a position. If you do not specify a width, the type has a default display width. Default: Tinyint (4), smallint (6), Mediumint (9), int (11), bigint (20), int (4) is the specified int type with a display width of 4. When the display width of the inserted data is greater than the setting's display width is less than the default width, the data can still be inserted and the correct value is displayed, setting the display width to expire when the record is displayed.  The data width cannot be greater than the default width. Note that displaying data in navicate or phpmyadmin may not be correct, if you add Zerofill, but not 0, you can go to the MySQL command line. 3. When using the Zerofill parameter, MySQL automatically adds the unsigned attribute. Then the integer type can only represent the unsigned number, and its display width is 1 smaller than the default width. Example: Create table pet49 (name tinyint zerofill); insert into pet49 values (1);mysql> select * FROM pet49;+------+| Name |+------+|  001 |+------+1 row in Set (0.00 sec) 

MySQL data type

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.