陈某笔记
返回购买 prod_id 为 BR01 的产品的所有顾客的电子邮件(二)
https://www.nowcoder.com/practice/c7aa73afc41f4dfc925baebdd175c345
//1.由于这里没有给出Customers表的表结构,所以要先对该表进行一个查询,明确表结构以及表数据
//2.使用子查询,查询出对应的cust_id
//3.使用in关键字进行数据过滤,得到对应的数据
select
cust_email
from
Customers
where
cust_id in (
select
cust_id
from
Orders a,
OrderItems b
where
a.order_num = b.order_num
and prod_id = 'BR01'
)