SELECT INTO in SQL

HOW TO USE 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.


Posted

in

Tags:

Comments

Leave a Reply