forked from agirish/tpcds
-
Notifications
You must be signed in to change notification settings - Fork 0
/
query27.sql
27 lines (27 loc) · 871 Bytes
/
query27.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
-- start query 27 in stream 0 using template query27.tpl
SELECT i_item_id,
s_state,
Grouping(s_state) g_state,
Avg(ss_quantity) agg1,
Avg(ss_list_price) agg2,
Avg(ss_coupon_amt) agg3,
Avg(ss_sales_price) agg4
FROM store_sales,
customer_demographics,
date_dim,
store,
item
WHERE ss_sold_date_sk = d_date_sk
AND ss_item_sk = i_item_sk
AND ss_store_sk = s_store_sk
AND ss_cdemo_sk = cd_demo_sk
AND cd_gender = 'M'
AND cd_marital_status = 'D'
AND cd_education_status = 'College'
AND d_year = 2000
AND s_state IN ( 'TN', 'TN', 'TN', 'TN',
'TN', 'TN' )
GROUP BY rollup ( i_item_id, s_state )
ORDER BY i_item_id,
s_state
LIMIT 100;