Creating tables from existing data

The combination of SELECT and INTO can create new tables based on existing information. For example, to create a table of employees in the sales department from the Employee table, use the following statement:

SELECT * INTO Sales FROM Employee WHERE Department = "SALES";

To create a table with just names, use:

SELECT Employee.FirstName, Employee.LastName INTO Sales FROM Employee WHERE Department = "SALES";

To create a complete copy of a table, just omit the WHERE clause:

SELECT * INTO EmpCopy FROM Employee;

See also:

Adding records

Adding multiple records

Updating records

Deleting Records

Other types of SQL statements