Category: 02. MySQL

  • Node.js MySQL Drop Table

    The DROP TABLE command is used to delete or drop a table. Let’s drop a table named employee2. Create a js file named “delete” in DBexample folder and put the following data into it: Now open command terminal and run the following command:PlayNextMute Current Time 0:00 / Duration 18:10 Loaded: 2.94%  Fullscreen Verify that the table employee2 is…

  • Node.js MySQL SELECT Unique Record

    (WHERE Clause) Retrieve a unique data from the table “employees”. Create a js file named selectwhere.js having the following data in DBexample folder. Now open command terminal and run the following command: Node.js MySQL Select Wildcard Retrieve a unique data by using wildcard from the table “employees”.PauseNextMute Current Time 0:10 / Duration 18:10 Loaded: 4.77%  Fullscreen Create a…

  • Node.js MySQL Select Records

    Example Retrieve all data from the table “employees”. Create a js file named select.js having the following data in DBexample folder. Now open command terminal and run the following command:PauseNextMute Current Time 0:03 / Duration 18:10 Loaded: 3.67%  Fullscreen You can also use the statement:

  • Node.js MySQL Delete Records

    The DELETE FROM command is used to delete records from the table. Example Delete employee from the table employees where city is Delhi. Create a js file named “delete” in DBexample folder and put the following data into it:PlayNextMute Current Time 0:01 / Duration 18:10 Loaded: 3.30%  Fullscreen Now open command terminal and run the following command: You…

  • Node.js MySQL Update Records

    The UPDATE command is used to update records in the table. Example Update city in “employees” table where id is 1. Create a js file named “update” in DBexample folder and put the following data into it:PlayNextMute Current Time 0:08 / Duration 18:10 Loaded: 4.40%  Fullscreen Now open command terminal and run the following command: It will change the…

  • Node.js MySQL Insert Records

    INSERT INTO statement is used to insert records in MySQL. Example Insert Single Record: Insert records in “employees” table.PlayNextMute Current Time 0:02 / Duration 18:10 Loaded: 3.30%  Fullscreen Create a js file named “insert” in DBexample folder and put the following data into it: Now open command terminal and run the following command: Check the inserted record by…

  • Node.js MySQL Create Table

    CREATE TABLE command is used to create a table in MySQL. You must make it sure that you define the name of the database when you create the connection. Example For creating a table named “employees”. Create a js file named employees.js having the following data in DBexample folder.PlayNextMute Current Time 0:02 / Duration 18:10 Loaded: 3.30%  Fullscreen…

  • Node.js MySQL Create Database

    CREATE DATABASE statement is used to create a database in MySQL. Example For creating a database named “”. Create a js file named javatpoint.js having the following data in DBexample folder.PauseNextMute Current Time 0:05 / Duration 18:10 Loaded: 4.04%  Fullscreen Now open command terminal and run the following command: You can see the database is created. Verification To…

  • Node.Js Create Connection with MySQL

    We can use Node.js in database applications. Here we use MySQL as a database with Node.js. Install MySQL on your computer. You can download it from here https://www.mysql.com/downloads/. Once the MySQL is installed and running, you can access it by using Node.js. Install MySQL Driver You have to install MySQL driver to access a MySQL database…