node.js - 2
2019.10.08 08:49
Node.js MySQL Delete
조회 수 248 추천 수 0 댓글 0
레코드 삭제
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 = "DELETE FROM customers WHERE address = 'Mountain 21'"; con.query(sql, function (err, result) { if (err) throw err; console.log("Number of records deleted: " + result.affectedRows); }); });
C:\Users\Your Name>node demo_db_delete.js
Number of records deleted: 1
The Result Object
{ fieldCount: 0, affectedRows: 1, insertId: 0, serverStatus: 34, warningCount: 0, message: '', protocol41: true, changedRows: 0 }
console.log(result.affectedRows)
1
번호 | 분류 | 제목 | 날짜 | 조회 수 |
---|---|---|---|---|
38 | node.js - 1 | Express에서 POST 방식 사용하기 | 2019.10.16 | 319 |
37 | node.js - 1 | Express에서 MySql 사용 | 2019.10.10 | 754 |
36 | node.js - 2 | Node.js MySQL Limit | 2019.10.10 | 247 |
35 | node.js - 2 | Node.js MySQL Update | 2019.10.10 | 241 |
34 | node.js - 2 | Node.js MySQL Drop Table | 2019.10.08 | 303 |
» | node.js - 2 | Node.js MySQL Delete | 2019.10.08 | 248 |
32 | node.js - 2 | Node.js MySQL Order By | 2019.10.08 | 253 |
31 | node.js - 2 | Node.js MySQL Where | 2019.10.08 | 451 |
30 | node.js - 2 | Node.js MySQL Select From | 2019.10.08 | 603 |
29 | node.js - 2 | Node.js MySQL Insert Into | 2019.10.01 | 844 |
28 | node.js - 2 | Node.js MySQL Create Table | 2019.10.01 | 287 |
27 | PUG | PUG 07 / INCLUDES | 2019.10.01 | 317 |
26 | PUG | PUG 06 / DOCTYPE | 2019.10.01 | 401 |
25 | node.js - 2 | Node.js MySQL | 2019.09.27 | 307 |
24 | node.js - 2 | NPM의 사용 | 2019.09.26 | 298 |
23 | node.js - 2 | Node.js URL Module | 2019.09.26 | 438 |
22 | PUG | PUG 05 / Conditionals | 2019.09.19 | 670 |
21 | PUG | PUG 04 / Comments | 2019.09.19 | 304 |
20 | PUG | PUG 03 / Code | 2019.09.19 | 677 |
19 | PUG | PUG 02 / Case | 2019.09.19 | 328 |