except、except all 都是取集合的差集; 它们的区别在于except取差集后会删除重复项,而except all 不删除重复项。 下面是举例说明:
表t_01
表t_02
except执行结果:
mybase=# select name from t_01 except select name from t_02;
a b d
(3 行)
except all执行结果:
mybase=# select name from t_01 except all select name from t_02 ;
a a b d
(4行)