Insira múltiplas fileiras no banco de dados SQL com NodeJs
// Function to insert multiple Row in database
let multipleRowInsert = () => {
// Query to insert multiple rows
let query = `INSERT INTO gfg_table
(name, address) VALUES ?;`;
// Values to be inserted
let values = [
['Amit', 'Yellow Park'],
['Rishi', 'Park 38'],
['Akash', 'Central st 954'],
['Pratik', 'Road 989'],
['Mangesh', 'Sideway']
];
// Executing the query
db_con.query(query, [values], (err, rows) => {
if (err) throw err;
console.log("All Rows Inserted");
});
};
Breakable Beetle