自连接
select prod_id,vend_id,prod_name from products p1 join products p2 on p1.vend_id where p1.prod_name = '1 ton anvil';
自然链接
select prod_id,prod_name,p.vend_id,vend_name from products p join vendors v on p.vend_id = v.vend_id;
外部链接
select prod_id,prod_name,p.vend_id,vend_name from products p left join vendors v on p.vend_id = v.vend_id;
使用带聚集函数的链接
select c.cust_name,c.cust_id,count(o.order_num) num_ord from customers c join orders o on c.cust_id = o.cust_id group by c.cust_id;
使用链接和链接条件