forked from agirish/tpcds
-
Notifications
You must be signed in to change notification settings - Fork 0
/
query98.sql
29 lines (28 loc) · 991 Bytes
/
query98.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
-- start query 98 in stream 0 using template query98.tpl
SELECT i_item_id,
i_item_desc,
i_category,
i_class,
i_current_price,
Sum(ss_ext_sales_price) AS itemrevenue,
Sum(ss_ext_sales_price) * 100 / Sum(Sum(ss_ext_sales_price))
OVER (
PARTITION BY i_class) AS revenueratio
FROM store_sales,
item,
date_dim
WHERE ss_item_sk = i_item_sk
AND i_category IN ( 'Men', 'Home', 'Electronics' )
AND ss_sold_date_sk = d_date_sk
AND d_date BETWEEN CAST('2000-05-18' AS DATE) AND (
CAST('2000-05-18' 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;