Home     SQL Basic     Contact Us     Site Map    

SQL BASIC

SQL SELECT

SQL WHERE

SQL DISTINCT

SQL AND

SQL OR

SQL NOT

SQL ORDER BY

SQL IN

SQL BETWEEN

SQL LIKE

SQL ALIAS

SQL AGGREGATE

>SQL COUNT

>SQL SUM

>SQL MAX

>SQL MIN

>SQL AVG

SQL GROUP BY

SQL HAVING

SQL INSERT

SQL UPDATE

SQL DELETE

SQL SELECT INTO

SQL CREATE DATABASE

SQL CREATE TABLE

SQL DROP TABLE

SQL DROP DATABASE

SQL CREATE INDEX

SQL PRIMARY KEY

SQL FOREIGN KEY

SQL ALTER TABLE

SQL TRUNCATE TABLE

SQL JOIN

SQL INNER JOIN

SQL OUTER JOIN

SQL CROSS JOIN

SQL UNION

SQL UNION ALL

SQL INTERSECT



SQL SELECT INTO

The SELECT INTO statement is usually used to create backup copies of tables.
That also explain that SELECT INTO creates a new table and fills it with data computed by a query.

SELECT INTO syntax is:

SELECT [COLUMN NAME 1], [COLUMN NAME 2] ,...
INTO [BACKUP TABLE NAME]
FROM[TABLE NAME]


EXAMPLE 1 :

Let’s say we want to create a copy of the GameScores table and data.

SQL Statement:

SELECT * INTO GameScores_backup
FROM GameScores

SELECT INTO statement also can export the backup data to another database, let's see the example 2.


EXAMPLE 2 :

Let’s say we want to create a copy of the GameScores table and data to another database name backup_database.

SQL Statement:

SELECT * INTO GameScores_backup IN 'backup_database.mdb'
FROM GameScores