Select all records from the "customers" table, and display the result object on console.
var mysql=require("mysql");
var con=mysql.createConnection({
host:"localhost",
user:"root",
password:"root",
database:"js"
});
con.connect(function(err){
if(err) throw err;
console.log("connected");
});
var q="select * from customer";
con.query(q,function(err,result,fields){
if(err)
throw err;
console.log(result);
});
q="delete from customer where address='pune' ";
con.query(q,function(err,result)
{
if(err)
throw err;
});
console.log("After delet records are");
q="select * from customer ";
con.query(q,function(err,result,fields){
if(err)
throw err;
console.log(result);
});