HOW TO USE SELECT INTO IN SQL

SELECT INTO in SQL

SELECT INTO statement is used to copy data from one table into a new table.

Syntax of SELECT INTO in SQL-

SELECT [* | <column_name(s)>]

INTO <newtable> [IN <external_database>]FROM <Oldtable_name>

WHERE <condition>;

Example of SELECT INTO in SQL-

SELECT * INTO CustomersBackup

FROM Customers;

–This SQL statement will create a copy of the Customers table.

SELECT CustomerName, ContactName INTO CustomersBackup

FROM Customers;

–This SQL statement will copy only a few columns into a new table.


Leave a Reply

Your email address will not be published. Required fields are marked *