SQL joins are used to query data from two or more tables, based on a relationship between certain
columns in these tables.
The JOIN keyword is used in an SQL statement to query data from two or more tables, based on a
relationship between certain columns in these tables.
Tables in a database are often related to each other with keys.
A primary key is a column (or a combination of columns) with a unique value for each row. Each
primary key value must be unique within the table. The purpose is to bind data together, across
tables, without repeating all of the data in every table.
Look at the "Persons" table:
Note: "P_Id" column is the primary key in the "Persons" table. This means
that no two rows can have the same P_Id. The P_Id distinguishes two persons even if they
have the same name.
Next, we have the "Purchases" table:
Note: "PU_ID" column is the primary key in the "Purchases" table and that the
"P_Id" column refers to the persons in the "Persons" table without using
Note: the relationship between the two tables above is the "P_Id" column.
Before we continue with examples, we will list the types of JOIN you can use, and the differences
Your Query was successfully sent!