MySQL- Quick Start (2)

1, MySQL supports a variety of data types:

  1 "Value Type: integer type tinyint, smallint, mediumint, bigint, int; floating point type float, double; decimal point type decimal.

  2 "Date / Time Type: year, time, date, datetime, timestamp.

  3 "string type: char, varchar, binary, varbinary, blob, text, enum, set.

2, various types of data Explanation:

  1 "integer type:

   

   

   2 "type of floating-point and fixed-point types

    MySQL is used to represent floating-point and fixed-point decimal. There are two floating point numbers: single precision floating point number (float) and double precision floating point (double). Only one fixed point type: decimal.

    Floating-point and fixed-point type can be used type (M, N) is represented, where M is called precision, represents the total number of bits; N referred to scale, shows a number of decimal places.

    

    Unlike decimal type float and double, actual decimal string is stored, the maximum possible decimal value range as double, but the effective range determined by the values ​​of M and D. If the change is fixed M D, the value range with the larger M becomes large. Which occupies storage space is not fixed, is M + 2 bytes.

type of data Yes / No Symbol Minimum Maximum
float Type Range There ranges symbol -3.402823466E+38 -1.175494351E-38
Unsigned range 0 and 1.175494351E 3.402823466E+38
double Type Range There ranges symbol -1.7976931348623157E + 308 -2.2250738585072014E-308
Unsigned range 0 and 2.2250738585072014E-308 1.7976931348623157E + 308

    Whether it is fixed-point or floating-point type, if the user exceeds the specified precision accuracy range, the rounding processing. float, double precision when not specified, the default will be (determined by the computer hardware and operating system) in accordance with the actual accuracy, decimal precision if not specified, the default is (10,0).

    3 "Date and Time Types

       There are: datetime, date, timestamp, time, year.

       

 

   1>year:

  Input Format range Examples
In four strings or four digits represent year format 'YYYY'或YYYY '1901'~'2155' Enter '2010' or 2010
In two strings represented year format '00' ~ '69 'value into the range of 2000 to 2069;' 70 '~' 99 'is converted to 1970 to 1999. '0' and '00' which acts as an insert exceeding the range of values ​​will be converted to 2000. '00'~'99'  
To 2 digits represent year 1 to 69 is converted to 2001 to 2069; 70 ~ 99 1970 ~ 1999 is converted. But 0 value will be converted to 0000, rather than 2000. Illegal year value will be converted to 0000. 1~99  

   2>time:

Guess you like

Origin www.cnblogs.com/ZeroMZ/p/11450522.html