Node JS - Node js MySQL Drop Table - Node - Node JS tutorial - webnode




Related nodejs article tags - node js - node js tutorial - node js examples

Drop a Table

  • You can delete or drop an existing table by using the "DROP TABLE" statement in mysql.
 node-js mysql drop table

Learn Node js - node js Tutorial - node-js mysql drop table - node - Node js Examples

Example

Delete the table "wikitechy_customers":
var mysql = require('mysql');

var con = mysql.createConnection({
  host: "localhost",
  user: "yourusername",
  password: "yourpassword",
  database: "mydb"
});

con.connect(function(err) {
  if (err) throw err;
  var sql = "DROP TABLE customers";
  con.query(sql, function (err, result) {
    if (err) throw err;
    console.log("Table deleted");
  });
});
  • Save the code above in a file called "wikitechy_db_drop_table.js" and run the Node JS Tutorial File:
Run "wikitechy_db_drop_table.js"
C:\Users\Your Name>node wikitechy_db_drop_table.js
Related nodejs article tags - node js - node js tutorial - node js examples

Node JS Output :

  • You can delete or drop an existing table by using the "DROP TABLE" statement in mysql.
Table deleted 

This wikitechy technological portal provides you whole lot of information related to the topics such as mongodb tutorial , what is node js , express js tutorial , node js tutorial pdf , learn node js , node js tutorial for beginners , node js tutorial w3schools , node js express , javascript for beginners , node js express tutorial , node js tutorial point , node js book , node js server , note js , node js mongodb , what is node js used for , why node js , node tutorial , node js basics , tutorialspoint node js , node express , node js sample application , nodeschool , node js for beginners , express tutorial , node js application , use of node js , npm tutorial , node js org , node js training , node js online training , node js tutorial beginner , how to use node js , node js hello world , express node js , node js mongodb tutorial , nodejs http , why use node js

Related Searches to Node.js MySQL Drop Table