As long as one of the tables has a match, the full JOIN keyword returns rows.
Full JOIN keyword syntax
SELECT column_name (s)
From table_name1
Full JOIN table_name2
On Table_name1.column_name=table_name2.column_name
Note: In some database tutorials, the full join is called the full OUTER join.
postgres=#
postgres=# CREATE TABLE T1 (
Postgres (# num int,
Postgres (# Name varchar (10)
Postgres (#);
CREATE TABLE
postgres=#
postgres=# INSERT INTO T1 values (1, ' a ');
INSERT 0 1
postgres=# INSERT INTO T1 values (2, ' B ');
INSERT 0 1
postgres=# INSERT INTO T1 values (3, ' C ');
INSERT 0 1
postgres=#
postgres=# CREATE TABLE T2 (
Postgres (# num int,
Postgres (# Name varchar (10)
Postgres (#);
CREATE TABLE
postgres=#
postgres=# INSERT INTO T2 values (1, ' xxx ');
INSERT 0 1
postgres=# INSERT INTO T2 values (3, ' yyy ');
INSERT 0 1
postgres=# INSERT INTO T2 values (5, ' zzz ');
INSERT 0 1
postgres=#
postgres=# SELECT * from T1 full JOIN t2 on t1.num = T2.num;
num | name | num | Name
-----+------+-----+------
1 | A | 1 | Xxx
2 | B | |
3 | C | 3 | yyy
| | 5 | zzz