How to merge 2 Oracle tables?

How do I use the 'INSERT' or 'SELECT' SQL to copy all records from one table to another table, assuming the two tables have the same schema and I have all the privileges?
LVL 1
szetoaAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
frankrConnect With a Mentor Commented:
If your second table is simply an exact copy of the first, the EASIEST way to do this is to issue a

CREATE TABLE new_table AS SELECT * FROM old_table;

You create the new table and copy all the data in one statement.

If the second table already has some data and the table structures are identical (i.e. column names in the two tables are identical in name, number, type, etc.), you can simply

INSERT INTO new_table SELECT * FROM old_table;

If the structures aren't identical, start adding explicit column lists to the new_table and the old_table.
0
 
szetoaAuthor Commented:
Thanks again.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.