diff --git a/doc/src/sgml/sql.sgml b/doc/src/sgml/sql.sgml index 6f0e4dcb21..5a2ce9ab01 100644 --- a/doc/src/sgml/sql.sgml +++ b/doc/src/sgml/sql.sgml @@ -1,5 +1,5 @@ @@ -1058,10 +1058,20 @@ select sname, pname from supplier item that occurs in a FROM clause and before any WHERE, GROUP BY, or HAVING clause. Other table references, including table names or other JOIN clauses, may be included in the FROM clause if separated - by commas. A JOIN of two tables is logically like any other - table listed in the FROM clause. A JOINed table can only be JOINed - to additional tables in a Qualified JOIN as indicated by the - elipses below. + by commas. JOINed tables are logically like any other + table listed in the FROM clause. + + + + JOINs of all types can be chained together or nested where either or both of + T1 and + T2 may be JOINed tables. + A Qualified JOIN may be JOINed to another table (or JOINed table) + following its join specification, which consists of either an + ON search condition or + USING ( join column list ) clause. + Parenthesis can be used around JOIN clauses to control the order + of JOINs which are otherwise processed left to right. @@ -1081,37 +1091,35 @@ select sname, pname from supplier respectively, and returns a joined table containing a cross product, NxM, of joined rows. For each row R1 of T1, each row R2 of T2 is joined with R1 to yield a joined table row JR - consisting of all fields in R1 and R2. + consisting of all fields in R1 and R2. A CROSS JOIN is + essentially an INNER JOIN ON TRUE. - Qualified JOINs + Qualified JOINs + T1 - - - INNER + + INNER - - LEFT - RIGHT - FULL + + LEFT + RIGHT + FULL - OUTER + OUTER - - + JOIN T2 - - + ON search condition USING ( join column list ) - - + ... @@ -1122,9 +1130,6 @@ select sname, pname from supplier column names, which the joined tables must have in common, and joins the tables on those columns, resulting in a joined table having one column for each common column and all of the other columns from both tables. - Like all SELECT queries, the select list of the - SELECT query, before the FROM clause, decides which columns from the joined - table are in the result table returned. @@ -1226,23 +1231,22 @@ select sname, pname from supplier NATURAL JOINs + T1 - - NATURAL - - INNER + NATURAL + + INNER - - LEFT - RIGHT - FULL + + LEFT + RIGHT + FULL - OUTER + OUTER - - - JOIN + + JOIN T2 @@ -1250,18 +1254,14 @@ select sname, pname from supplier A natural join creates a joined table where every pair of matching column names between the two tables are merged into one column. The join specification is effectively a USING clause containing all the - common column names and is otherwise like a Qualified JOIN except - additional JOINs to the JOINed table are not permitted. + common column names and is otherwise like a Qualified JOIN. - - UNION JOIN - Deprecated. - +