bugl
bugl
HomeLearnPatternsPathsSearch
HomeLearnPatternsPathsSearch

Loading lesson path

Learn/SQL/SQL Tutorial
SQL•SQL Tutorial

SQL SELECT INTO Statement

Flash cards

Review the key moves

1/4
Core idea

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.

1Quick choice

Which statement best captures the main point of this lesson?

2Fill blank

Complete the missing token from the example code.

___ * INTO
3Order

Put the learning moves in the order that makes the concept easiest to apply.

The SELECT INTO statement is used to create a new table and fill it with data from an existing table.
SELECT INTO Syntax
The SQL SELECT INTO Statement

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;

Previous

SQL ALL Operator

Next

SQL INSERT INTO SELECT Statement