github.com/apache/beam/sdks/v2@v2.48.2/java/testing/tpcds/src/main/resources/queries/query90.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  cast(amc as decimal(15,4))/cast(pmc as decimal(15,4)) am_pm_ratio
    18   from ( select count(*) amc
    19         from web_sales, household_demographics , time_dim, web_page
    20         where ws_sold_time_sk = time_dim.t_time_sk
    21           and ws_ship_hdemo_sk = household_demographics.hd_demo_sk
    22           and ws_web_page_sk = web_page.wp_web_page_sk
    23           and time_dim.t_hour between 6 and 6+1
    24           and household_demographics.hd_dep_count = 8
    25           and web_page.wp_char_count between 5000 and 5200) `at`,
    26        ( select count(*) pmc
    27         from web_sales, household_demographics , time_dim, web_page
    28         where ws_sold_time_sk = time_dim.t_time_sk
    29           and ws_ship_hdemo_sk = household_demographics.hd_demo_sk
    30           and ws_web_page_sk = web_page.wp_web_page_sk
    31           and time_dim.t_hour between 14 and 14+1
    32           and household_demographics.hd_dep_count = 8
    33           and web_page.wp_char_count between 5000 and 5200) pt
    34   order by am_pm_ratio
    35   limit 100