SQL面试题-查询a,b两表不相交的数据集

SQL面试题-查询a,b两表不相交的数据集,第1张

SQL面试题-查询a,b两表不相交数据

查询 a,b 表中不相交的数据集,用 SQL

hive> select * from b;
OK
1	zhangsan
2	lisi
3	wangwu
6	zhaoqi
7	gaoba
Time taken: 0.575 seconds, Fetched: 5 row(s)
hive> select * from a;
OK
1	zhangsan
2	lisi
3	wangwu
4	maliu
5	tianqi
Time taken: 0.105 seconds, Fetched: 5 row(s)
hive> select b.id ,b.name from a full join b on a.id = b.id where a.id is null union select a.id,a.name from a full join b on a.id = b.id where b .id is null;
Total MapReduce CPU Time Spent: 16 seconds 110 msec
OK
4	maliu
5	tianqi
6	zhaoqi
7	gaoba
Time taken: 72.188 seconds, Fetched: 4 row(s)

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5711248.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-17
下一篇 2022-12-17

发表评论

登录后才能评论

评论列表(0条)

保存