query27-partitioned.sql 776 B

12345678910111213141516171819202122232425
  1. select i_item_id,
  2. s_state,
  3. avg(ss_quantity) agg1,
  4. avg(ss_list_price) agg2,
  5. avg(ss_coupon_amt) agg3,
  6. avg(ss_sales_price) agg4
  7. from store_sales
  8. JOIN customer_demographics ON store_sales.ss_cdemo_sk = customer_demographics.cd_demo_sk
  9. JOIN date_dim ON store_sales.ss_sold_date_sk = date_dim.d_date_sk
  10. JOIN store ON store_sales.ss_store_sk = store.s_store_sk
  11. JOIN item ON store_sales.ss_item_sk = item.i_item_sk
  12. where
  13. cd_gender = 'F' and
  14. cd_marital_status = 'W' and
  15. cd_education_status = 'Primary' and
  16. d_year = 1998 and
  17. s_state = 'TN' and
  18. ss_sold_date between '1998-01-01' and '1998-12-31'
  19. group by i_item_id, s_state
  20. order by i_item_id
  21. ,s_state
  22. limit 100;