Inner Join
This lesson demonstrates how to perform an inner join.
We'll cover the following...
Inner Join
In the previous lesson, we saw how to join a table with itself. In this lesson we’ll join two different tables. We’ll introduce another table called DigitalAssets that’ll contain the online public properties such as Twitter, Facebook, and Pinterest belonging to a celebrity. The table structure is shown below:
Column Name | Column Type |
URL | VARCHAR(200) |
AssetType | Enum('Facebook', 'Twitter', 'Instagram', 'Pinterest', 'Website') |
LastUpdatedOn | TIMESTAMP |
ActorID | INT |
A few rows from the table are shown below:
Note that the primary key of the table is the URL column as every URL is guaranteed to be unique. The DigitalAssets table is linked with the Actors table with the common column of ID for the actor as shown below. However, note that the column names in the two tables are different.
Syntax
SELECT *
FROM table1
INNER JOIN table2
ON ...