SQL SELECT into tutorial
A table in which the SQL SELECT into statement can be used to make a backup copy.
In SQL SELECT into statement
Select the data from a table in the SELECT INTO statement and insert it into a different table.
The SELECT INTO statement is the most frequently used to create a backup copy of the table.
The SQL syntax that you selected
We can select all columns to the new table:
SELECT * into
new_table_name [in Externaldatabase] from
old_tablename
Or we can just select the column we want to go to the new table:
Select column_name (s) into new_table_name [in ex Ternaldatabase] from Old_tablename
Database selected to For example
Make a backup copy-now we want to accurately replicate the data in our "people" seating.
We use the following SQL statement
SELECT * into Persons_backup from Persons
Div id= "Result_box" dir= "ltr" > We can also use the terms in this table to replicate to another database:
SELECT * into Persons_
Backup in ' Backup.mdb ' from Persons
or we can do so.
SELECT lastname,firstname into Persons_backup from Persons
Go to database Selection-with a w here clause
We can also add a WHERE clause.
The following statement creates a "persons_backup" table, and only the people who live in the city "Sandnes":
SELECT lastname,firstname into Persons_backup from sons where city= ' Sandnes '
Go to database selection-Join table
Select data from more than one table is also possible. The following example of
creates a "persons_order_backup" table that contains data from two tables "people" and "orders":
SELECT persons.lastname,orders. OrderNo into Persons_order_backup from Persons INNER JOIN Orders on persons.p_id=orders.p_id
&NBSP