Next, we will query some real data from existing tables. For this, we first need to create a database, add a table to it, and insert some rows. Let's do this through a Node.js application. Please create a file create.js with the following content:
'use strict'; var mysql = require('mysql'); var connection = mysql.createConnection({ host: 'localhost', user: 'root', password: 'root' }); connection.query('CREATE DATABASE node', function(err) { if (err) { console.log('Could not create database "node".'); } }); connection.query('USE node', function(err) { if (err) { console.log('Could not switch to database "node".'); } }); connection.query('CREATE TABLE test ' + '(id INT(11) AUTO_INCREMENT, ' + ' content VARCHAR(255), ...