Home > Database > Mysql Tutorial > What are mysql escape characters?

What are mysql escape characters?

coldplay.xixi
Release: 2020-11-17 09:30:07
Original
8927 people have browsed it

The mysql escape character is [`], which is used to avoid keyword conflicts between column names or table names and mysql itself. It is usually used to indicate that the contents are database names, table names, and field names, not keywords. .

What are mysql escape characters?

` is the MySQL escape character, used to avoid keyword conflicts between column names or table names and mysql itself.

All databases have similar settings, but mysql uses `. It is usually used to indicate that the contents are database names, table names, and field names, not keywords. For example:

select * from table_name where `key` = 'key_name';
Copy after login

Among them, key is the keyword of mysql. If the column name is key, it needs to be escaped with ``.

Extension: \ needs to be used in the string to escape `, otherwise an error will be reported with a syntax error.

mysql -uUser -pPasswd -e "select * from table_name where \`key\` = 'name';"
Copy after login

More related free learning recommendations: mysql tutorial(video)

The above is the detailed content of What are mysql escape characters?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template