Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

insert multiple Row in SQL database with 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");
    });
};
Comment

PREVIOUS NEXT
Code Example
Javascript :: angular server start command 
Javascript :: how to import json data from a local file 
Javascript :: jquery for element which doesnt exist on page load 
Javascript :: import url from json angular 
Javascript :: delay javascript 
Javascript :: javascript print to pdf 
Javascript :: react hooks send data from child to parent 
Javascript :: update a certain key in dictionary javascript 
Javascript :: how to convert a number to a string in javascript 
Javascript :: how to push two values in array at once 
Javascript :: node.js brotli 
Javascript :: celebrate node js 
Javascript :: js check null 
Javascript :: aws secret manager nodejs 
Javascript :: javascript last in a list 
Javascript :: Send Email sgMail 
Javascript :: Modify the function increment by adding default parameters so that it will add 1 to number if value is not specified. 
Javascript :: javascript check if undefined or null or empty string 
Javascript :: what is node js 
Javascript :: string contains at least one number 
Javascript :: multiple image upload in react js 
Javascript :: array permutation 
Javascript :: express js sample project 
Javascript :: jquery validation stop form submit 
Javascript :: make 2div in row react js 
Javascript :: javascript slice and substring 
Javascript :: vue boolean 
Javascript :: css react 
Javascript :: render image in vue 
Javascript :: javascript decimals without rounding 
ADD CONTENT
Topic
Content
Source link
Name
2+6 =