SQL Inner Join
Use the SQL INNER JOIN when you only want to return records where there is at least one row in both tables that match the join condition.
Example SQL statement
Source Tables
Left Table
| IndividualId | FirstName | LastName | UserName |
|---|---|---|---|
| 1 | Fred | Flinstone | freddo |
| 2 | Homer | Simpson | homey |
| 3 | Homer | Brown | notsofamous |
| 4 | Ozzy | Ozzbourne | sabbath |
| 5 | Homer | Gain | noplacelike |
Right Table
| IndividualId | AccessLevel |
|---|---|
| 1 | Administrator |
| 2 | Contributor |
| 3 | Contributor |
| 4 | Contributor |
| 10 | Administrator |
Result
| IndividualId | FirstName | LastName | UserName | IndividualId | AccessLevel |
|---|---|---|---|---|---|
| 2 | Homer | Simpson | homey | 2 | Contributor |
Next lesson covers the SQL OUTER JOIN.