用SQLite完全外联接

SQLite只有INNER和LEFT JOIN。

有没有办法用SQLite做一个完整的外部联接?

是的,请参阅Wikipedia上的示例。

SELECT employee.*, department.* FROM employee LEFT JOIN department ON employee.DepartmentID = department.DepartmentID UNION ALL SELECT employee.*, department.* FROM department LEFT JOIN employee ON employee.DepartmentID = department.DepartmentID WHERE employee.DepartmentID IS NULL 

继乔纳森·莱弗勒(Jonathan Leffler)的评论之后,下面是马克·拜尔斯(Mark Byers)的另一个答案:

 SELECT * FROM table_name_1 LEFT OUTER JOIN table_name_2 ON id_1 = id_2 UNION SELECT * FROM table_name_2 LEFT OUTER JOIN table_name_1 ON id_1 = id_2 

看到这里的原始来源和进一步的SQLite的例子。