标签:str tab sql out 注意 strong sele join val
id | value |
---|---|
1 | java |
2 | python |
3 | c++ |
id | value |
---|---|
1 | java |
2 | go |
3 | php |
4 | c++ |
计算的是笛卡尔积,不推荐使用
select * from test_a join test_b on test_a.value = test_b.value;
查询结果:
java java
c++ c++
注意:最好将小表放在 左 | 右
select * from test_a left outer join test_b on test_a.value = test_b.value;
查询结果:
java java
python NULL
c++ c++
select * from test_a right outer join test_b on test_a.value = test_b.value;
查询结果:
java java
NULL go
NULL php
c++ c++
select * from test_a full outer join test_b on test_a.value = test_b.value;
查询结果:
java java
python NULL
NULL go
NULL php
c++ c++
select * from test_a left semi join test_b on test_a.value = test_b.value;
等价于:
select * from test_a left outer join test_b on test_a.value = test_b.value where test_b.value is not null;
查询结果:
java java
c++ c++
标签:str tab sql out 注意 strong sele join val
原文地址:https://www.cnblogs.com/remainsu/p/hive-chang-yong-de-join-cao-zuo-shi-li.html