JOIN is used to query data from 2 or more tables.
These tables are related to each other somehow, through some of its columns.
There are 4 types of joins: INNER JOIN, LEFT JOIN, RIGHT JOIN, FULL JOIN.
A primary key is a column with a unique value for each record in a table.
The purpose of JOIN is to join data from different tables, to avoid having to repeat information in different tables.
If we have the following tables:
Table "people" with primary key "per"
table "departments" with primary key "dep"
If we know the names of the people who work in COMPUTER, would have to do a join between 2 tables "people" and "departments" that would relate to the column "dep."
This means that from the table "people" and by the column "dep", we can access the information in the table "departments."