query22.sql 742 B

1234567891011121314151617181920
  1. select i_product_name
  2. ,i_brand
  3. ,i_class
  4. ,i_category
  5. ,avg(inv_quantity_on_hand) qoh
  6. from inventory
  7. ,date_dim
  8. ,item
  9. ,warehouse
  10. where inventory.inv_date_sk=date_dim.d_date_sk
  11. and inventory.inv_item_sk=item.i_item_sk
  12. and inventory.inv_warehouse_sk = warehouse.w_warehouse_sk
  13. and date_dim.d_month_seq between 1193 and 1193 + 11
  14. and inv_date between '1999-06-01' and '2000-05-31'
  15. group by i_product_name
  16. ,i_brand
  17. ,i_class
  18. ,i_category with rollup
  19. order by qoh, i_product_name, i_brand, i_class, i_category
  20. limit 100;