Is there a difference between using the query with [] and without? I'm supposed to choose the best one that does the same thing as this SELECT * FROM books WHERE name LIKE 'Pride and Prejudice'; but when I use both queries in node.js, they give the exact same output?
db.query("SELECT * FROM books WHERE name LIKE ?;",
"Pride and Prejudice",
(err, result) => { // the rest of the code...});
db.query("SELECT * FROM books WHERE name LIKE ?;",
["Pride and Prejudice"],
(err, result) => { // the rest of the code...});
?then you don't have to use an array. Use one or the other, it's up to you, there's no difference.