1
0

query12.sql 869 B

12345678910111213141516171819202122232425262728293031323334
  1. -- start query 1 in stream 0 using template query12.tpl and seed 345591136
  2. select i_item_id
  3. ,i_item_desc
  4. ,i_category
  5. ,i_class
  6. ,i_current_price
  7. ,sum(ws_ext_sales_price) as itemrevenue
  8. ,sum(ws_ext_sales_price)*100/sum(sum(ws_ext_sales_price)) over
  9. (partition by i_class) as revenueratio
  10. from
  11. web_sales
  12. ,item
  13. ,date_dim
  14. where
  15. ws_item_sk = i_item_sk
  16. and i_category in ('Electronics', 'Books', 'Women')
  17. and ws_sold_date_sk = d_date_sk
  18. and d_date between cast('1998-01-06' as date)
  19. and (cast('1998-01-06' as date) + 30 days)
  20. group by
  21. i_item_id
  22. ,i_item_desc
  23. ,i_category
  24. ,i_class
  25. ,i_current_price
  26. order by
  27. i_category
  28. ,i_class
  29. ,i_item_id
  30. ,i_item_desc
  31. ,revenueratio
  32. limit 100;
  33. -- end query 1 in stream 0 using template query12.tpl