What is The Difference Between Inner and Outer Join?

Sql is the language where a lot of data can be get with different logic. In an enterprise environment we may need to use complex sql queries to get meaningful data. Inner is one of the logic where we join two tables with different magic.

Example Tables

The tables we have are below. We will use two tables those named Personels and Persons

1

2

3

4

5

6

7

8

9

MariaDB[test]>SELECT LastName FROM Personels;

+----------+

|LastName|

+----------+

|C|

|D|

|E|

+----------+

3rows inset(0.00sec)

1

2

3

4

5

6

7

8

9

10

MariaDB[test]>SELECT LastName FROM Persons;

+----------+

|LastName|

+----------+

|A|

|B|

|C|

|NULL|

+----------+

4rows inset(0.00sec)

Inner Join

If we inner join Persons with Personels we will get only intersection of the given fields. In this example we want to get the LastName column intersection in two tables Persons and Personels .