本文介绍了什么是PostgreSQL中的LEFT JOIN的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经看到使用 LEFT JOIN 而不是 INNER 或左外。
I've seen a query using a LEFT JOIN as opposed to an INNER or LEFT OUTER.
什么是左联接?
推荐答案其中内部联接仅返回在两个表中都匹配的条目,而 left join 从第一个表中获取所有条目,并从第二个表中匹配所有条目。 右连接与左连接(即:全部来自第二张表)相反。
Where an inner join returns only entries that match in both tables, a left join takes all the entries from first table and any that match in the second table. A right join is the reverse of a left join (ie: all from the second table)
因此,如果TableA是
So if TableA is
A B 1 a 2 b 3 c和TableB是
A B 1 d 2 e然后从TableA上的TableA内部联接TableB中选择* = TableB.A 返回
1 a 1 d 2 b 2 e并且 Select * from TableA左联接TableA.A = TableB.A上的TableB
And Select * from TableA left join TableB on TableA.A = TableB.A returns
1 a 1 d 2 b 2 e 3 c null null更多推荐
什么是PostgreSQL中的LEFT JOIN
发布评论