Data types and operators MySQL learning notes

Source: Internet
Author: User
Tags arithmetic arithmetic operators bitwise operators logical operators

  • MySQL data types describe numeric types (integer type tinyint,smallint,mediumint,int,bigint; floating point decimal data type float and double, fixed-point decimal type Decimal), Date/Time type (year, Time,date,datetime,timestamp) and String types (Char,varchar,binary,varbinary,blob,text,enum,set), string types are also divided into text strings and binary strings.
    • Integer type, you can add a auto_increment self-increment constraint condition.                          ,         &NB Sp                          ,         &NB Sp                          ,         &NB Sp                          ,         &NB Sp                          ,         &NB Sp                          ,         &NB Sp                          ,         &NB Sp                         &NBSP                          ,         &NB Sp        

      The number in parentheses after the data type when the table is created refers to the width of the change display, with the default display width for each type of integer, and the default width to show the maximum data that the data type can represent. The default width is as shown.                          ,         &NB Sp                          ,         &NB Sp                          ,         &NB Sp                    

    • floating-point types and fixed-point number types, float types have single-precision floating-point types and double-precision floating-point types. Fixed-point types have only one decimal type. In M,n, M is precision, representing the total number of digits, n is the scale, the number of decimal places                                                    ,         &N Bsp                          ,         &NB Sp                                

      D The storage space of the ecimal is determined by the precision value M.    float and double do not specify precision, the default is based on the actual precision (determined by the computer hardware and the operating system), decimal without specifying precision, default to (10,0)

    • Date and time   date and time type, format and range as shown                           &NB Sp                          ,         &NB Sp                          ,         &NB Sp                          ,         &NB Sp                          ,         &NB Sp                          ,         &NB Sp                          ,         &NB Sp                                                            ,         &N Bsp          
    • Text string type, support text string and binary string, where text string type such as                         &NB Sp                          ,         &NB Sp                          ,         &NB Sp                          ,         &NB Sp                          ,         &NB Sp                          ,         &NB Sp                          ,         &NB Sp                                  

    • Binary string, mainly with the following binary data types.                          ,         &NB Sp                          ,         &NB Sp                          ,         &NB Sp                          ,         &NB Sp                          ,         &NB Sp                          ,         &NB Sp                          ,         &NB Sp                           &NBSP                          ,         &NB Sp          

  • How to choose the data type to ensure that the normal situation, the smaller the space, the better.
  • Common operators describe arithmetic operators, comparison operators, logical operators, bit operators.
    • Arithmetic operators plus + minus-multiply * divide/seek redundancy or call modulo operator%.
    • Comparison operator     comparison operator as shown:                          &NBS P                          ,         &NB Sp                          ,         &NB Sp                          ,         &NB Sp                          ,         &NB Sp                          ,         &NB Sp                          ,         &NB Sp                                                           ,         &NB Sp                                

      where = equals and <=> security equals the difference is security equals can be compared to null

    • The logical operator results are true,false or null 1 to true,0 to false and null. :                                  nbsp                          ,         &NB Sp                          ,         &NB Sp                          ,         &NB Sp                          ,         &NB Sp                          ,         &NB Sp                          ,         &NB Sp                
    • Bitwise operators to test, shift, or test the bits in the binary byte. As shown in:                                                           ,         &N Bsp                          ,         &NB Sp                          ,         &NB Sp                          ,         &NB Sp                          ,         &NB Sp                          ,         &NB Sp                           &NBsp        

    •  

      Operator precedence as shown in:                              &NBSP ;                          ,         &NB Sp                          ,         &NB Sp                          ,         &NB Sp                          ,         &NB Sp                          ,         &NB Sp                          ,         &NB Sp                              /    &nbsp                          ,         &NB Sp                          ,         &NB Sp

Data types and operators MySQL learning notes

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.