问题描述
在处理遗留代码时,我注意到几次,您可以使用
I have noticed a few times when working on legacy code, that you can do left and right outer joins in sql by using the
=*
作为右外连接"的一种简写和
as kind of shorthand for "right outer join" and
*=
在这样的语句中作为左外连接"的一种简写:
as kind of shorthand for "left outer join" in statements like this:
select table1.firstname, table2.lastname
from table1, table2
where table1.id *= table2.id
我猜想对于不同类型的连接,还有像这两个这样的其他运算符,但我找不到任何关于它的完整文档.那么您知道文档的任何好的链接吗?
I would guess that there are other operators like these two for the different kinds of joins, but i have not been able to find any good complete documentation about it. So do you know any good links to documentation?
我个人认为使用这些运算符的 SQL 语句比使用拼写语法时更难弄清楚,那么使用简写版本有什么好处吗?
I personaly think that the SQL statements i have seen using these operators are more difficult to figure out than when using the spelled out syntax, so is there any benefits using the shorthand version?
推荐答案
=* 和 *= 不符合当前的 SQL 标准,我相信这些运算符很快就会被弃用,您应该始终使用标准的连接语法.您提到的其他运算符令人困惑,需要离开,当我在数据库对象中看到这些时,我感到害怕.
The =* and *= are not complaint with current SQL standards, I believe these operators will be deprecated soon you should always use the standard join syntax. The other operators that you mention are confusing and need to go away, I cringe when I see these in database objects.
这篇关于Transact-SQL 速记连接语法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!