We altered the table after we created it to add the primary key. We are now going to alter the escapees table to add a foreign key. The serialno column value must exist in the serialno column in the inmates table. If we look at the structure of the table escapees there doesn't appear to be any change. We can see that a referential constraint exists for the escapees table.
Lets test the primary and foreign keys.
Lets see the contents of these two tables. As you can see the foreign key value in the escapees table exists in the inmates table. A check constraint is used to ensure that values inserted into a column exist in a set of values. The students table now has a check constraint. This constraint only affects new data not any existing data in the table.