github.com/apache/beam/sdks/v2@v2.48.2/java/testing/tpcds/src/main/resources/queries/query48.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 sum (ss_quantity)
    18   from store_sales, store, customer_demographics, customer_address, date_dim
    19   where s_store_sk = ss_store_sk
    20   and  ss_sold_date_sk = d_date_sk and d_year = 1998
    21   and  
    22   (
    23    (
    24     cd_demo_sk = ss_cdemo_sk
    25     and 
    26     cd_marital_status = 'M'
    27     and 
    28     cd_education_status = '4 yr Degree'
    29     and 
    30     ss_sales_price between 100.00 and 150.00  
    31     )
    32   or
    33    (
    34    cd_demo_sk = ss_cdemo_sk
    35     and 
    36     cd_marital_status = 'D'
    37     and 
    38     cd_education_status = 'Primary'
    39     and 
    40     ss_sales_price between 50.00 and 100.00   
    41    )
    42   or 
    43   (
    44    cd_demo_sk = ss_cdemo_sk
    45    and 
    46     cd_marital_status = 'U'
    47     and 
    48     cd_education_status = 'Advanced Degree'
    49     and 
    50     ss_sales_price between 150.00 and 200.00  
    51   )
    52   )
    53   and
    54   (
    55    (
    56    ss_addr_sk = ca_address_sk
    57    and
    58    ca_country = 'United States'
    59    and
    60    ca_state in ('KY', 'GA', 'NM')
    61    and ss_net_profit between 0 and 2000  
    62    )
    63   or
    64    (ss_addr_sk = ca_address_sk
    65    and
    66    ca_country = 'United States'
    67    and
    68    ca_state in ('MT', 'OR', 'IN')
    69    and ss_net_profit between 150 and 3000 
    70    )
    71   or
    72    (ss_addr_sk = ca_address_sk
    73    and
    74    ca_country = 'United States'
    75    and
    76    ca_state in ('WI', 'MO', 'WV')
    77    and ss_net_profit between 50 and 25000 
    78    )
    79   )