Re: How to model 3 relationships in one table
Posted by: Rick James
Date: July 12, 2013 07:23PM

> 1) Many to Many relationship from A to A

CREATE TABLE A2A ( id1..., id2..., PRIMARY KEY (id1,id2), INDEX(id2) )

> 2) One to Many from B to A

CREATE TABLE A ( ... id_b ...) -- Note: extra field in `A`.

> 3) One to One from B to B

Why aren't they the same table?

> attributes like start, end dates and codes.

Put those attributes in the table with the relationship (1: in A2A; 2: in A)

Do JOINs to get to tie the 2-3 tables together and fetch the attributes.

> the 3 relationships into one table

I think you need to forget about this goal.

Options: ReplyQuote


Subject
Written By
Posted
Re: How to model 3 relationships in one table
July 12, 2013 07:23PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.