In this article, we will learn how to write a SQL select into query.
To copy data from one table into a new table in SQL, the SELECT INTO statement is used.
Using SELECT INTO statement the new table will be created with the column-names and types as defined in the old table. We can create new column names using the AS clause (Aliases).
SELECT column_name(s) INTO NEW_TABLE [IN EXTERNAL_DB] FROM OLD_TABLE;
The subsequent statement would create a backup copy of Articles:
SELECT * INTO Backup_Article FROM Article;
The subsequent statement would use the IN clause to copy the table into a new table in another database:
SELECT * INTO Backup_Article IN 'Backup.mdb' FROM Article;
Also, check How To Use ANY, ALL Operators In SQL