-- Collection of code snippets by Arne Vajhøj 
-- (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY,f2 VARCHAR(50));
CREATE TABLE t2 (f1 INTEGER PRIMARY KEY,f2 VARCHAR(50));
INSERT INTO t1 VALUES (1,'A');
INSERT INTO t1 VALUES (2,'BB');
INSERT INTO t2 VALUES (2,'BB');
INSERT INTO t2 VALUES (3,'CCC');
(SELECT * FROM t1 LEFT JOIN t2 ON t1.f1=t2.f1)
UNION
(SELECT * FROM t1 RIGHT JOIN t2 ON t1.f1=t2.f1 WHERE t1.f1 IS NULL);
DROP TABLE t1;
DROP TABLE t2;
