According to the join-op syntax, SQLite has 13 distinct join statements:
, JOIN LEFT JOIN OUTER JOIN LEFT OUTER JOIN INNER JOIN CROSS JOIN NATURAL JOIN NATURAL LEFT JOIN NATURAL OUTER JOIN NATURAL LEFT OUTER JOIN NATURAL INNER JOIN NATURAL CROSS JOIN
Are they all unique? Which are equivalent?
The SQLite grammar is a bit different from the SQL-92 spec‘s, according to which, the following are illegal:
The first two, because a
<join type>, in order to containOUTER, must also include an<outer join type>before it. The last, becauseNATURALcan only occur in<qualified join>‘s, not<cross join>‘s. These don’t appear to behave according to any spec, so it’s a good idea to avoid them.As was answered on the mailing list, SQLite3 only supports three joins:
CROSS JOIN,INNER JOIN, andLEFT OUTER JOIN. The following are equivalent:As explained in the wikipedia article the NATURAL keyword is shorthand for finding and matching on same-name columns, and doesn’t affect the the join type.
According to the SQLite page, ‘
RIGHT‘ and ‘FULL‘OUTER JOIN‘s are not supported.