Skip to content
  • SiteMap
  • Our Services
  • Frequently Asked Questions (FAQ)
  • Support
  • About Us

UpdateGadh

Update Your Skills.

  • Home
  • Projects
    •  Blockchain projects
    • Python Project
    • Data Science
    •  Ai projects
    • Machine Learning
    • PHP Project
    • React Projects
    • Java Project
    • SpringBoot
    • JSP Projects
    • Java Script Projects
    • Code Snippet
    • Free Projects
  • Tutorials
    • Ai
    • Machine Learning
    • Advance Python
    • Advance SQL
    • DBMS Tutorial
    • Data Analyst
    • Deep Learning Tutorial
    • Data Science
    • Nodejs Tutorial
  • Blog
  • Contact us
  • Toggle search form
Node.js MySQL Update Records

Node.js MySQL Update Records

Posted on October 21, 2025October 21, 2025 By Rishabh saini No Comments on Node.js MySQL Update Records

Node.js MySQL Update Records

The UPDATE command in MySQL is used to modify existing records in a table. This tutorial demonstrates how to update data in a MySQL table using Node.js in a simple and professional way.

Data Science Tutorial:–Click Here

Example

Let’s say you want to update the city name in the employees table where the id is 1.

First, create a JavaScript file named update.js inside your DBexample folder and add the following code:

var mysql = require('mysql');  
var con = mysql.createConnection({  
  host: "localhost",  
  user: "root",  
  password: "12345",  
  database: "updategadh"  
});  

con.connect(function(err) {  
  if (err) throw err;  
  var sql = "UPDATE employees SET city = 'Delhi' WHERE city = 'Allahabad'";  
  con.query(sql, function (err, result) {  
    if (err) throw err;  
    console.log(result.affectedRows + " record(s) updated");  
  });  
});

Introduction to Applied AI:–Click Here

Running the Code

  1. Open your command terminal.
  2. Navigate to the DBexample folder.
  3. Run the following command:

node update.js

Once executed, the script will update the city field from Allahabad to Delhi for the specified record in the employees table.

Download New Real Time Projects :–Click here

You can verify the update by checking your table. The record where the employee’s city was previously Allahabad will now show Delhi.

Output Example

Before Update:

idnamecity
1Ajeet KumarAllahabad

After Update:

idnamecity
1Ajeet KumarDelhi

SQL Tutorial :–Click Here
Deep Learning Tutorial:– Click Here
Machine Learning Tutorial:–Click Here
Complete Advance AI topics:- CLICK HERE
Complete Python Course with Advance topics:-Click Here


nodejs mysql update, mysql update nodejs, nodejs mysql update data, mysql update query nodejs, nodejs update mysql, update mysql nodejs, react node mysql update record, node.js mysql update, update record in react node and mysql, node js mysql update query, node js mysql update data, node.js update mysql database, node js update mysql, mysql node js update, node mysql update, update records, update in mysql node js, node.js express update record, node.js update record example, update data in node js mysql node js mysql update multiple columns update query in node js mongodb node js update query how to insert data dynamically in mysql using node js dynamic update query in node js mysql write a program to delete table records using node js and mysql database node js insert data into mysql node js mongodb update by _id node js mysql update records w3schools node js mysql update records example

    Post Views: 245
    Node.js Tutorial Tags:mysql node js update, mysql update nodejs, mysql update query nodejs, node js mysql update data, node js mysql update multiple columns update query in node js mongodb node js update query how to insert data dynamically in mysql using node js dynamic update q, node js mysql update query, node js update mysql, node mysql update, node.js express update record, node.js mysql update, node.js update mysql database, node.js update record example, nodejs mysql update, nodejs mysql update data, nodejs update mysql, react node mysql update record, update data in node js mysql, update in mysql node js, update mysql nodejs, update record in react node and mysql, update records

    Post navigation

    Previous Post: Library Management System Using MERN
    Next Post: Node.js MySQL Delete Records

    More Related Articles

    Node.js MongoDB Filter Query Node.js MongoDB Filter Query Node.js Tutorial
    Node.js Errors Node.js Errors Node.js Tutorial
    How to Connect MySQL Database with Node.js How to Connect MySQL Database with Node.js Node.js Tutorial

    Leave a Reply Cancel reply

    Your email address will not be published. Required fields are marked *

    You may also like

    1. Install Nodejs on Windows
    2. Node.js Command Line Options
    3. Node.js Assertion Testing
    4. Node.js MySQL Delete Records
    5. Node.js Create Connection with MongoDB
    6. Node.js MongoDB Filter Query

    Most Viewed Posts

    1. Top Large Language Models in 2025
    2. Online Shopping System using PHP, MySQL with Free Source Code
    3. login form in php and mysql , Step-by-Step with Free Source Code
    4. Flipkart Clone using PHP And MYSQL Free Source Code
    5. News Portal Project in PHP and MySql Free Source Code
    6. User Login & Registration System Using PHP and MySQL Free Code
    7. Top 10 Final Year Project Ideas in Python
    8. Online Bike Rental Management System Using PHP and MySQL
    9. E learning Website in php with Free source code
    10. E-Commerce Website Project in Java Servlets (JSP)
    • AI
    • ASP.NET
    • Blockchain
    • ChatCPT
    • code Snippets
    • Collage Projects
    • Data Science Project
    • Data Science Tutorial
    • DBMS Tutorial
    • Deep Learning Tutorial
    • Final Year Projects
    • Free Projects
    • How to
    • html
    • Interview Question
    • Java Notes
    • Java Project
    • Java Script Notes
    • JAVASCRIPT
    • Javascript Project
    • JSP JAVA(J2EE)
    • Machine Learning Project
    • Machine Learning Tutorial
    • MySQL Tutorial
    • Node.js Tutorial
    • PHP Project
    • Portfolio
    • Python
    • Python Interview Question
    • Python Projects
    • PythonFreeProject
    • React Free Project
    • React Projects
    • Spring boot
    • SQL Tutorial
    • TOP 10
    • Uncategorized
    • Online Examination System in PHP with Source Code
    • AI Chatbot for College and Hospital
    • Job Portal Web Application in PHP MySQL
    • Online Tutorial Portal Site in PHP MySQL — Full Project with Source Code
    • Online Job Portal System in JSP Servlet MySQL

    Most Viewed Posts

    • Top Large Language Models in 2025 (8,613)
    • Online Shopping System using PHP, MySQL with Free Source Code (5,211)
    • login form in php and mysql , Step-by-Step with Free Source Code (4,866)

    Copyright © 2026 UpdateGadh.

    Powered by PressBook Green WordPress theme