MySQL 8.3 Release Notes
给定一个字符串参数,该函数生成一个适合在 SQL 语句中使用的引号标识符。这在值作为标识符时是保留字或包含反引号(`
)字符时非常有用。
mysql> SELECT sys.quote_identifier('plain');
+-------------------------------+
| sys.quote_identifier('plain') |
+-------------------------------+
| `plain` |
+-------------------------------+
mysql> SELECT sys.quote_identifier('trick`ier');
+-----------------------------------+
| sys.quote_identifier('trick`ier') |
+-----------------------------------+
| `trick``ier` |
+-----------------------------------+
mysql> SELECT sys.quote_identifier('integer');
+---------------------------------+
| sys.quote_identifier('integer') |
+---------------------------------+
| `integer` |
+---------------------------------+