数据仓库服务 GaussDB(DWS)-TPC-DS测试集:SQL12

时间:2025-02-12 14:55:03

SQL12

 1 2 3 4 5 6 7 8 910111213141516171819202122232425262728293031
select  i_item_id      ,i_item_desc       ,i_category       ,i_class       ,i_current_price      ,sum(ws_ext_sales_price) as itemrevenue       ,sum(ws_ext_sales_price)*100/sum(sum(ws_ext_sales_price)) over          (partition by i_class) as revenueratiofromweb_sales,item ,date_dimwhere ws_item_sk = i_item_sk and i_category in ('Music', 'Shoes', 'Children')and ws_sold_date_sk = d_date_skand d_date between cast('2000-05-14' as date) and (cast('2000-05-14' as date) + 30 )group by i_item_id        ,i_item_desc         ,i_category        ,i_class        ,i_current_priceorder by i_category        ,i_class        ,i_item_id        ,i_item_desc        ,revenueratiolimit 100;
support.huaweicloud.com/pwp-dws/dws_13_00041.html