如何区分两个表

Nem*_*mat 3 sql sqlite android

我有两个表,我想从一个表中获取与第二个表中的记录不同的所有记录.

例如:如果我们在第一个表中有四个记录,如A,B,C,D和第二个表中有A,B,C的三个记录,那么查询的答案应该是D.

我试过"EXCEPT"运算符,但它不能正常工作.请帮助我为给定的问题编写正确的查询.

mod*_*z0r 7

怎么样:

select * from TABLE_A where (COL,COL2,..) not in (select COL1,COL2,.. from TABLE_B) 
union all 
select * from TABLE_B where (COL1,COL2,..) not in (select COL1,COL2,.. from TABLE_A); 
Run Code Online (Sandbox Code Playgroud)