SQLite支持哪些联接? [英] What joins does SQLite support?

查看:123
本文介绍了SQLite支持哪些联接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据 join-op语法,SQLite具有13个不同的join语句:

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?

推荐答案

SQLite语法与

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

前两个,因为要包含OUTER<join type>,还必须在其前面包含<outer join type>.最后一个,因为NATURAL只能出现在<qualified join>的地方,而不是<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.

邮件中的回答列表,SQLite3仅支持三个联接:CROSS JOININNER JOINLEFT OUTER JOIN.以下是等效的:

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

维基百科文章中所述,NATURAL关键字是查找的简写和同名列上的匹配,并且不影响联接类型.

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.

根据 SQLite页面,"RIGHT"和"FULL" 不支持OUTER JOIN.

According to the SQLite page, 'RIGHT' and 'FULLOUTER JOIN's are not supported.

这篇关于SQLite支持哪些联接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆