query7.sql 701 B

123456789101112131415161718192021
  1. select i_item_id,
  2. avg(ss_quantity) agg1,
  3. avg(ss_list_price) agg2,
  4. avg(ss_coupon_amt) agg3,
  5. avg(ss_sales_price) agg4
  6. from store_sales, customer_demographics, date_dim, item, promotion
  7. where store_sales.ss_sold_date_sk = date_dim.d_date_sk and
  8. store_sales.ss_item_sk = item.i_item_sk and
  9. store_sales.ss_cdemo_sk = customer_demographics.cd_demo_sk and
  10. store_sales.ss_promo_sk = promotion.p_promo_sk and
  11. cd_gender = 'F' and
  12. cd_marital_status = 'W' and
  13. cd_education_status = 'Primary' and
  14. (p_channel_email = 'N' or p_channel_event = 'N') and
  15. d_year = 1998
  16. group by i_item_id
  17. order by i_item_id
  18. limit 100;