题干再解释

返回购买 prod_id 为 BR01 的产品的所有顾客的电子邮件(一)

https://www.nowcoder.com/practice/962b16554fbf4b99a87f4d68020c5bfb

select cust_email
from Customers
where cust_id in (
    select cust_id
    from Orders
    where order_num in (
        select order_num 
        from OrderItems
        where prod_id = 'BR01'
    )
)

题目表述有点问题,描述当中“你想知道xxx的日期"跟这个题目没有关系

就是有三张表,Customer,Orders,OrderItems(可以题干最下面的表创建sql)

Customer表:

cust_id

cust_email

cust10

cust10@cust.com

cust1

cust1@cust.com

cust2

cust2@cust.com

Orders表

order_num

cust_id

order_date

a0001

cust10

2022-01-01 00:00:00

a0002

cust1

2022-01-01 00:01:00

a0003

cust1

2022-01-02 00:00:00

a0013

cust2

2022-01-01 00:20:00

OrderItems表

prod_id

order_num

BR01

a0001

BR01

a0002

BR02

a0003

BR02

a0013

全部评论

相关推荐

听说改名字就能收到offer哈:Radis写错了兄弟
点赞 评论 收藏
分享
1 收藏 评论
分享
牛客网
牛客企业服务