q26.sql 817 B

123456789101112131415161718192021222324
  1. --!syntax_pg
  2. --TPC-DS Q26
  3. -- start query 1 in stream 0 using template ../query_templates/query26.tpl
  4. select i_item_id,
  5. avg(cs_quantity) agg1,
  6. avg(cs_list_price) agg2,
  7. avg(cs_coupon_amt) agg3,
  8. avg(cs_sales_price) agg4
  9. from plato.catalog_sales, plato.customer_demographics, plato.date_dim, plato.item, plato.promotion
  10. where cs_sold_date_sk = d_date_sk and
  11. cs_item_sk = i_item_sk and
  12. cs_bill_cdemo_sk = cd_demo_sk and
  13. cs_promo_sk = p_promo_sk and
  14. cd_gender = 'F' and
  15. cd_marital_status = 'W' and
  16. cd_education_status = 'Primary' and
  17. (p_channel_email = 'N' or p_channel_event = 'N') and
  18. d_year = 1998
  19. group by i_item_id
  20. order by i_item_id
  21. limit 100;
  22. -- end query 1 in stream 0 using template ../query_templates/query26.tpl