Fun about MySQL

Source: Internet
Author: User
Tags mysql manual

In general, MySQL is more interesting than I think (it can even be used as a calculator). Now I will summarize my experience over the past half month, I hope to share it with you.

Interesting 1. MySQL internally stores the decimal data type as a string. Oh! Store the value type as a string (of course, MySQL does this because it wants to provide services in the most accurate way ).

Interesting 2. Differences between the char type and the varchar type. The difference between them is only in the way of processing parameters in parentheses. Char regards this size as the exact size of the value (fill in the short information with spaces, so this effect is achieved ); varchar regards it as the maximum data size, and only uses the number of bytes actually required for the storage string ).

Interesting 3. MySQL does not let go of any illegal data. Even if you want to insert '2017-02-29 'into a data type field, it will be rejected.

Interesting aspect 4. "<>" operator. Maybe you can't imagine it before you get into mysql. It turns out to be a non-equal sign in MySQL, which is quite interesting and has a very personalized non-equal sign.

Quest 5. Select 'hero' = 'hero'; the result is 1. The return value of select 'hero' = 'hero' is 0. This is because MySQL ignores the spaces behind the string, while the spaces above are retained. (Note the space position in SQL statements)

Qudian 6, select 6 = NULL; and select 88 <> NULL; the corresponding results are null. This is because a comparison operation that includes a null value usually produces a null value.

Interesting points 7. "<=>" operator. It is also a more personalized operator. MySQL Manual calls it "null secure" equal to the operator.

Qu Dian 8. Select "" is null; the result is 0. MySQL makes a clear distinction between null and null values.

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.