题解 | 在子查询中使用inner join、Using函数
返回购买 prod_id 为 BR01 的产品的所有顾客的电子邮件(二)
https://www.nowcoder.com/practice/c7aa73afc41f4dfc925baebdd175c345
-- 纯inner join # SELECT # c.cust_email # FROM # Customers c # INNER JOIN Orders o ON c.cust_id = o.cust_id # INNER JOIN OrderItems oi ON oi.order_num = o.order_num # WHERE # oi.prod_id = 'BR01' -- 子查询+inner join -- 全凭语法写出来 没点逻辑 SELECT c.cust_email FROM Customers c WHERE c.cust_id IN ( SELECT cust_id FROM Orders WHERE order_num IN ( SELECT order_num FROM OrderItems INNER JOIN Orders USING ( order_num ) WHERE prod_id = 'BR01' ) )