内连接和 where in select join SQL 语句的区别 [英] Difference between inner join and where in select join SQL statement

查看:72
本文介绍了内连接和 where in select join SQL 语句的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个 select join 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.

这篇关于内连接和 where in select join SQL 语句的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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