We know that the usual SQL query statements are written in this way:
Copy Code code as follows:
Select Col from table;
That's fine, of course, but what if the field name is "from"?
Copy Code code as follows:
Select from from table;
If this is true, there must be an error, when the field name conflicts with the MySQL reserved word, you can enclose the field name in the character "'":
Copy Code code as follows:
Select ' From ' from table;
Summarize
I just found two fields in the database I originally designed with reserved words (add,comment). An error occurred during insert and update. Remember that SQL Server seems to be surrounded by [] OK. So I tried it and it turned out to be a no-go in MySQL. A simple search on the internet found that the use of brackets. Then came the idea that the SQL statement generated by the MySQL administrator would enclose the table name in single quotes. Try it, or it won't work. But the symbolic discovery of the copy generated can be. Make sure that the symbol is not single quotes. A look is found when the apostrophe (' is the number 1 in front of the key). To solve this problem. Summed up is a sentence:
In MySQL, an apostrophe (') can be used in an SQL statement when a table name or field name or even a database name and a reserved word conflict.