A foreign key is a field in your table that uniquely identifies a row of another table. The relation in relational database. The constraint is taking care of the values entered in the field is present in the other table. Like this there are no orphaned rows.
Orphaned rows, or fields wich doesn't have a key wich exists in the other table can cause many programs to crash.
Foreign key's support several actions:
- set default
- no action