Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
What is the use of foreign key

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
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    Post subject: What is the use of foreign key
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    Post subject: Re: Foreign Key Query
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    Post subject: Re: What is the use of foreign key
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    Post subject:
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    Post subject: Re: What is the use of foreign key
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    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Enforcing Foreign Key gylbharat DB2 10 Wed Apr 17, 2013 9:39 pm
No new posts Unable to create a foreign key princegaurav DB2 2 Tue Nov 06, 2012 6:24 pm
No new posts Primery Key / foreign key between Views bauer DB2 1 Fri Dec 16, 2011 11:56 am
No new posts Primary-Foreign Key relationship ppandey07 DB2 1 Tue Jul 12, 2011 9:46 am
No new posts Can foreign in a table have duplicates sree reddy DB2 3 Mon Aug 17, 2009 9:46 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us