SQL TutorialLesson 39Free preview
SQL Select Into
This lesson is part of SQL · All levels
Summary
SELECT INTO is used to create new tables of query results, useful for copying or backing up data. In MySQL, this command is written as CREATE TABLE... AS SELECT is because of the SELECT INTO INTO format typical of SQL Server. A new table is created complete with the result line at once.
Key points
- SELECT INTO copies the query results to a new table.
- In MySQL it is in the form: CREATE TABLE table_new US SELECT...;
- The destination table must not yet exist; if it does, an error will occur.
- The new column structure is tailored to the query results being executed.
- The original index and constraint are not copied to the new table.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.