IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

What is the use of foreign key


IBM Mainframe Forums -> Mainframe Interview Questions
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
simmimahajan

New User


Joined: 27 Mar 2007
Posts: 30
Location: USA

PostPosted: Thu May 17, 2007 2:01 am
Reply with quote

I was asked what is the use of foreign key?

All I could answer is
Foreign key is primary key of another table.
Foreign key-primary key defines a relational join and relational join is nothing but merging attributes from two or more tables.

But then the next question was we can perform join on two tables and we do not require foreign keys to join tables. So what is main reason for having foreign keys. The interviewer also said that we can have a table structure without foreign keys. EDS has it's databse with no foregin keys.

Can somebody give me tell me the exact purpose of foregin key other than what I know?

Thanks,
Simmi
Back to top
View user's profile Send private message
bharath454

New User


Joined: 28 Sep 2006
Posts: 1

PostPosted: Thu May 17, 2007 2:35 am
Reply with quote

With the relation between Primary key and Foreign key, we can achieve Referential integrity(Insert,update and delete).

I think I have answered your question to some extent.
Back to top
View user's profile Send private message
simmimahajan

New User


Joined: 27 Mar 2007
Posts: 30
Location: USA

PostPosted: Thu May 17, 2007 8:40 pm
Reply with quote

i think yes..all it boils down to is to eastablish relationship betn two tables you use foreign key..may be the question tht followed were just to confuse..

thnx for all your help
Back to top
View user's profile Send private message
shane

New User


Joined: 17 May 2007
Posts: 11
Location: Phoenix,Arizona

PostPosted: Thu May 17, 2007 9:20 pm
Reply with quote

Hi,

The Foreign is the field which contains the data that exist in the primary key field of the Master Table.

I think this gives u simple idea about Foreign Key.

The interviewer asked rest things to test you more n confuse you.
Back to top
View user's profile Send private message
simmimahajan

New User


Joined: 27 Mar 2007
Posts: 30
Location: USA

PostPosted: Thu May 17, 2007 9:51 pm
Reply with quote

Thanks Shane.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> Mainframe Interview Questions

 


Similar Topics
Topic Forum Replies
No new posts Foreign character look different in m... COBOL Programming 3
No new posts Enforcing Foreign Key DB2 10
No new posts Unable to create a foreign key DB2 2
No new posts Primery Key / foreign key between Views DB2 1
No new posts Primary-Foreign Key relationship DB2 1
Search our Forums:

Back to Top