更好的,隐式的或显式的联接? [英] Which is better, implicit or explicit join?

查看:60
本文介绍了更好的,隐式的或显式的联接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
SQL JOIN:使用之间有区别,还是在哪里?

Possible Duplicate:
SQL JOIN: is there a difference between USING, ON or WHERE?

哪个更好:

SELECT `sheet_data`.* 
FROM  `clip`, `sheet_data` 
WHERE `clip`.`mrecord`='8' AND `clip`.`data`=`sheet_data`.`id`

SELECT `sheet_data`.* 
FROM  `clip` INNER JOIN `sheet_data` 
  ON  `clip`.`data`=`sheet_data`.`id`
WHERE `clip`.`mrecord`='8'

为什么?

推荐答案

在较早的日子里,第一个速度更快,但这不再是事实.我个人认为INNER JOIN更好,因为它更具可读性.它更好地显示了表之间的关系.您在联接中获得了这些关系,并在WHERE子句中进行了过滤.这种分隔使查询更具可读性.但这是个人喜好.

In older days, the first was faster, but this is not true anymore. I personally think the INNER JOIN is better, because it is more readable. It shows better the relations between the table. You got those relations in the join, and you do the filtering in the WHERE clause. This separation makes the query more readable. But this is a matter of personal taste.

这篇关于更好的,隐式的或显式的联接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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