What joins does SQLite support?

The SQLite grammar is a bit different from the SQL-92 spec’s, according to which, the following are illegal:

*OUTER JOIN
*NATURAL OUTER JOIN
*NATURAL CROSS JOIN

The first two, because a <join type>, in order to contain OUTER, must also include an <outer join type> before it. The last, because NATURAL can 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, and LEFT OUTER JOIN. The following are equivalent:

, == CROSS JOIN
JOIN == INNER JOIN
LEFT JOIN == LEFT OUTER JOIN

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.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)