1795 每个产品在不同商店的价格

题目描述:
1795 每个产品在不同商店的价格
请你重构 Products 表,查询每个产品在不同商店的价格,使得输出的格式变为(product_id, store, price) 。如果这一产品在商店里没有出售,则不输出这一行。
输出结果表中的顺序不作要求。
查询输出格式请参考下面示例。

方法1:
主要思路:解题链接汇总

select product_id as product_id,'store1' as store,store1 as price
from Products
where store1 is not null
union select product_id as product_id,'store2' as store,store2 as price
from Products
where store2 is not null
union select product_id as product_id,'store3' as store,store3 as price
from Products
where store3 is not null
上一篇:1677 发票中的产品金额


下一篇:Jvm调优实战