Day MySQL data type

Source: Internet
Author: User
Tags float double ranges

Data type

Truncate t1  (delete table) # unsigned type ALTER TABLE t1 modify ID tinyint unsigned (table has value, cannot be changed directly) desc t1

========================================        tinyint[(m)] [unsigned] [Zerofill]            small integer, data type used to hold some range of integer numeric ranges:            Signed:                -128 ~ 127 unsigned            :                0 ~ 255            ps:mysql No boolean value, constructed using tinyint (1). ========================================        int[(M)][unsigned][zerofill]            integer, data type is used to hold some range of integer numeric ranges:            signed:                    -2147483648 ~ 2147483647 unsigned            :                    0 ~ 4294967295========================================        bigint[( m)][unsigned][zerofill]            large integer, data type used to hold some range of integer numeric ranges:            signed:                    9223372036854775808 ~ 9223372036854775807 Unsigned            :                    0  ~  18446744073709551615

Note: When you specify a width for this type, you only specify the display width of the query results, regardless of the storage scope, as follows

In fact, we don't have to specify a display width for an integer type, so you can use the default.

The default display width, which is based on the maximum value plus 1

The storage width of int is 4 bytes, or 32 bit, i.e. 2**32

The unsigned maximum value is: 4294967296-1

Signed Maximum: 2147483648-1

Signed and unsigned maximum numbers require a display width of 10 and 11 bits for a signed minimum value to display completely, so the default display width of int type is 11 is very reasonable

Finally: the type of shaping, in fact, there is no need to specify the display width, using the default is OK

Does not limit the bytes stored

Zerofull Not enough width to fill with 0

2, floating-point type

Fixed-point number type Dec equals decimal

Float type: float double

Function: Store salary, height, weight, physical parameters, etc.

====================================== #FLOAT [(m,d)] [UNSIGNED] [Zerofill] Definition:        single-precision floating-point numbers (not accurate decimal values), M is the total number of numbers, D is the number after the decimal point. The M maximum value is 255,d with a maximum value of 30 signed:           -3.402823466E+38 to-1.175494351e-38,           1.175494351E-38 to 3.402823466E+38 unsigned:           1.175494351E-38 to 3.402823466E+38 accuracy:            * * * with the increase in decimals, accuracy becomes inaccurate ****====================================== #DOUBLE [ (M,D)] [UNSIGNED] [Zerofill] Definition:           double precision floating point number (not accurate decimal value), M is the total number of numbers, D is the number after the decimal point. The M maximum value is 255,d with a maximum value of 30 signed:           -1.7976931348623157E+308 to-2.2250738585072014e-308           2.2250738585072014E-308 to 1.7976931348623157E+308 unsigned:           2.2250738585072014E-308            to 1.7976931348623157E+308 accuracy:           * * * * with the increase in decimals, Accuracy is higher than float, but it becomes inaccurate ****======================================decimal[(m[,d]) [unsigned] [Zerofill]  (most precise) definition:          accurate decimal value, M is the total number of digits (minus sign), D is the number after the decimal point. The M maximum value is 65,d maximum of 30. Accuracy:           * * * * with the increase of decimals, accuracy is always accurate * * *           for accurate numerical calculations, this type           of Decaimal is used to store exact values because they are stored internally as strings.

Iii. Type of date

Date Time datetime timestamp tear

Role: Store user registration time, article release time, employee entry time, birth time, expiration time, etc.

Day MySQL data type

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.