how to insert mysql database records in node.js

The tutorial provides the node.js integration with MySQL to insert records into the mysql database. The tutorial provides the steps on how to insert new record into mysql table using node.js application .

Insert Record into MySQL Table using node.js

The MySQL uses ‘INSERT INTO ‘ statement for inserting records into mysql table. Ensure that you have the mysql table created before proceeding with the table record insertion process.

var mysql = require('mysql');  
var con = mysql.createConnection({  
  host: "localhost",  
  user: "root",  
  password: ""  ,
  database: "oracleappshelpDB"
con.connect(function(err) {
  if (err) throw err;
  console.log("MySQL Database oracleappshelpDB is Connected successfully!");
  var sql = "INSERT INTO oracleappshelpusers (firstName, lastName,address) VALUES ('Mohit', 'Sharma', 'Sydeny 2000')";
  con.query(sql, function (err, result) {
    if (err) throw err;
    console.log(" Record isnerted inot the table oracleappshelpUsers successfully...");