Coding Test

Leetcode - 1083. Sales Analysis II

Indo Yoon

문제

Loading...
Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.

정답

SELECT DISTINCT buyer_id FROM Sales
JOIN Product ON Sales.product_id = Product.product_id
WHERE Product.product_name = 'S8'
    AND buyer_id NOT IN (
        SELECT buyer_id FROM Sales
        JOIN Product ON Sales.product_id = Product.product_id
        WHERE Product.product_name = 'iPhone'    
    )