0

I'm working in a company that works with local databases, in two machines, so they have duplicated data, and some data that one db has, the other doesn't.

How can I merge these databases, so I can have a new database with these two tables, but without duplicates, and with the properly assigned FKs?

Here's the database structure.


->Client Table

Obs: Simple client registration, 'Name' is a unique field (whoever developed this software made it unique)

+----+-------------------+-------------+
| id_client |    Name    | Birth Date  |
+----+-------------------|-------------|
|  1        |  Tom       |  12/12/1990 |
|  2        |  Anish     |  12/02/1982 |
|  3        |  James     |  12/08/1933 |
|  4        |  Akhil     |  12/10/1948 |
|  5        |  Jobi      |  11/12/1923 |
+----+-------------------+-------------+


->History Table

Obs: History where the client have worked, in his entire life, one registry for each place he have had worked. One client can have none or many histories.

+----+-------------------+-------------+-------------+
| id_history|  id_client | date_hired  |  date_left
+----+-------------------|-------------|-------------|
|  1        |  2         |  12/12/2000 |  12/12/2004 |
|  2        |  2         |  12/02/2002 |  12/02/2007 |
|  3        |  3         |  12/08/2005 |  12/08/2009 |
|  4        |  4         |  12/10/2007 |  12/10/2010 |
|  5        |  5         |  11/12/2009 |  11/12/2012 |
+----+-------------------+-------------+-------------+

0 Answers0