SQL Server 中的自然连接 [英] Natural join in SQL Server

查看:27
本文介绍了SQL Server 中的自然连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近的 Microsoft SQL Server 是否支持 自然连接版本?或者是否有一个很好的替代方法可以让 SQL Server 计算出基于参照完整性的 ON 子句中的谓词?

Is there any support for natural joins in recent Microsoft SQL Server editions? Or is there a good alternative for making SQL Server work out the predicates that would have been in the ON clauses based on the referential integrity?

推荐答案

不用了,谢谢幸运星

我不敢相信您会希望引擎为您猜测 JOIN

I can't believe that you'd want the engine to guess the JOIN for you

相关链接:

编辑,解释原因

  • JOIN(无论是 USING 还是 ON)清晰明确
  • 我应该能够为存储在表中的实体命名我的列,而不必担心另一个表中的列被称为什么,没有 NATURAL JOIN 副作用

Bill Karwin27535">这个很好的答案:

Quoting Bill Karwin in this excellent answer:

我从不使用 NATURAL JOIN 因为我不喜欢join 可以做一些我不想要的事情,因为某些列名两个表中都存在.

I never use NATURAL JOIN because I don't like the possibility that the join could do something I don't intend just because some column name exists in both tables.

这篇关于SQL Server 中的自然连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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