How to duplicate or copy the data(columns or records) from one table to another

Copy column from one table to another


We can copy columns from one table to another using select command as shown below:

Syntax:
insert into destination_table_name select * from source_table_name;

Suppose we have a student table which has certain number of record and we want to copy all record to another table student2 to then we write command as :

insert into student2 select * from student;

Duplicate all the record in a table

Similarly we can duplicate the data of a table.

Syntax:
insert into table_name select *from table_name;

For example we want to duplicate data of table student then the command will be:
insert into student select * from student;


Comments

Popular posts from this blog

Error http://172.0.0.1:8080/apex application not found in oracle 10g Solved

Sequence diagram of Airport Check-in and Sreening System in uml