Every table in a relational database model must have a field designated as primary key. The values in this primary key field cannot be repeated in the table so as to ensure the uniqueness of each record in the table, such as the matriculation number of a student in a table containing particular of students.
As a result of normalization, a typical relational database will have many tables. Each table (students) will be linked (related) to another table (say modules),
For example: on one hand, the students table may consist of student_id, student_name, and other related fields where student_id is the primary key.
On other hand, the modules table may consist of module_id, module_name, student_id (foreign key), module_grade, and so on., module_id and student_id make up a composite primary key for this table. In addition, student_id is also a foreign key linked to the primary key in students table.
To print the result of a student that includes student_name, module_name, grade and so on, we will have to join this 2 table using the student_id (primary key) in the students table and the student_id (foreign key) in the modules table.
Every student_id must exist in the primary key table (students) first, before it can be inserted into the foreign table (modules). Can you imagine having a module record belonging to a student whose record does not exist in the students table.
Read more:
Relational_Database_Design[
^]