本文介绍了联接与子查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是一个老式的MySQL用户,并且总是优先使用JOIN
而不是子查询.但是如今,每个人都使用子查询,而我讨厌它.我不知道为什么
I am an old-school MySQL user and have always preferred JOIN
over sub-query. But nowadays everyone uses sub-query, and I hate it; I don't know why.
我缺乏理论判断力来判断自己是否有差异.子查询是否与JOIN
一样好,因此不必担心吗?
I lack the theoretical knowledge to judge for myself if there is any difference. Is a sub-query as good as a JOIN
and therefore is there nothing to worry about?
推荐答案
来自MySQL手册( 13.2.10.11将子查询重写为联接):
因此子查询的速度可能比LEFT [OUTER] JOIN
慢,但我认为它们的优势是可读性稍高.
So subqueries can be slower than LEFT [OUTER] JOIN
, but in my opinion their strength is slightly higher readability.
这篇关于联接与子查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!