A foreign key (FK) is an explicitly defined constraint that links a column in one table to a key in another. It acts like a guard dog: it rejects references to records that do not exist, helping prevent orphaned data. section 8.2.1
Orders and customers
Orders.CustomerId can reference Customers.Id, the primary key of the Customers table. Naming the column CustomerId is not enough: the database must have an explicit foreign key constraint. Once defined, it refuses an order for a nonexistent customer and can prevent deleting a customer who still has orders. section 8.2.1
Figure 8.2 Showing how Primary Keys and Foreign Keys work together to link tables. The child table (Orders) uses the Customer_ID as a Foreign Key to point directly back to its parent record (Customers), establishing a clear one-to-many relationship.

See how the Orders foreign key points to a Customers primary key in a one-to-many relationship. section 8.2.1
Foreign keys also help link data stored in separate tables. For example, an address can be stored once and linked to orders instead of being duplicated in every order. section 8.2.1




















