q22.sql 730 B

1234567891011121314151617181920212223
  1. --!syntax_pg
  2. --TPC-DS Q22
  3. -- start query 1 in stream 0 using template ../query_templates/query22.tpl
  4. select i_product_name
  5. ,i_brand
  6. ,i_class
  7. ,i_category
  8. ,avg(inv_quantity_on_hand) qoh
  9. from plato.inventory
  10. ,plato.date_dim
  11. ,plato.item
  12. where inv_date_sk=d_date_sk
  13. and inv_item_sk=i_item_sk
  14. and d_month_seq between 1212 and 1212 + 11
  15. group by rollup(i_product_name
  16. ,i_brand
  17. ,i_class
  18. ,i_category)
  19. order by qoh, i_product_name, i_brand, i_class, i_category
  20. limit 100;
  21. -- end query 1 in stream 0 using template ../query_templates/query22.tpl