Using a seperate table to 'join' make a table relation
Date: Thu, 10 Jan 2008 02:10:13 -0800 (PST)
Message-ID: <8baac3bd-b6b0-4d8a-b147-c1f64a469263_at_d4g2000prg.googlegroups.com>
Hi,
In the past I have always made the relationship between two tables
using foriegn keys. So, to link employee to employer I would have a
column in employee table called employer_id so that one employee could
have one employer and one employer may have many employees. Pretty
textbook stuff really but what if one employee had two jobs
(employers)?? For this I may create the following tables:
employee
The table employer_employer_join would have two columns that would
make the join, employer_id and employee_id, and I would have no need
for employer_id in the employee table. This way I could create many
relations between the two and not fixed to single relationships for
either.
I adopted this technique in my last project and it worked for any join
I had to make but it was more work and more tables to manage. Is this
a recommeded method of implementing joins? Would I only use this
employer_employer_join
employer
Hopefully the above is clear, Im newish to building large database
designs but I understand the importance of getting this part correct
from the start. Any help would be much appreciated. Thanks
Burnsy