Course Content
Relational Database and Normalization
Primary key and Foreign key
Relational databases are based on tables and relationships, which are implemented using the Primary Key and the Foreign Key.
- A Primary Key (PK) is a unique identifier of the record in the table.
- A Foreign Key (FK) is a reference from a record in one table to the Primary Key of another table.
For example, consider two tables: “student” and “group”. Each student record includes data such as id (student id), name, surname, age, and group_id (which is a foreign key referencing the primary key of the “group” table). The “group” table includes data such as id (group id), name, and grade.


Now we can see that John and Kesha belong to group BG1 (they have a foreign key reference to group id), group BG4 has one student, Emma, and group MG2 has no students.
This structure allows for the execution of JOIN
and other operations.
Look at the “group-student” database entity-relationship (ER) diagram:

What is a primary key?
Select the correct answer
What is a foreign key?
Select the correct answer
Section 2.
Chapter 1