一、联结的种类
![](https://i-blog.csdnimg.cn/blog_migrate/60995b9daf1e0a0b25ff517b8dcffc07.png)
二、自联结(一张表)
select *
from table AS *, table AS **
WHERE *._ = **._
AND _ _ _
-- 已知出问题的产品ID,在产品表中寻找此产品的供应商,并列出该供应商其他所有产品信息(同一张表)
select *
from products as A , products as B
where A.vend_id = B.vend_id
and B.prod_id = "DTNTR";
自联结也可以用子查询结合WHERE来实现
select * from products
WHERE vend_id in (select vend_id
from data.products
where prod_id = "DTNTR");
三、内部联结/等值联结(inner join = join)
select **
from * inner join *
on * = *