Datasheet basic data types

1. Digital Type

Integer: tinyint (small integer): a byte 

     int (integer): four bytes. Note: int width refers to the width of the display, regardless of the storage 

     BIGINT (large shaping): eight-byte 


decimal: 

     a float : inaccuracy in the case of a relatively short number of bits ( **** The larger the value, the less accurate **** ) 

     Double : not accurate at longer median case ( **** the larger the value, the more inaccurate **** ) 

     decimal : If a decimal, decimal is recommended 

           because accurate, internal principle to deposit in the form of a string of 
decimal (total number of digits after the decimal point a few)

2. Character Types

char : it is not enough lobbied for a space to store up fixed length, a waste of space, but the memory speed 
    (sacrificing space and improve speed) 
VARCHAR (you have to keep a few a few): precise, calculate the length of data to be stored, saving space, slow access speed 
        (sacrificing speed and improve efficiency)

3. Date

datatime: 2019 - 10 - 25  . 17 : 43 is : . 19 
Data: 2019 - 10 - 25 
Time: . 17 : 43 is : . 19 
year : 2019 
timeatamp: datatime is the same and is supported by a range of large datatime

4. enumeration and collection

Value of the field only in a given range selected, such as radio buttons, checkboxes 

enum enumeration: a predetermined range: The range may have multiple, but when the value for the field pass, which can only be taken within a predetermined range a 
set collections: a predetermined range: the range may have multiple, but when the field for the traditional values, may take one or more within a predetermined range 
enum value if you do not pass, is the first default value, or a NUll
- -------- enumeration and set ----------- 
Create  Table STU1 ( 
ID int  Primary  Key AUTO_INCREMENT, 
name char ( . 5 ), 
Sex enum ( ' MALE ' , ' FEMALE ' ), on behalf of enumerated type #enum 
hobbies sET ( ' EAT ' , ' Play ' , ' Study ' , ' Coding ' ) # sET Representative set type 
); 
INSERT  INTO STU1 (name, Sex, hobbies)values ( ' Haiyan ' , ' none ' , ' dsfdg ' );
 SELECT  *  from STU1; # If the sex is an enumerated type, wherein it is selected from the inside of a stored set of
 INSERT  INTO STU1 (name, sex, hobbies) values ( ' Haiyan ' , ' FEMALE ' , ' Play, Study ' );
 SELECT  *  from STU1; # hobbies if set is a collection type, which have one or more values selected from the set to keep the inside

 

Guess you like

Origin www.cnblogs.com/li33232/p/11739337.html