--相同的: select a,b,c,d from tab1 where exists(select * from tab2 where tab1.a=tab2.a and tab1.b=tab2.b and tab1.c=tab2.c and tab1.d=tab2.d)--不同的: select a,b,c,d from tab1 where not exists(select * from tab2 where tab1.a=tab2.a and tab1.b=tab2.b and tab1.c=tab2.c and tab1.d=tab2.d) union all select a,b,c,d from tab2 where not exists(select * from tab2 where tab1.a=tab2.a and tab1.b=tab2.b and tab1.c=tab2.c and tab1.d=tab2.d)
--不同的: select a,b,c,d from tab1 where not exists(select * from tab2 where tab1.a=tab2.a and tab1.b=tab2.b and tab1.c=tab2.c and tab1.d=tab2.d) union all select a,b,c,d from tab2 where not exists(select * from tab1 where tab1.a=tab2.a and tab1.b=tab2.b and tab1.c=tab2.c and tab1.d=tab2.d)
select a,b,c,d from tab1 where exists(select * from tab2 where tab1.a=tab2.a and tab1.b=tab2.b and tab1.c=tab2.c and tab1.d=tab2.d)--不同的:
select a,b,c,d from tab1 where not exists(select * from tab2 where tab1.a=tab2.a and tab1.b=tab2.b and tab1.c=tab2.c and tab1.d=tab2.d)
union all
select a,b,c,d from tab2 where not exists(select * from tab2 where tab1.a=tab2.a and tab1.b=tab2.b and tab1.c=tab2.c and tab1.d=tab2.d)
select a,b,c,d from tab1 where not exists(select * from tab2 where tab1.a=tab2.a and tab1.b=tab2.b and tab1.c=tab2.c and tab1.d=tab2.d)
union all
select a,b,c,d from tab2 where not exists(select * from tab1 where tab1.a=tab2.a and tab1.b=tab2.b and tab1.c=tab2.c and tab1.d=tab2.d)