Full Join

SQL FULL JOIN

The FULL JOIN returns all rows from the joined tables.

SQL Full Join syntax

SELECT column_name(s)
FROM A_table FULL JOIN B_table
ON A_table.column_name = B_table.column_name;

Training_Course

ID NAME DURATION PRICE
1 SQL 5 200
2 T-SQL 7 700
3 MySQL 5 600
4 PL/SQL 7 800
5 PostgreSQL 6 500

Certifications

ID NAME PRICE ID_TC
1 PostgreSQL certification 800 5
2 SQL certification 350 1
3 T-SQL certification 1000 2
4 Oracle-SQL certification 2000 NULL

Example

SELECT c.ID,c.NAME,c.PRICE, t.ID, t.NAME
FROM Certifications c FULL JOIN Training_Course t 
ON c.ID_TC = t.ID;

Results

ID NAME PRICE ID NAME
1 PostgreSQL certification 800 5 PostgreSQL
2 SQL certification 350 1 SQL
3 T-SQL certification 1000 2 T-SQL
4 Oracle-SQL certification 2000 NULL NULL
NULL NULL NULL 3 MySQL
NULL NULL NULL 4 PL/SQL