内部联接与选择联接中的SQL语句之间的区别 [英] Difference between inner join and where in select join SQL statement

查看:136
本文介绍了内部联接与选择联接中的SQL语句之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个选择连接SQL语句:

I have two select join SQL statements:

select a.id from table_a as a, table_b as b where a.id=b.id;
select a.id from table_a as a inner join table_b as b on a.id=b.id;

显然,它们的结果相同.但是它们之间没有任何区别,例如性能,可移植性.

Obviously, they are the same in result. But is there any difference between them , such as performance, portability.

推荐答案

一个区别是,第一个选项通过在where子句中表达联接条件来隐藏意图.

One difference is that the first option hides the intent by expressing the join condition in the where clause.

写连接条件的第二个选项对于阅读查询的用户来说更加清楚.它显示了查询的确切意图.

The second option, where the join condition is written out is more clear for the user reading the query. It shows the exact intent of the query.

就性能或任何其他差异而言,不应有任何差异.在大多数RDBMS中,这两个查询应该返回完全相同的结果,并执行相同的结果.

As far as performance or any other difference, there shouldn't be any. Both queries should return the exact same result and perform the same under most RDBMS.

这篇关于内部联接与选择联接中的SQL语句之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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