We know that the general SQL query statement is written as follows:
Copy codeThe Code is as follows: select col from table;
Of course this is okay, but what if the field name is "from?
Copy codeThe Code is as follows: select from table;
If this is true, an error is inevitable. When the field name conflicts with the reserved MySQL words, you can use the character "'" to enclose the field name:
Copy codeThe Code is as follows: select 'from' from table;
Summary
I just found that two fields in my original database table use reserved words (add, comment ). An error occurred during insert and update. I remember that SQL server seems to be surrounded. So I tried it and it turns out that it won't work in mySql. After a simple search on the Internet, we found that brackets were used. Later, I thought that the SQL statement generated by MySql Administrator would enclose all the table names in single quotes. After trying it out, it still won't work. But the generated symbol can be copied. Make sure that the symbol is not a single quotation mark. The marker ('is the key on the front of number 1 ). Solve this problem. The following is a summary:
In Mysql, when the table name, field name, or Database Name Conflict with the reserved word, you can use the marker (') in an SQL statement.