Node.js MySQL Insert RecordsINSERT INTO statement is used to insert records in MySQL. Example Insert Single Record: Insert records in "employees" table. Create a js file named "insert" in DBexample folder and put the following data into it: Now open command terminal and run the following command: ![]() Check the inserted record by using SELECT query: SELECT * FROM employees; ![]() Insert Multiple RecordsCreate a js file named "insertall" in DBexample folder and put the following data into it: Now open command terminal and run the following command: Output: ![]() Check the inserted record by using SELECT query: SELECT * FROM employees; ![]() The Result ObjectWhen executing the insert() method, a result object is returned.The result object contains information about the insertion. It is looked like this: ![]()
Next TopicNode.js MySQL Update Record
|