Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在建立 SQL 内连接时,应该将哪个表定义为左表,将哪个表定义为右表。表的大小是否是相同的决定因素。请解释。
我从性能/优化的角度提出这个问题。
答案是对于内部连接,表的顺序严格来说应该无关紧要。MySQL 查询优化器将决定哪个表应该首先出现。内部连接的顺序无关紧要的原因是结果集由两个表中的公共记录组成。