0

I am getting data from two different table sources. What is the best way to combine them into one?

For example:

table one has the following columns:

date | time | exchange 

table two has the following columns:

date | time | price | position

I want to combine them so I can create a table that has:

date | time | exchange | position | price

Sometimes position and exchange columns are empty. What is the best way to create this new table?

Eric Leschinski
  • 146,994
  • 96
  • 417
  • 335
user648244
  • 1,240
  • 7
  • 26
  • 41

2 Answers2

3

I would recommend further reading into SQL JOINs. SQL Joins

Then read up on how Views represent data from multiple tables: What is a View in Oracle?

Then read up on how SQL UNION combines results from multiple tables: http://www.orafaq.com/wiki/Union

Read up on Creating a table from a select: http://www.techonthenet.com/sql/tables/create_table2.php

Understand materialized Views: http://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_6002.htm

This just scratches the surface. All of these will solve your requirement with various benefits and draw backs.

Community
  • 1
  • 1
killercowuk
  • 1,313
  • 1
  • 11
  • 23
0

I would probably suggest using a join table as well, althought its not clear how your tables are truly related. You should understand Normalization

Antarr Byrd
  • 24,863
  • 33
  • 100
  • 188