What is the main difference between foreign key and primary key?

Submitted by: Administrator
primary key:- A primary contains unique and notnull.it means
a primary key column does not contain null values and
duplicates.A table containe only one primary key.using this
we can access the data from table easily.
foreign key:-a fk can contain duplicate values but it not
contain null values.using fk to establish relationship
between two tables. a parent table primary key should be
referenced by child table primary key.
one fk should be referenced by only one primary key the main difference between two keys is
pk is used to access the data from table.
fk is used to establish the relationship between two tables.
pk does not allowed duplicate and null values.
fk can allows duplicate values and does not allowed null
values
Submitted by: Administrator

Read Online OCI Job Interview Questions And Answers