Node.js MySQL INSERT INTO Query Examples

Node.js MySQL INSERT INTO Query is used to insert one or more records into MySQL Table.

Node.js MySQL INSERT INTO

 

Node.js MySQL Example to INSERT a record INTO a table

Run above Node.js MySQL program in Terminal.
 

Node.js MySQL Example to INSERT multiple records INTO a table

Run above Node.js MySQL program in Terminal.
 

Accessing properties of Result Object

Once the INSERT INTO Query is executed, MySQL Server responds with a result object.The properties of result object like affectedRows, serverStatus, changedRows etc., could be accessed using DOT (.) operator.

 

Conclusion :

In this Node.js TutorialNode.js MySQL – Node.js MySQL INSERT INTO Query, we have learnt to insert one or more records into a table and access the properties of result object.