题解 | #返回购买 的产品的所有顾客的电子邮件(二)#

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

https://www.nowcoder.com/practice/c7aa73afc41f4dfc925baebdd175c345

首先查找prod_id为BR01的项

 select order_num
 from OrderItems
 where prod_id = 'BR01'

其次提取Orders表数据

最后用select子查询将Customers表和Orders表进行联结,从中取出符合条件的cust_email数据

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

全部评论

相关推荐

秋盈丶:后续:我在宿舍群里和大学同学分享了这事儿,我好兄弟气不过把他挂到某脉上了,10w+阅读量几百条评论,直接干成精品贴子,爽
点赞 评论 收藏
分享
海螺很能干:每次看到这种简历都没工作我就觉得离谱
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务