题解 | 返回购买 prod_id 为 BR01 的产品的所有顾客的电子邮件(一)
返回购买 prod_id 为 BR01 的产品的所有顾客的电子邮件(一)
https://www.nowcoder.com/practice/962b16554fbf4b99a87f4d68020c5bfb
#显式内连接:
select c3.cust_email
from Orders o2
inner join OrderItems o1 on o2.order_num=o1.order_num
inner join Customers c3 on o2.cust_id=c3.cust_id
where o1.prod_id='BR01';
/*#隐式内连接:
select c.cust_email
from OrderItems a, Orders b, Customers c
where a.order_num = b.order_num
and b.cust_id = c.cust_id
and a.prod_id = 'BR01'
*/
/*
# 链接表
select cust_email
from Customers
join Orders using(cust_id)
join OrderItems using(order_num)
where prod_id ='BR01'
*/
查看25道真题和解析