| | |
Many to many relationship
Please support our Database Design advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jan 2009
Posts: 1
Reputation:
Solved Threads: 0
I would like to know how to solve many - to many relationship data.
I have a client and a company table. A client can be an employee or an employer of the company. The employer can associate to more than one company. A company can have many owners or employees.
In this scenario, how do I solve this many to many relationship between these two tables.
Both of the so far have their own unique ID. In this case what I can do to solve this scenario. Does creating another table for both client and company tables make sense?
No idea to this problem.
Thank you.. hope anyone can help me with this. ...
I have a client and a company table. A client can be an employee or an employer of the company. The employer can associate to more than one company. A company can have many owners or employees.
In this scenario, how do I solve this many to many relationship between these two tables.
Both of the so far have their own unique ID. In this case what I can do to solve this scenario. Does creating another table for both client and company tables make sense?
No idea to this problem.
Thank you.. hope anyone can help me with this. ...
Break the many-to-many relationship into one-to-many and many-to-one
Which means?
create a bridge table Employee_Company (EmployeeID int #, CompanyID int #, Salary float, .....)
Bridge table properties: has composed primary keys (in your case Employee and Company)
- has shared properties which illogical to included in the entities it ties with (in your case salary, work_period, title, etc...)
Which means?
create a bridge table Employee_Company (EmployeeID int #, CompanyID int #, Salary float, .....)
Bridge table properties: has composed primary keys (in your case Employee and Company)
- has shared properties which illogical to included in the entities it ties with (in your case salary, work_period, title, etc...)
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
![]() |
Similar Threads
- Employee Role relationship question... (MS Access and FileMaker Pro)
- One-To-Many Relationship (adding data) (MySQL)
- Schema: unknown attribute 'name' on relationship tag (XML, XSLT and XPATH)
- set relationship question (MySQL)
- Re: Trust Relationship (Networking Hardware Configuration)
- Relationship between Asset, Mac Address and IP address (Database Design)
- LinkSouls.com Relationship Site Criticism sought (Website Reviews)
Other Threads in the Database Design Forum
- Previous Thread: Database/table structure for points system
- Next Thread: Looking for On-line Database Hosting
| Thread Tools | Search this Thread |






