A simple primary key contains only one field, for example, student ID, however for a composite primary key you need more than one field to find the precise value, for example, cars, brand and machine model. There are many types of models for types of brands (Audi, BMW, Citroen, Ford and so on). Using the composite primary key you can uniquely identify every car of the same make in the database. A table can have single or multiple foreign keys, a primary key and a foreign key are linked together to create a relationship between tables (entities), this happens when both tables (and others) have found the same primary key. Both primary keys cannot have the same name, so we call one of them a foreign key. When a relationship is linked between two tables by a primary key to a foreign key, referential integrity is needed, so we cannot change any data from the foreign key (table), however, it can only be changed in the primary key (table) to avoid unnecessary
tags