Link to home
Create AccountLog in
Avatar of shash_bro
shash_bro

asked on

How to model 3 relationships into one table

Hi All

  I have a situation where there are two tables  - Table A (a1 (PK)) and Table B (b1 (PK)) .
I have business requirement to have the following relationships between the two tables.  
1) Many to Many relationship from A to A
2) One to Many from B to A
3) One to One from B to B

     Please let me know how can I model the best way.

    Also, I was trying to model the 3 relationships into one table cause the relationships have common attributes like start, end dates and codes. Please let me know if it is possible to model the above 3 relationships in one single table, and how?
Avatar of edtechdba
edtechdba
Flag of United States of America image

What exactly are you looking for? An example of the graphical representation of a data model? Or SQL code examples for each one of your requirements?
Avatar of shash_bro
shash_bro

ASKER

Graphical would be cool but if you can just indicate the foreign keys in the table description that's good. Thx much
ASKER CERTIFIED SOLUTION
Avatar of Scott Pletcher
Scott Pletcher
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
ScottPlecher:
     You haven't indicated the relationship 1to1 from B to B?
SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Thanks much