what is difference between foreign key and reference key

Answer Posted / suresh kumar

Hi, i give the definitions with easy understand exapmles

A primary key is used to uniquely identify each row in a
table. It can either be part of the actual record itself,
or it can be an artificial field (one that has nothing to
do with the actual record).
A primary key can consist of one or more fields on a table.
When multiple fields are used as a primary key, they are
called a composite key.

EX:If we take EMP table, Empno is the primary key and in
DEPT table, Deptno is the primary keys

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

EX: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

EX:In EMP table Mgr field is the Reference key because it
pointing to the Empno field in the same table

Is This Answer Correct ?    64 Yes 12 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

List out the types of joins.

593


State and explain about oracle instance?

551


How to load data through external tables?

583


What is enter substitution variable in oracle?

573


please explain.. DB architecture ...

1561






Are truncate and delete commands same? If so why?

654


i have a question here... As of my knowledge, when we apply an index (b-tree)on a column, internally it arranges the data in b-tree format and do the fetching process correspondingly... and my quetion is... How a bit-map index arranges the data internally when applied on a column?IS it in b-tree format or whatelse?

1470


How to get execution statistics reports on query statements?

570


How index is implemented in oracle database?

596


why dont we assign not null constraint as table level constraint.

2253


how to clone 9i Database on to 10g Database.

1828


How to define a procedure inside another procedure?

545


How to enter a new row into a table interactively?

549


How to start your 10g xe server?

596


Where are the settings stored for each instance in oracle?

625