node.js - When node operates mysql, why do some query strings use backticks `` and some use double quotes ""
曾经蜡笔没有小新
曾经蜡笔没有小新 2017-05-31 10:39:18
0
2
632

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;
});
曾经蜡笔没有小新
曾经蜡笔没有小新

reply all(2)
Ty80

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.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template