INNER JOIN
The INNER JOIN
is the default type of join that is used to select data with matching values in both tables. It can be represented with the following Venn diagram:
The INNER JOIN
represents the highlighted section, which is the intersection between these two tables. Let's have a look at the INNER JOIN
syntax:
SELECT [Column List] FROM [Table 1] INNER JOIN [Table 2] ON [Table 1 Column Name] = [Table 2 Column Name] WHERE [Condition]
The syntax can also be written as follows:
SELECT [Column List] FROM [Table 1] JOIN [Table 2] ON [Table 1 Column Name] = [Table 2 Column Name] WHERE [Condition]
Note
The use of INNER
in the query is optional.
The INNER JOIN
is one of the most commonly used type of joins. Let's implement this in an exercise.
Exercise 6.01: Extracting Orders and Purchaser Information
You are a store manager that...