Multiple Foregin Key References

  • Hi,

    I have a Query regarding relation between two tables.

    a Table called master(id integer,name varchar(30),locationid integer)

    and

    three other tables called

    child1(locationid integer primary key,name varchar(20))

    child2(locationid integer primary key,name varchar(20))

    child3(locationid integer primary key,name varchar(20))

    Requirement: Can I make the master(locationid) as a foreign key for the three child tables child1,child2,child3.

    locationid of master should take values only belonging to either child1(locaitonid) or child2(locaitonid) or child3(locaitonid).

    Regards

    Srikanth.K

  • What are you using this for? The design seems very strange. First, having a master table referencing child table(s) seems strange. But referencing one of three tables is not possible, and even if it were it would not be a good design. My guess is that the three child tables really contain the same kind of entities and should be placed in a single table with a column specifying type or similar.

  • Hi Chris,

    This is a Requirement and I got the solution Just now. It is a concept called "ARC" Relationship between tables of this kind.

    If you have any information regarding ARC relationship , It will be more helpful for me.

    Regards

    Srikanth.K

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply