sql两个表的差

有两个表t1和t2,表中只有一个字段c1。
求两个表的差。即存在于t1,但不存在于t2中的记录。

select c1 from t1 where c1 not in (select c1 from t2)
select c1 from t1 where not exists(select * from t2 where t1.c1=t2.c1)
select t1.c1 from t1 left join t2 on t1.c1=t2.c1 where t2.c1 is null
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容