集合演算は和集合 testdb=# \d projectA public.projecta public.projectb

testdb=# \d projectA 
                   Table "public.projecta"
 Column |       Type        | Collation | Nullable | Default 
--------+-------------------+-----------+----------+---------
 member | character varying |           |          | 
testdb=# SELECT * FROM projectA;
 member  
---------
 A社社員
 A社社員
 B社社員
 C社社員
 C社社員
(5 rows)
testdb=# \d projectB
                   Table "public.projectb"
 Column |       Type        | Collation | Nullable | Default 
--------+-------------------+-----------+----------+---------
 member | character varying |           |          | 
testdb=# SELECT * FROM projectB;
 member  
---------
 C社社員
 C社社員
 C社社員
 D社社員
(4 rows)
testdb=# SELECT * FROM projectA UNION ALL SELECT * FROM projectB;
 member  
---------
 A社社員
 A社社員
 B社社員
 C社社員
 C社社員
 C社社員
 C社社員
 C社社員
 D社社員
(9 rows)

いいなと思ったら応援しよう!