从几个表VS内连接(From several table VS inner join)

编程入门 行业动态 更新时间:2024-10-22 23:05:58
几个表VS内连接(From several table VS inner join)

我不明白这一点。

有什么区别

select e.empid from employee_table e inner join customer_table c on deref(c.infos).personid = deref(e.infos).personid order by e.empid;

select e.empid from employee_table e, customer_table c where deref(c.infos).personid = deref(e.infos).personid order by e.empid;

结果是一样的。 一个比另一个更快?

什么时候使用内连接我们可以简单地从多个表中选择?

I can't get the point.

What is the difference between

select e.empid from employee_table e inner join customer_table c on deref(c.infos).personid = deref(e.infos).personid order by e.empid;

and

select e.empid from employee_table e, customer_table c where deref(c.infos).personid = deref(e.infos).personid order by e.empid;

The results are the same. Is one faster to perform than the other ?

When to use an inner join when we can simply select from multiple table ?

最满意答案

因为这两个查询是等价的。 但第一个是使用ANSI-92样式连接,第二个是使用ANSI-89样式连接。 较新的连接语法不容易出错,现在已经存在了25年。

您应该始终使用ANSI-92样式连接。 http://sqlblog.com/blogs/aaron_bertrand/archive/2009/10/08/bad-habits-to-kick-using-old-style-joins.aspx

Because these two queries are equivalent. But the first one is using ANSI-92 style joins and the second is using ANSI-89 style joins. The newer join syntax is less prone to error and it has been around for 25 years now.

You should always use the ANSI-92 style joins.

Bad habits to kick : using old-style JOINs

更多推荐

本文发布于:2023-07-30 23:04:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1340344.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:几个   table   join

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!