Update FAQ.
This commit is contained in:
parent
7e0919136a
commit
0fada37f5d
14
doc/FAQ
14
doc/FAQ
@ -948,7 +948,8 @@ SELECT *
|
|||||||
|
|
||||||
4.24) How do I do an outer join?
|
4.24) How do I do an outer join?
|
||||||
|
|
||||||
PostgreSQL 7.1 and later supports outer joins. Here are two examples:
|
PostgreSQL 7.1 and later supports outer joins using the SQL standard
|
||||||
|
syntax. Here are two examples:
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM t1 LEFT OUTER JOIN t2 ON (t1.col = t2.col);
|
FROM t1 LEFT OUTER JOIN t2 ON (t1.col = t2.col);
|
||||||
|
|
||||||
@ -956,11 +957,12 @@ SELECT *
|
|||||||
SELECT *
|
SELECT *
|
||||||
FROM t1 LEFT OUTER JOIN t2 USING (col);
|
FROM t1 LEFT OUTER JOIN t2 USING (col);
|
||||||
|
|
||||||
These identical queries join t1.col to t2.col, and return any unjoined
|
These identical queries join t1.col to t2.col, and also return any
|
||||||
rows in t1. A RIGHT join would return unjoined rows of table t2. A
|
unjoined rows in t1 (those with no match in t2). A RIGHT join would
|
||||||
FULL join would return unjoined rows from t1 and t2. The word OUTER is
|
add unjoined rows of t2. A FULL join would return the matched rows
|
||||||
optional and is assumed in LEFT, RIGHT, and FULL joins. Ordinary joins
|
plus all unjoined rows from t1 and t2. The word OUTER is optional and
|
||||||
are called INNER joins.
|
is assumed in LEFT, RIGHT, and FULL joins. Ordinary joins are called
|
||||||
|
INNER joins.
|
||||||
|
|
||||||
In previous releases, outer joins can be simulated using UNION and NOT
|
In previous releases, outer joins can be simulated using UNION and NOT
|
||||||
IN. For example, when joining tab1 and tab2, the following query does
|
IN. For example, when joining tab1 and tab2, the following query does
|
||||||
|
@ -1224,8 +1224,8 @@ Lobby your company to join W3C, see http://www.w3.org/Consortium
|
|||||||
<H4><A name="4.24">4.24</A>) How do I do an <I>outer</I> join?<BR>
|
<H4><A name="4.24">4.24</A>) How do I do an <I>outer</I> join?<BR>
|
||||||
</H4>
|
</H4>
|
||||||
|
|
||||||
<P>PostgreSQL 7.1 and later supports outer joins. Here are two
|
<P>PostgreSQL 7.1 and later supports outer joins using the SQL
|
||||||
examples:</P>
|
standard syntax. Here are two examples:</P>
|
||||||
<PRE>
|
<PRE>
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM t1 LEFT OUTER JOIN t2 ON (t1.col = t2.col);
|
FROM t1 LEFT OUTER JOIN t2 ON (t1.col = t2.col);
|
||||||
@ -1235,9 +1235,10 @@ or
|
|||||||
SELECT *
|
SELECT *
|
||||||
FROM t1 LEFT OUTER JOIN t2 USING (col);
|
FROM t1 LEFT OUTER JOIN t2 USING (col);
|
||||||
</PRE>
|
</PRE>
|
||||||
These identical queries join t1.col to t2.col, and return any
|
These identical queries join t1.col to t2.col, and also return any
|
||||||
unjoined rows in t1. A <SMALL>RIGHT</SMALL> join would return
|
unjoined rows in t1 (those with no match in t2). A
|
||||||
unjoined rows of table t2. A <SMALL>FULL</SMALL> join would return
|
<SMALL>RIGHT</SMALL> join would add unjoined rows of t2. A
|
||||||
|
<SMALL>FULL</SMALL> join would return the matched rows plus all
|
||||||
unjoined rows from t1 and t2. The word <SMALL>OUTER</SMALL> is
|
unjoined rows from t1 and t2. The word <SMALL>OUTER</SMALL> is
|
||||||
optional and is assumed in <SMALL>LEFT</SMALL>,
|
optional and is assumed in <SMALL>LEFT</SMALL>,
|
||||||
<SMALL>RIGHT</SMALL>, and <SMALL>FULL</SMALL> joins. Ordinary joins
|
<SMALL>RIGHT</SMALL>, and <SMALL>FULL</SMALL> joins. Ordinary joins
|
||||||
|
Loading…
x
Reference in New Issue
Block a user