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
  • 135,913
  • 89
  • 401
  • 325
user648244
  • 1,200
  • 7
  • 25
  • 39

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,305
  • 1
  • 11
  • 22
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
  • 22,848
  • 29
  • 91
  • 164