Flash cards
Review the key moves
What is the main idea behind SQL SELECT INTO Statement?
Lesson checks
Practice each idea before moving on
Short Mimo-style checks built from this lesson's code, terms, and sequence.
Which statement best captures the main point of this lesson?
Complete the missing token from the example code.
___ * INTOPut the learning moves in the order that makes the concept easiest to apply.
The SQL SELECT INTO Statement
The SELECT INTO statement is used to create a new table and fill it with data from an existing table.
The SELECT INTO statement is useful for creating backups or for creating a temporary table for analysis.
Note
The new table will be created with the same column names and data types as defined in the source table. However, primary keys, indexes, or NOT NULL constraints are not automatically transferred.
SELECT INTO Syntax
Copy entire table into a new table:
SELECT * INTO
newtable
[IN
external_db
]
FROM
sourcetable
WHERE
condition
;Copy only some columns into a new table:
SELECT
column1
,
column2
,
column3
, ...
INTO
newtable
[IN
external_db
]
FROM
sourcetable
WHERE
condition;