返回购买prod_id为BR01的产品的所有顾客的电子邮件
返回购买 prod_id 为 BR01 的产品的所有顾客的电子邮件(二)
https://www.nowcoder.com/practice/c7aa73afc41f4dfc925baebdd175c345
本题的考察点为多表连接 + 子查询,难度不大,个人感觉按照先子查询后连接的思路来做的话还是比较清晰。
select cust_email from Orders t1 join Customers t2 on t1.cust_id = t2.cust_id // 使用join连接按照cust_id连接Orders表与Customers表 where order_num in (select order_num from OrderItems // 使用子查询查找产品编号为“BR01”的订单编号 where prod_id = "BR01")