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