Differences between different databases (MySQL expands ANSISQL)

Source: Internet
Author: User
MySQL contains some features that cannot be found in ANSISQL. The following describes several items.

2. MySQL expands ANSI SQL
MySQL contains some features that cannot be found in ansi SQL. The following describes several items.
(1) comment
Using special MySQL SQL statements will make SQL statements no longer compatible with other database management systems. Therefore, MySQL provides a form of annotation, which can be "/*!... */Write MySQL special code in the form of annotations
In the comment. In this way, SQL is not run when running on other database management systems, and in MySQL, the code in the comment will also be executed by MySQL. For example, the following code adds the TEMPORARY keyword to the comment.
CREATE /*! TEMPORARY */TABLE MyTable (coll int );
In this case, the SQL statement actually executed in MySQL is not annotated, as shown below.
Create temporary table MyTable (coll int );
In other database management systems, the SQL statements actually executed are as follows.
Create table MyTable (coll int );
For different MySQL versions, you can also use the annotation method to differentiate them. The method is in the exclamation mark "! "Write the version later. in this way, the code in the comment will only run under the MySQL version above this version, as shown in the following code:
.
CREATE /*! 40102 TEMPORARY */TABLE MyTable (coll int );
The preceding SQL statement used when MySQL version is later than or equal to 4.1.2 is as follows.
Create temporary table MyTable (coll int );
In earlier versions, the SQL statements actually executed are as follows.
Create table MyTable (coll int );
(2) logical judgment in SELECT statements
MySQL provides the logical judgment function in SELECT statements. The logical judgment operators include =, <>, <=, <,> =,>, AND, OR, and like. When the logic is established, the return value is 1; otherwise, the return value is 0.
(3) Limit statement
MySQL provides a Limit clause to SELECT records in the query results. this clause is generally placed at the end of the SELECT or DELETE statement. Note that when the limit clause is used, the number of the first record is 0.

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.