Copy Table Data in SQL: Quick Guide
In SQL, you can use the INSERT INTO statement to copy table data to another table. Below is an example:
Suppose there are two tables: table1 and table2. To copy the data from table1 to table2, the following statement can be used:
INSERT INTO table2
SELECT * FROM table1;
The statement will copy all data from table1 to table2. To copy specific columns, you can specify the column names in the SELECT statement.
INSERT INTO table2 (column1, column2, column3)
SELECT column1, column2, column3 FROM table1;
The statement will copy the data from column1, column2, and column3 in table1 to their corresponding columns in table2.