Home  >  Q&A  >  body text

node.js - When node operates mysql, why do some query strings use backticks `` and some use double quotes ""

node operates mysql, why do some query strings use backticks ``, and some use double 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;
});
曾经蜡笔没有小新曾经蜡笔没有小新2698 days ago598

reply all(2)I'll reply

  • PHP中文网

    PHP中文网2017-05-31 10:41:18

    The opposite represents the field or table name of the database, which is special to the system. The double symbol just represents a string

    reply
    0
  • 为情所困

    为情所困2017-05-31 10:41:18

    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.

    reply
    0
  • Cancelreply