Check out example codes for "sql insert into node js". It will help you in understanding the concepts better.

Code Example 1

var mysql = require('mysql');

var con = mysql.createConnection({
  
  host: "localhost",
  user: "yourusername",
  password: "yourpassword",

    database: "mydb"

  });

con.connect(function(err) {
  if (err) throw err;
  console.log("Connected!");

    var sql = "INSERT INTO customers (name, address) 
  VALUES ('Company Inc', 'Highway 37')";
  
  con.query(sql, function (err, result) {
    if (err) throw err;
    console.log("1 record inserted");
  });
});

Learn ReactJs, React Native from akashmittal.com