Mysql /*! */Description

Source: Internet
Author: User

Mysql /*! */Is often seen in MySQL SQL statements or SQL files as follows:

SELECT /*!40001 SQL_CACHE */ * FROM pre_common_syscache WHERE cname IN ('ipbanned')/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;

 

This is just an hint. 40001 SQL _CACHE means that the database needs to cache the entire SQL statement. There is also the hint/*... */of SQL _NO_CACHE, which is also a comment in most languages. The statements in this example are not executed. However, to maintain compatibility in MYSQL, for example, SQL statements exported from mysqldump can be directly used by other databases, and it places some specific statements only on MYSQL on /*! ... */, So that these statements will not be executed in other databases, but will be executed in MYSQL. 1.8.4. MySQL expands standard SQL. MySQL servers include some extensions not available in other SQL DBMS. Note: if they are used, the Code cannot be transplanted to other SQL servers. In some cases, you can write code that contains MySQL extensions, but still maintain their portability by using "/*... */" to comment out these extensions. In this example, the MySQL server can parse and execute the code in the comment, just like other MySQL statements, but other SQL servers will ignore these extensions. Example: SELECT /*! STRAIGHT_JOIN */col_name FROM table1, table2 WHERE... if the character "!" Later, the version number is added. Only when the MySQL version is equal to or higher than the specified version number will the syntax in the comment be executed: CREATE /*! 32302 TEMPORARY */TABLE t (a INT); this means that if your version number is 3.23.02 or higher, the MySQL server uses the TEMPORARY keyword.

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.