Limit in node mysql

Limit in node mysql

var mysql = require(‘mysql’);

var con = mysql.createConnection({
host: “localhost”,
user: “root”,
password: “”,
database: “nodejs”
});

con.connect(function(err) {
if (err) throw err;
var sql = “SELECT * FROM customers LIMIT 2”;
con.query(sql, function (err, result) {
if (err) throw err;
console.log(result);
});
});

Leave a Reply