MySQL SQL Mode and MySQLSQLMode

Source: Internet
Author: User

MySQL SQL Mode and MySQLSQLMode
The MySQL server can work in different SQL modes and apply these modes to different clients in different ways. In this way, applications can customize server operations to meet their own needs. This mode defines the SQL syntax that MySQL should support and the validation check on the data. You can use the "-- SQL-mode =" modes "option to set the default SQL mode by starting mysqld. You can also use the SET [SESSION | GLOBAL] SQL _mode = 'modes 'statement to change the mode by setting the SQL _mode variable after startup.
Common SQL _mode values are as follows:
ONLY_FULL_GROUP_BY: For group by aggregation operations, if the columns in SELECT are not in group by, this SQL statement is invalid because the columns are not in the GROUP BY clause.
NO_AUTO_VALUE_ON_ZERO: This value affects the insertion of auto-increment columns. By default, insert 0 or NULL to generate the next auto-growth value. If you want to insert a value of 0, and the column is auto-incrementing, this option is useful.
STRICT_TRANS_TABLES: In this mode, if a value cannot be inserted into a transaction table, the current operation is interrupted without any restrictions on non-transaction tables.
NO_ZERO_IN_DATE: In strict mode, zero date and month are not allowed.
NO_ZERO_DATE: set this value. mysql databases do not allow zero-date insertion. If zero-date insertion is performed, an error is thrown instead of a warning.
ERROR_FOR_DIVISION_BY_ZERO: During the INSERT or UPDATE process, if the data is divided by zero, an error is generated instead of a warning. If this mode is not provided, MySQL returns NULL when data is divided by zero.
NO_AUTO_CREATE_USER: forbid GRANT to create a user with a blank password
NO_ENGINE_SUBSTITUTION: if the required storage engine is disabled or not compiled, an error is thrown. If this value is not set, it is replaced by the default storage engine and an exception is thrown.
PIPES_AS_CONCAT: regards "|" as the concatenation operator of a string rather than the OR operator. This is the same as the Oracle database and is similar to the Concat function of the String concatenation function.
ANSI_QUOTES: After ANSI_QUOTES is enabled, the string cannot be referenced using double quotation marks because it is interpreted as an identifier.
Note: SQL Mode can be set to multiple modes separated by commas.

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.