Developing By Me

Project Development and Design

SELECT INTO Syntax

    SELECT INTO is similar to the INSERT INTO in that it adds rows to a table. Yet, that is where the similarities end. Unlike INSERT INTO the SELECT INTO cannot add external data to a table. In addition, the SELECT INTO statement has the ability to create a temporary table. Depending on the database configuration these tables may remain until removed but it is always an option when working with complex queries. The following statement is an example of using the SELECT INTO to make a backup copy of an existing table, but this is not the only example as it can be used to create a new table from multiple tables for use later.

 

SELECT *
INTO backup_table
FROM tabl1

 

    The SELECT INTO query is identical to the SELECT statement. The only difference is the target of the dataset. Without the INTO clause the dataset is returned to the calling location; however, if it is included the table specified will be the recipient of the subsequent dataset.

 

%d bloggers like this: