SQL Statement Compatibility specification

Source: Internet
Author: User

First, DDL Compatibility Specification (prevent the table structure changes, the original SQL execution error)
You can only add fields or modify field lengths (field lengths are larger), cannot modify field names and types, and cannot delete fields
cannot delete table or modify table name

ii. DML Compatibility Specification
INSERT statement needs to specify column, INSERT INTO table_name (column 1, column 2,...) Values (value 1, value 2,....)
the meaning of a field can only be expanded and not modified and reduced, and, if modified and reduced, must be replaced with a new field
Example One: For example, the sex field has two values: 0 for Male 1 for female, to swap these two values is not allowed:
update t1 Set sex = 2 where sex = 1;
update t1 Set sex = 1 where sex = 0;
update t1 Set sex = 0 where sex = 2;
because old code also think 0 is male 1 is female, and new code thinks 0 is female 1 is male;
Example Two: For example, the Sex field has 3 values: 0 for the male 1 for the female 2 for the unknown, the code inside the unknown before the judgment, if it is unknown, will do some things, but the other developers because of poor consideration, directly in the database to change all 2 value to 0 or 1, That could result in an older version of the code running incorrectly.

third, DQL compatibility specification
Disable SELECT *, you must specify a column

SQL Statement Compatibility specification

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.