| -- SQLBench-DS query 22 derived from TPC-DS query 22 under the terms of the TPC Fair Use Policy. |
| -- TPC-DS queries are Copyright 2021 Transaction Processing Performance Council. |
| -- This query was generated at scale factor 1. |
| select i_product_name |
| ,i_brand |
| ,i_class |
| ,i_category |
| ,avg(inv_quantity_on_hand) qoh |
| from inventory |
| ,date_dim |
| ,item |
| where inv_date_sk=d_date_sk |
| and inv_item_sk=i_item_sk |
| and d_month_seq between 1201 and 1201 + 11 |
| group by rollup(i_product_name |
| ,i_brand |
| ,i_class |
| ,i_category) |
| order by qoh, i_product_name, i_brand, i_class, i_category |
| LIMIT 100; |
| |