Node.js MySQL Drop Table
Executing DROP TABLE queries programmatically using Node.js script.
const mysql = require('mysql2/promise');
async function dropTable() {
const connection = await mysql.createConnection({
host: 'localhost', user: 'root', password: 'password', database: 'company_db'
});
await connection.execute('DROP TABLE IF EXISTS system_logs');
console.log('Table system_logs dropped successfully in Node.js!');
await connection.end();
}
dropTable();Table system_logs dropped successfully in Node.js!