Foreign Key by definition is a key relationship between two distinct tables. It establishes a relationship between a combination of fields in one table with primary key fields of another table acting as check table.

Consider Table T1 and T2. T1 has fields F1, F2, F3 and F4 where F1 and F2 are the primary keys. T2 has fields C1, C2, C3, C4, C5, C6 and C7 with C1 and C2 being the primary keys. If values in F3 and F4 in T1 are mapped against values in C1 and C2 in T2 a foreign key relationship can be established with T1 acting as Foreign Key Table and T2 acting as Check or Reference Table.

What does it mean? Let’s say – user tries to insert row – ( R11, R12, R13, R14 ) – in table T1. The relationship established will check if ( R13, R14 ) are in table T2 in columns C1 and C2 in at least one row. If yes, the row can be inserted. Else, the exception is raised.