Sunday, 15 May 2011

SQL SELECT INTO

SQL SELECT INTO

The SQL SELECT INTO statement is used to select data from a SQL database table and to insert it to a different table at the same time.
The general SQL SELECT INTO syntax looks like this:


SELECT Column1, Column2, Column3,
INTO Table2
FROM Table1

The list of column names after the SQL SELECT command determines which columns will be copied, and the table name after the SQL INTO keyword specifies to which table to copy those rows.

If we want to make an exact copy of the data in our Customers table, we need the following SQL SELECT INTO statement:

SELECT *
INTO Customers_copy
FROM Customers

No comments:

Post a Comment