A foreign key is a type of constraint that is used to establish a relationship between two tables. It is a column or set of columns in one table that refers to the primary key of another table.