Skip to content

Commit 6fd34b5

Browse files
committed
ALTER Query
1 parent 8f12bd0 commit 6fd34b5

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

nodejs-mysql/alter-table.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
let db_pool = require('./config').mysql_connect;
2+
3+
let sql = `ALTER TABLE employee ADD COLUMN salary DOUBLE(10, 2)`;
4+
5+
// connect to the MySQL server
6+
db_pool.getConnection((err) => {
7+
if (err) throw err;
8+
console.log("Connected!");
9+
10+
db_pool.query(sql, (err, result) => {
11+
if (err) throw err;
12+
13+
console.log("Table altered!");
14+
});
15+
});

0 commit comments

Comments
 (0)