node operates mysql, why do some query strings usebackticks ``, and some usedouble quotes ""? Is there any meaning? I hope to answer your questions
//查询 var selectSQL='select * from `mytable`'; //添加 var insertSQL='insert into `mytable` (`name`)values("mary")'; //修改 var updateSQL='update `mytable` set `name`="caton" where name="mary"' //删除 var deleteSQL='delete from `mytable` where `name` like "caton"'; //执行SQL connection.query(updateSQL, function(err, rows) { if (err) throw err; });
The opposite represents the field or table name of the database, which is special to the system. The double symbol just represents a string
The function of single quotes is to enclose a string. The function of backticks is completely different from that of single quotes.
If you have a field named key, then you should enclose the key in backticks.
Because the key is in In MySQL, it is a keyword. If it is not enclosed in backticks, it will cause syntax parsing errors.