[Leetcode] Rearrange Products Table
정답
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