Q

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.

This was first published in May 2002

Dig deeper on Oracle and SQL

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchDataManagement

SearchBusinessAnalytics

SearchSAP

SearchSQLServer

TheServerSide

SearchDataCenter

SearchContentManagement

SearchFinancialApplications

Close