github.com/apache/beam/sdks/v2@v2.48.2/java/testing/tpcds/src/main/resources/queries/query79.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    c_last_name,c_first_name,substring(s_city,1,30),ss_ticket_number,amt,profit
    19    from
    20     (select ss_ticket_number
    21            ,ss_customer_sk
    22            ,store.s_city
    23            ,sum(ss_coupon_amt) amt
    24            ,sum(ss_net_profit) profit
    25      from store_sales,date_dim,store,household_demographics
    26      where store_sales.ss_sold_date_sk = date_dim.d_date_sk
    27      and store_sales.ss_store_sk = store.s_store_sk  
    28      and store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk
    29      and (household_demographics.hd_dep_count = 8 or household_demographics.hd_vehicle_count > 0)
    30      and date_dim.d_dow = 1
    31      and date_dim.d_year in (1998,1998+1,1998+2) 
    32      and store.s_number_employees between 200 and 295
    33      group by ss_ticket_number,ss_customer_sk,ss_addr_sk,store.s_city) ms,customer
    34      where ss_customer_sk = c_customer_sk
    35   order by c_last_name,c_first_name,substring(s_city,1,30), profit
    36  limit 100