<

Node.js MySQL Drop Table

The DROP TABLE command is used to delete or drop a table.

Example



drop.js

var mysql = require('mysql');  
var con = mysql.createConnection({  
host: "localhost",  
user: "root",  
password: "12345",  
database: "java"  
});  
con.connect(function(err) {  
if (err) throw err;  
var sql = "DROP TABLE data";  
con.query(sql, function (err, result) {  
if (err) throw err;  
console.log("Table deleted");  
});  
});  

Now open command terminal and run the following command:

Node drop.js  


















© copyright 2017-2022 Completedone pvt ltd.