Foreign key property..
by barkkathulla[ Edit ] 2012-09-22 12:06:12
FOREIGN KEY REPRESENT RELATIONSHIP BETWEEN TABLES A FOREIGN KEY IS A COLUMN (OR A GROUP OF COLUMNS) WHOSE VALUES ARE DERIVED FROM THE PRIMARY/UNIQUE KEY OF THE SAME OR SOME OTHER TABLE.
THE EXISTENCE OF A FOREIGN KEY IMPLIES THAT THE TABLE WITH THE FOREIGN KEY IS RELATED TO THE PRIMARY KEY TABLE FROM WHICH THE FOREIGN KEY IS DERIVED. A FOREIGN KEY MUST HAVE A CORRESPONDING PRIMARY KEY VALUE IN THE PRIMARY/UNIQUE KEY TABLE TO HAVE A MEANING.
FOR EXAMPLE, THE DEPT NO COLUMN IS THE PRIMARY KEY OF TABLE DEPTS. TABLE EMP DEPT NO IS A FOREIGN KEY THAT REFERENCES THE DEPTNO VALUES IN THE TABLE DEPT. A FOREIGN KEY VALUE CAN BE LEFT NULL