SQL TutorialLesson 10Free preview
SQL Insert Into
This lesson is part of SQL · All levels
Summary
The INSERT INTO command is used to add new lines to the table. We can name the column with its value, or we can fill all the columns without naming them in the order of the table's definition. The text and date values are written with a single quotation mark, while the numbers are not.
Key points
- General structure: INSERT INTO the table (column1, column2) VALUES (value1, value2);
- If the column name is not mentioned, the values must be complete and in order according to the table definition.
- INSERT can add multiple lines at once with multiple pairs of VALUES.
- The AUTO_INCREMENT column is allowed to be passed because its value is automated.
- INSERT INTO... SELECT allows you to copy data from other tables.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.