About MySQL implicit conversions

Source: Internet
Author: User

If the table defines a varchar field and the number is passed in, an implicit conversion occurs.

1. Table DDL

2, the SQL to pass int

3. String-Passed SQL

Take a closer look at the table structure, the field type of RID:

  

When the user comes in int, there is an implicit conversion problem, and implicit conversions cause a full table scan.

Change the input to a string type and execute the plan as follows, and it will be quick.

In addition, it is important to note that:

0001 of the numeric type is equivalent to 1

0001 and 1 of strings are not equivalent

Second, if the table defines an int field, the string is passed in, no implicit conversions occur within the range of int, and if the range is out of scope and the size of the comparison (' $ ' compared to the string type) is implicitly converted.

1. Table DDL

2. sql that does not exceed the range string

3, not over-range data-borne SQL

  

4. SQL out-of-range string

5, out-of-range data-passing SQL

About MySQL implicit conversions

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.