Ø This is used
to reference the parent table primary key column which allows duplicates.
Ø Foreign key
always attached to the child table.
Ø We can add
this constraint in table and alter levels only.
Ex:
TABLE LEVEL
SQL> create table emp(empno number(2), ename
varchar(10), deptno number(2),
primary key(empno), foreign
key(deptno) references dept(deptno));
SQL> create table emp(empno number(2), ename
varchar(10), deptno number(2),
constraint pk primary key(empno),
constraint fk foreign key(deptno) references
dept(deptno));
ALTER LEVEL
SQL> alter table emp add foreign key(deptno) references dept(deptno);
SQL> alter table emp add constraint
fk foreign key(deptno) references dept(deptno);
Once the primary key and foreign key relationship
has been created then you can not remove any parent record if the dependent
childs exists.