You can choose a foreign key as well as select foreign key options. Foreign key columns in the referencing table must map exactly to the primary key columns or unique index columns of the referenced table. The number of columns used in the foreign key and the schema of those columns must be identical in both the referencing and referenced tables.
A foreign key ensures referential integrity between two tables. The foreign key accomplishes this task according to the action chosen for the foreign key. When a record in the referenced column(s) is deleted or updated, the foreign key performs the action on the referencing column(s). The possible actions are:
Set Null: Records in the foreign key column are set to null if the user updates or deletes the corresponding records in the primary key or unique index column
Cascade: The corresponding records in the referenced table are also updated or deleted
Set Default: The foreign key record is set to a default value if the user updates or deletes the corresponding records in the primary key or unique index column
No Action: No action is taken on the foreign key column if the user updates or deletes the corresponding records in the primary key or unique index column
Please note that the delete action of a foreign key may be different from the update action.