github.com/apache/beam/sdks/v2@v2.48.2/java/testing/tpcds/src/main/resources/queries/query10.sql (about)

     1  -- Licensed to the Apache Software Foundation (ASF) under one
     2  -- or more contributor license agreements.  See the NOTICE file
     3  -- distributed with this work for additional information
     4  -- regarding copyright ownership.  The ASF licenses this file
     5  -- to you under the Apache License, Version 2.0 (the
     6  -- "License"); you may not use this file except in compliance
     7  -- with the License.  You may obtain a copy of the License at
     8  --
     9  --     http://www.apache.org/licenses/LICENSE-2.0
    10  --
    11  -- Unless required by applicable law or agreed to in writing, software
    12  -- distributed under the License is distributed on an "AS IS" BASIS,
    13  -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    14  -- See the License for the specific language governing permissions and
    15  -- limitations under the License.
    16  
    17  select
    18    cd_gender,
    19    cd_marital_status,
    20    cd_education_status,
    21    count(*) cnt1,
    22    cd_purchase_estimate,
    23    count(*) cnt2,
    24    cd_credit_rating,
    25    count(*) cnt3,
    26    cd_dep_count,
    27    count(*) cnt4,
    28    cd_dep_employed_count,
    29    count(*) cnt5,
    30    cd_dep_college_count,
    31    count(*) cnt6
    32   from
    33    customer c,customer_address ca,customer_demographics
    34   where
    35    c.c_current_addr_sk = ca.ca_address_sk and
    36    ca_county in ('Walker County','Richland County','Gaines County','Douglas County','Dona Ana County') and
    37    cd_demo_sk = c.c_current_cdemo_sk and 
    38    exists (select *
    39            from store_sales,date_dim
    40            where c.c_customer_sk = ss_customer_sk and
    41                  ss_sold_date_sk = d_date_sk and
    42                  d_year = 2002 and
    43                  d_moy between 4 and 4+3) and
    44     (exists (select *
    45              from web_sales,date_dim
    46              where c.c_customer_sk = ws_bill_customer_sk and
    47                    ws_sold_date_sk = d_date_sk and
    48                    d_year = 2002 and
    49                    d_moy between 4 ANd 4+3) or 
    50      exists (select * 
    51              from catalog_sales,date_dim
    52              where c.c_customer_sk = cs_ship_customer_sk and
    53                    cs_sold_date_sk = d_date_sk and
    54                    d_year = 2002 and
    55                    d_moy between 4 and 4+3))
    56   group by cd_gender,
    57            cd_marital_status,
    58            cd_education_status,
    59            cd_purchase_estimate,
    60            cd_credit_rating,
    61            cd_dep_count,
    62            cd_dep_employed_count,
    63            cd_dep_college_count
    64   order by cd_gender,
    65            cd_marital_status,
    66            cd_education_status,
    67            cd_purchase_estimate,
    68            cd_credit_rating,
    69            cd_dep_count,
    70            cd_dep_employed_count,
    71            cd_dep_college_count
    72  limit 100