forked from agirish/tpcds
-
Notifications
You must be signed in to change notification settings - Fork 0
/
query12.sql
31 lines (30 loc) · 1001 Bytes
/
query12.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
-- start query 12 in stream 0 using template query12.tpl
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 revenueratio
FROM web_sales ,
item ,
date_dim
WHERE ws_item_sk = i_item_sk
AND i_category IN ('Home',
'Men',
'Women')
AND ws_sold_date_sk = d_date_sk
AND d_date BETWEEN Cast('2000-05-11' AS DATE) AND (
Cast('2000-05-11' AS DATE) + INTERVAL '30' day)
GROUP BY i_item_id ,
i_item_desc ,
i_category ,
i_class ,
i_current_price
ORDER BY i_category ,
i_class ,
i_item_id ,
i_item_desc ,
revenueratio
LIMIT 100;