Back to home page

OSCL-LXR

 
 

    


0001 -- This is a new query in TPCDS v2.7
0002 select
0003   cd_gender,
0004   cd_marital_status,
0005   cd_education_status,
0006   count(*) cnt1,
0007   cd_purchase_estimate,
0008   count(*) cnt2,
0009   cd_credit_rating,
0010   count(*) cnt3,
0011   cd_dep_count,
0012   count(*) cnt4,
0013   cd_dep_employed_count,
0014   count(*) cnt5,
0015   cd_dep_college_count,
0016   count(*) cnt6
0017 from
0018   customer c,customer_address ca,customer_demographics
0019 where
0020   c.c_current_addr_sk = ca.ca_address_sk
0021     and ca_county in ('Walker County', 'Richland County', 'Gaines County', 'Douglas County', 'Dona Ana County')
0022     and cd_demo_sk = c.c_current_cdemo_sk
0023     and exists (
0024         select *
0025         from store_sales,date_dim
0026         where c.c_customer_sk = ss_customer_sk
0027           and ss_sold_date_sk = d_date_sk
0028           and d_year = 2002
0029           and d_moy between 4 and 4 + 3)
0030     and exists (
0031         select *
0032         from (
0033             select
0034               ws_bill_customer_sk as customer_sk,
0035               d_year,
0036               d_moy
0037             from web_sales, date_dim
0038             where ws_sold_date_sk = d_date_sk
0039               and d_year = 2002
0040               and d_moy between 4 and 4 + 3
0041             union all
0042             select
0043               cs_ship_customer_sk as customer_sk,
0044               d_year,
0045               d_moy
0046             from catalog_sales, date_dim
0047             where cs_sold_date_sk = d_date_sk
0048               and d_year = 2002
0049               and d_moy between 4 and 4 + 3) x
0050     where c.c_customer_sk = customer_sk)
0051 group by
0052   cd_gender,
0053   cd_marital_status,
0054   cd_education_status,
0055   cd_purchase_estimate,
0056   cd_credit_rating,
0057   cd_dep_count,
0058   cd_dep_employed_count,
0059   cd_dep_college_count
0060 order by
0061   cd_gender,
0062   cd_marital_status,
0063   cd_education_status,
0064   cd_purchase_estimate,
0065   cd_credit_rating,
0066   cd_dep_count,
0067   cd_dep_employed_count,
0068   cd_dep_college_count
0069 limit 100