Node JS - Node js MySQL SELECT | Node.js MySQL SELECT Unique Record - Node - Node JS tutorial - webnode




Select form a table :

  • Retrieve a unique data from the table "employees".
  • Create a js file named selectwhere.js having the following data in DB example folder.
 node-js mysql select

Learn Node js - node js Tutorial - node-js mysql select - node - Node js Examples

selectwhere.js

var mysql = require('mysql');  
var con = mysql.createConnection({  
host: "localhost",  
user: "wiki",  
password: "wikitechy12345",  
database: "wikitechy"  
});  
con.connect(function(err) {  
if (err) throw err;  
con.query("SELECT * FROM employees WHERE id = '1'", function (err, result) {  
if (err) throw err;  
console.log(result);  
});  
});  
  • Now open command terminal and run the following command: Node selectwhere.js

Output:

 node unique select

Learn Node js - node js Tutorial - node unique select - node - Node js Examples

Node.js MySQL Select Wildcard

  • Retrieve a unique data by using wildcard from the table "employees".
  • Create a js file named selectwildcard.js having the following data in DBexample folder.
mysql = require('mysql');  
var con = mysql.createConnection({  
host: "localhost",  
user: "wiki",  
password: "wikitechy12345",  
database: "wikitechy"  
});  
con.connect(function(err) {  
if (err) throw err;  
con.query("SELECT * FROM employees WHERE city LIKE 'A%'", function (err, result) {  
if (err) throw err;  
console.log(result);  
});  
});  
  • Now open command terminal and run the following command:
  • Node selectwildcard.js
  • It will retrieve the record where city start with A.
 node select wildcard

Learn Node js - node js Tutorial - node select wildcard - node - Node js Examples


This wikitechy technological portal provides you whole lot of information related to the topics such as mongodb tutorial , what is node js , express js tutorial , node js tutorial pdf , learn node js , node js tutorial for beginners , node js tutorial w3schools , node js express , javascript for beginners , node js express tutorial , node js tutorial point , node js book , node js server , note js , node js mongodb , what is node js used for , why node js , node tutorial , node js basics , tutorialspoint node js , node express , node js sample application , nodeschool , node js for beginners , express tutorial , node js application , use of node js , npm tutorial , node js org , node js training , node js online training , node js tutorial beginner , how to use node js , node js hello world , express node js , node js mongodb tutorial , nodejs http , why use node js

Related Searches to Node.js MySQL SELECT | Node.js MySQL SELECT Unique Record