比较两个表的数据差别:

在A和B两个用户中,两用户中的inofrmation表结构都是一样的,字段id为主键。


1、A用户表中比B用户表中多出的数据(主要比较主键id)
 
select * from A.information
where id in
(
select id from A.information
minus 
select id from B.information)


2、A用户表和B用户表中,两个表中总共不一样的数据(比较id,name的字段数据)

select id,name from A.information
where id not in (select id from B.information)
union
select id,name from B.information
where id not in (select id from A.information)

3、两个表中id,name相同的记录
--select * from A
--intersect
--select * from
--可以对比提取完全相同的表数据记录
--eg.
select id,name from A.information
intersect
select id,name from B.information


--------------------------------------------


Logo

DAMO开发者矩阵,由阿里巴巴达摩院和中国互联网协会联合发起,致力于探讨最前沿的技术趋势与应用成果,搭建高质量的交流与分享平台,推动技术创新与产业应用链接,围绕“人工智能与新型计算”构建开放共享的开发者生态。

更多推荐