oracle:meaningoffulljoin
Differences
This shows you the differences between two versions of the page.
Next revisionBoth sides next revision | |||
oracle:meaningoffulljoin [2016/04/27 09:48] – created rlunaro | oracle:meaningoffulljoin [2016/04/27 10:23] – rlunaro | ||
---|---|---|---|
Line 5: | Line 5: | ||
Let's say we have two tables: | Let's say we have two tables: | ||
- | < | + | < |
create table test1 | create table test1 | ||
(field | (field | ||
Line 16: | Line 16: | ||
insert into test1 values (' | insert into test1 values (' | ||
insert into test1 values (' | insert into test1 values (' | ||
+ | |||
+ | -- unique values for table test2 | ||
+ | insert into test2 values (' | ||
+ | insert into test2 values (' | ||
+ | insert into test2 values (' | ||
+ | |||
+ | -- common values for tables test1 and test2 | ||
+ | -- with only one record | ||
+ | insert into test1 values (' | ||
+ | insert into test2 values (' | ||
+ | |||
+ | -- common values with duplicate value in test1 | ||
+ | insert into test1 values (' | ||
+ | insert into test1 values (' | ||
+ | insert into test2 values (' | ||
+ | |||
+ | -- common values with duplicate value in test2 | ||
+ | insert into test1 values (' | ||
+ | insert into test2 values (' | ||
+ | insert into test2 values (' | ||
</ | </ | ||
+ | |||
+ | Let's execute a full join: | ||
+ | |||
+ | <code sql> | ||
+ | select * | ||
+ | from test1 full join test2 | ||
+ | on test1.field = test2.field; | ||
+ | |||
+ | </ | ||
+ | |||
+ | The result is: | ||
+ | |||
+ | * Values that are only in one of the tables, appear with the values of the other table as null | ||
+ | * Common values appear, and if it is neccessary, appear duplicated | ||
+ | |||
+ | |FIELD|FIELD| | ||
+ | |d4|d4| | ||
+ | |e5|e5| | ||
+ | |e5|e5| | ||
+ | |f6|f6| | ||
+ | |f6|f6| | ||
+ | |b|| | ||
+ | |c|| | ||
+ | |a|| | ||
+ | ||1| | ||
+ | ||3| | ||
+ | ||2| | ||
+ | |||
oracle/meaningoffulljoin.txt · Last modified: 2022/12/02 22:02 by 127.0.0.1