Node.js Tutorial – Delete Record from MySQL Table

Posted by

The tutorial provides the node.js integration with MySQL for deleting record from the mysql table. The tutorial provides the steps on how to delete record from mysql table using node.js application .

Delete Record from MySQL Table using node.js

The MySQL uses ‘DELETE FROM’ statement for deleting records into mysql table. Ensure that you have the mysql table with ecords before proceeding with the record deletion process.

var mysql = require('mysql');  
var con = mysql.createConnection({  
  host: "localhost",  
  user: "root",  
  password: ""  ,
  database: "oracleappshelpDB"
});
con.connect(function(err) {
  if (err) throw err;
  con.query("DELETE FROM oracleappshelpusers WHERE firstName = 'Amit'",  function (err, result) {
    if (err) throw err;
    console.log(result);
  });
});

Execute the SELECT SQL node.js program and it will show the remaining records now.