SQL:Join:修订间差异
Created page with "=Example= <syntaxhighlight lang="bash"> A B - - 1 3 2 4 3 5 4 6 </syntaxhighlight> ==Inner Join== <syntaxhighlight lang="bash"> select * from a INNER JOIN b on a.a = b.b; select a.*, b.* from a,b where a.a = b.b; a | b --+-- 3 | 3 4 | 4 </syntaxhighlight> ==Left Join== <syntaxhighlight lang="bash"> select * from a LEFT OUTER JOIN b on a.a = b.b; select a.*, b.* from a,b where a.a = b.b(+); a | b --+----- 1 | null 2 | null 3 | 3 4 | 4 </syntax..." |
|||
第1行: | 第1行: | ||
[[Image:Visual-join.png]] | |||
=Example= | =Example= | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> |
2023年10月12日 (四) 02:34的版本
Example
A B
- -
1 3
2 4
3 5
4 6
Inner Join
select * from a INNER JOIN b on a.a = b.b;
select a.*, b.* from a,b where a.a = b.b;
a | b
--+--
3 | 3
4 | 4
Left Join
select * from a LEFT OUTER JOIN b on a.a = b.b;
select a.*, b.* from a,b where a.a = b.b(+);
a | b
--+-----
1 | null
2 | null
3 | 3
4 | 4
Right Join
select * from a RIGHT OUTER JOIN b on a.a = b.b;
select a.*, b.* from a,b where a.a(+) = b.b;
a | b
-----+----
3 | 3
4 | 4
null | 5
null | 6
Full Join
select * from a FULL OUTER JOIN b on a.a = b.b;
a | b
-----+-----
1 | null
2 | null
3 | 3
4 | 4
null | 6
null | 5