최대 1 분 소요

문제 링크

정답

SELECT
    product_id,
    'store1' store,
    store1 price
FROM Products
WHERE store1 is NOT NULL

UNION

SELECT
    product_id,
    'store2' store,
    store2 price
FROM Products
WHERE store2 is NOT NULL

UNION

SELECT
    product_id,
    'store3' store,
    store3 price
FROM Products
WHERE store3 is NOT NULL

✅ Point

  • 각각의 경우를 UNION