리트코드(LeetCode) SQL 문제풀이 - 1795. Rearrange Products Table

2023. 1. 22. 16:53코딩테스트/리트코드(LeetCode) - SQL Study Plan

MySQL 문제 1795. Rearrange Products Table

select product_id, 'store1' as store, store1 as price
    from Products
    where store1 is not null

union

select product_id, 'store2' as store, store2 as price
    from Products
    where store2 is not null

union

select product_id, 'store3' as store, store3 as price
    from Products
    where store3 is not null
728x90