tpcds/queries/q28.sql (50 lines of code) (raw):

-- SQLBench-DS query 28 derived from TPC-DS query 28 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 * from (select avg(ss_list_price) B1_LP ,count(ss_list_price) B1_CNT ,count(distinct ss_list_price) B1_CNTD from store_sales where ss_quantity between 0 and 5 and (ss_list_price between 28 and 28+10 or ss_coupon_amt between 12573 and 12573+1000 or ss_wholesale_cost between 33 and 33+20)) B1, (select avg(ss_list_price) B2_LP ,count(ss_list_price) B2_CNT ,count(distinct ss_list_price) B2_CNTD from store_sales where ss_quantity between 6 and 10 and (ss_list_price between 143 and 143+10 or ss_coupon_amt between 5562 and 5562+1000 or ss_wholesale_cost between 45 and 45+20)) B2, (select avg(ss_list_price) B3_LP ,count(ss_list_price) B3_CNT ,count(distinct ss_list_price) B3_CNTD from store_sales where ss_quantity between 11 and 15 and (ss_list_price between 159 and 159+10 or ss_coupon_amt between 2807 and 2807+1000 or ss_wholesale_cost between 24 and 24+20)) B3, (select avg(ss_list_price) B4_LP ,count(ss_list_price) B4_CNT ,count(distinct ss_list_price) B4_CNTD from store_sales where ss_quantity between 16 and 20 and (ss_list_price between 24 and 24+10 or ss_coupon_amt between 3706 and 3706+1000 or ss_wholesale_cost between 46 and 46+20)) B4, (select avg(ss_list_price) B5_LP ,count(ss_list_price) B5_CNT ,count(distinct ss_list_price) B5_CNTD from store_sales where ss_quantity between 21 and 25 and (ss_list_price between 76 and 76+10 or ss_coupon_amt between 2096 and 2096+1000 or ss_wholesale_cost between 50 and 50+20)) B5, (select avg(ss_list_price) B6_LP ,count(ss_list_price) B6_CNT ,count(distinct ss_list_price) B6_CNTD from store_sales where ss_quantity between 26 and 30 and (ss_list_price between 169 and 169+10 or ss_coupon_amt between 10672 and 10672+1000 or ss_wholesale_cost between 58 and 58+20)) B6 LIMIT 100;