[MySQL] mysql 5.7 sql_mode parameter analysis

mysql> select version();
+------------+
| version()  |
+------------+
| 5.7.32-log |
+------------+
1 row in set (0.00 sec)

mysql> select @@GLOBAL.sql_mode;
+-------------------------------------------------------------------------------------------------------------------------------------------+
| @@GLOBAL.sql_mode                                                                                                                         |
+-------------------------------------------------------------------------------------------------------------------------------------------+
| ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |
+-------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

ONLY_FULL_GROUP_BY
For SQL that uses GROUP BY to query, fields that do not appear in GROUP BY are not allowed in the SELECT part.
That is, the fields in the SELECT query must be those that appear in GROUP BY or use aggregate functions or have unique attributes.

STRICT_TRANS_TABLES
This option is effective for transactional storage engines, but invalid for non-transactional storage engines. This option indicates that the strict sql mode is enabled.
In strict sql mode, in the INSERT or UPDATE statement, if a field value that does not meet the requirements is inserted or updated, an error will be reported directly to interrupt the operation

NO_ZERO_IN_DATE
The time field value inserted in MySQL does not allow the date and month to be zero

NO_ZERO_DATE
The time field value inserted in MySQL does not allow the date to be zero

ERROR_FOR_DIVISION_BY_ZERO
In an INSERT or UPDATE statement, if the data is divided by 0, a warning (in non-strict sql mode) or an error (in strict sql mode) will occur.
When this option is turned off, the number is divided by 0, NULL is obtained without warning
When this option is enabled and in non-strict sql mode, the number is divided by 0, and NULL is obtained but a warning will be generated
When this option is enabled and in strict sql mode, the number is divided by 0, an error occurs and the operation is interrupted

NO_AUTO_CREATE_USER
The GRANT syntax was used in the previous version. If the user does not exist, the user will be created automatically. This option restricts this function

NO_ENGINE_SUBSTITUTION
When using the CREATE TABLE or ALTER TABLE syntax to execute the storage engine, if the set storage engine is disabled or not compiled, an error will occur.


Guess you like

Origin blog.51cto.com/13598811/2590881