To copy the contents of one table to another table is done by using SELECT statement

The two tables that we use should be present in the same database.

The syntax for copying table is

SELECT * INTO destination_table FROM source_table;

 

Example:

Let us take two tables Student and Employees.

Table 1: Student

StudentIDStudent_NameAddressCity
1NithinBank StreetHyderabad
2BharathPanama StreetCalifornia

 

Table 2: Employees

StudentIDStudent_NameAddressCity


Now we copy the contents of Student table to Employees table by using SELECT statement as follows:

SELECT * INTO Employees FROM Student;

 

Now the Table Employees will look like this:

StudentIDStudent_NameAddressCity
1NithinBank StreetHyderabad
2BharathPanama StreetCalifornia