Ten, mysql data types

Reference Url: Https://Www.Bilibili.Com/video/BV12b411K7Zu?P=132

1, numeric:

  A , int

    分类:tinyint(1)smallint(2)mediumint(3)int/integer(4)bigint(8)

      a)  The default is signed, to set an unsigned need to add unsigned keyword

      b)  to insert integer value exceeds the range, it will be reported out of range abnormality, and the insertion threshold

      c)  If you do not set the length, there will be a default length, the length represents the maximum width of the display, and if not will use 0 fill in on the left, but must be used with zerofill use

      d)  zero padding ZEROFILL , the default case for the unsigned integer

 

  b , decimals:

      classification:

        a) fixed point

          Dec(M,D)

          Decimal(M,D)

        b) Float

          Float(M,D)

          Double(M,D)

       Features:

        a)

          M : integer portion of the fractional portion +

          D : decimal site

          If out of range, then the threshold value is inserted

        b)

          M and D can be omitted.

          If a decimal, the M defaults to 10 , D defaults to 0

          If float and Double , the value would be determined by the accuracy of the inserted

        c) high accuracy fixed point, if asked to insert money value as high precision fixed-point arithmetic, consider using

        d) principles:

        Type chosen as simple as possible, to save the value type can be as small as possible

2 , character:

Short text: char , VARCHAR

Longer text: text , BLOB ( long binary data )

 

3, date:

1) Data only to save the date

2) Datatime  save the date + time

3) Timestamp  save the date + time

4) Time  only save time

5) Year  save only in

Guess you like

Origin www.cnblogs.com/nuochengze/p/12583990.html