Problem solve Get help with specific problems with your technologies, process and projects.

Joining like tables

I have a database that contains 2 areas: working area (its own tablespace) and ledger area (its own tablespace).
Working area has 12 tables, ledger has 12 tables, and the tables are alike, ie: working.table1 = ledger.table1 etc. I want to somehow join the tables in working area to the like tables in ledger area, where basically I am appending working to ledger. What is the best way to approach this?

If you are looking to actually append the data from the working table to the ledger table, so that the two tables become one, you've got one choice with a couple of options in how you accomplish it. The simplest way is to simply INSERT the data from the working table into the ledger table. If that causes a performance issue, I'd unload the data to a flat file, load it into the ledger table, then truncate the working table. Without knowing a great deal more about your particular circumstances, I can't give you detailed instructions because the details would vary too much.

If all you need to do is combine the two tables for searching, I'd create a view that was a UNION of the two tables.

For More Information

  • What do you think about this answer? E-mail the editors at editor@searchDatabase.com with your feedback.
  • The Best Database Design Web Links: tips, tutorials, scripts, and more.
  • Have an Oracle or SQL tip to offer your fellow DBAs and developers? The best tips submitted will receive a cool prize. Submit your tip today!
  • Ask your database design -- or help out your peers by answering them -- in our live discussion forums.
  • Ask the Experts yourself: Our SQL, database design, Oracle, SQL Server, DB2, metadata, object-oriented and data warehousing gurus are waiting to answer your toughest questions.

Dig Deeper on Oracle and SQL

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.