Menu BAR

FEEL FREE TO ASK ANY PROGRAM and please mention any error if you find it

15 Nov 2022

Node JS program to connect to SQL table and use WHERE clause

  ## Node JS program to connect to SQL table and use WHERE clause ## 

var mysql = require ('mysql');

// create a connection 
var con = mysql.createConnection({
    host: "localhost",
    user: "admin",
    password: "admin",
    database: "dummy"
});

con.connect(function(err)){
    if (err) throw err;

    con.query("Select * from student where age>15", function (err, result, fields) {
    if (err) throw err;
   
    console.log (" Result is: ", result);
    });
});

No comments:

Post a Comment