top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Oracle: What is the difference between foreign key and reference key?

0 votes
1,160 views
Oracle: What is the difference between foreign key and reference key?
posted Jan 16, 2015 by Suchithra

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote
 
Best answer

A foreign key is a field (or fields) that points to the primary key of another table. The purpose of the foreign key is to ensure referential integrity of the data.
In other words, only values that are supposed to appear in the database are permitted
Example: In EMP table Deptno field is the foreign key because it pointing to the Deptno in DEPT table

A Reference key is a field (or fields) that points to the primary key of the same table
Example: In EMP table Mgr field is the Reference key because it pointing to the Empno field in the same table

Conclusion: Foreign key is the key i.e. attribute which refers to another table primary key. Reference key is the primary key of table referred by another table.

answer Jan 18, 2015 by Amit Kumar Pandey
...