Please note, this is a STATIC archive of website www.w3schools.com from 05 May 2020, cach3.com does not collect or store any user information, there is no "phishing" involved.
demo_db_where.js:
var mysql = require('mysql'); var con = mysql.createConnection({ host: "localhost", user: "myusername", password: "mypassword", database: "mydb" }); con.connect(function(err) { if (err) throw err; /*Select all customers with the address "Park Lane 38":*/ con.query("SELECT * FROM customers WHERE address = 'Park Lane 38'", function (err, result) { if (err) throw err; console.log(result); }); });
C:\Users\My Name>node demo_db_where.js
[
{ id: 11, name: 'Ben', address: 'Park Lane 38'}
]