Database IntegrationLesson 50Free preview
MySQL Insert Into
This lesson is part of Node.js · All levels
Summary
INSERT INTO adds new lines to the table, both one line and many at a time. For web applications, use parameterized queries to prevent user values from entering malicious SQL. After inserting, the result returns affectedRows that can be used to ensure the data is actually in.
Key points
- INSERT INTO table (column) VALUES (value) add new line
- Placeholder? used with the array of values on mysql2
- AffectedRows tell the number of lines affected
- INSERT... SELECT is useful for copying data from other tables
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.