In SQL standard, there are three types of outer joins:
But, SQLite supports only Left Outer Join.
The SQLite left outer join is used to fetch all rows from the left hand table specified in the ON condition and only those rows from the right table where the join condition is satisfied.
Syntax:
SELECT ... FROM table1 LEFT OUTER JOIN table2 ON conditional_expression
Or
SELECT ... FROM table1 LEFT OUTER JOIN table2 USING ( column1 ,......
Image representation:
We have two tables "STUDENT" and "DEPARTMENT".
The "STUDENT" table is having the following data:
The "DEPARTMENT" table is having the following data:
Let's take the above two tables "STUDENT" and "DEPARTMENT" and make an inner join according to the below conditions:
Example:
SELECT EMP_ID, NAME, DEPT FROM STUDENT LEFT OUTER JOIN DEPARTMENT ON STUDENT.ID = DEPARTMENT.EMP_ID;