NodeJs Mysql Delete

Lets create a file “node-delete.js” with below code
var db = require('mysql');  
var con = db.createConnection({  
host: "localhost",  
user: "root",  
password: "password" ,
database : "Student" 
con.connect(function(err) {  
if (err) throw err;  
var sqlQuery = "delete from emp where id = 1";
con.query(sqlQuery, function (err, result) {  
if (err) throw err;  
console.log("record deleted");  

Below SS shows Output of this program.

node mysql delete query

Below SS shows output from Mysql.

node mysql delete output

Subscribe Now