Home » SQL & PL/SQL » SQL & PL/SQL » Identification of foreign key
Identification of foreign key [message #1547] Fri, 10 May 2002 23:23 Go to next message
pinky
Messages: 26
Registered: May 2002
Junior Member
Hello,
I have a table say
Location with fields locationid, name and managername
and primary key is locationid
I have another table say worker with fields workerid,workername,locationid,managername and primary key is workerid.In this table locationid is the foreign key which refers table location.Also managername is a redundant field which comes from location table.I added this field intentionally for the sake of better software performance.

Can I identify locationid and managername as foreignkey in worker table after I create a unique index of locationid and managername in location table ?
Or only locationid is the foriegn key and managername is not even part of the foreign key?

Thanks...
Re: Identification of foreign key [message #1548 is a reply to message #1547] Fri, 10 May 2002 23:47 Go to previous messageGo to next message
hanu
Messages: 21
Registered: March 2002
Junior Member
I think what you feel you right. You can't redefine the foreign key by adding an unique index.
Re: Identification of foreign key [message #1550 is a reply to message #1547] Sat, 11 May 2002 00:46 Go to previous messageGo to next message
pinky
Messages: 26
Registered: May 2002
Junior Member
So according to I should have locationid and managername as foreign key. Please clarify ?
Please note I'am defining the foreign key logically and not physically. I'am trying to correctly identify foreign key logically.
Re:PROPER Identification of foreign key [message #1552 is a reply to message #1550] Sat, 11 May 2002 22:05 Go to previous message
pinky
Messages: 26
Registered: May 2002
Junior Member
Hello ,
The correct identification of primary key of location table is locationid alone.
Do you think I should call locationid and managername as foreign key in table worker.If you think so then I can create unique index of locationid and managername in table location. My problem is that can I identify logically locationid and managername as foreignkey in table worker?

Awaiting response.

Thanks...
Previous Topic: timer
Next Topic: ORA-01422: exact fetch returns more than requested number of rows
Goto Forum:
  


Current Time: Fri Apr 26 07:08:20 CDT 2024