Skip to content

Commit a9b1314

Browse files
authoredDec 3, 2021
Create 1795-rearrange-products-table.sql
1 parent b947456 commit a9b1314

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed
 

‎1795-rearrange-products-table.sql

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Write your MySQL query statement below
2+
SELECT product_id, 'store1' AS store, store1 AS price FROM Products WHERE store1 IS NOT NULL
3+
UNION
4+
SELECT product_id, 'store2' AS store, store2 AS price FROM Products WHERE store2 IS NOT NULL
5+
UNION
6+
SELECT product_id, 'store3' AS store, store3 AS price FROM Products WHERE store3 IS NOT NULL
7+
8+
ORDER BY 1,2 ASC;

0 commit comments

Comments
 (0)
Please sign in to comment.