github.com/apache/beam/sdks/v2@v2.48.2/java/testing/tpcds/src/main/resources/queries/query25.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 i_item_id 19 ,i_item_desc 20 ,s_store_id 21 ,s_store_name 22 ,sum(ss_net_profit) as store_sales_profit 23 ,sum(sr_net_loss) as store_returns_loss 24 ,sum(cs_net_profit) as catalog_sales_profit 25 from 26 store_sales 27 ,store_returns 28 ,catalog_sales 29 ,date_dim d1 30 ,date_dim d2 31 ,date_dim d3 32 ,store 33 ,item 34 where 35 d1.d_moy = 4 36 and d1.d_year = 2000 37 and d1.d_date_sk = ss_sold_date_sk 38 and i_item_sk = ss_item_sk 39 and s_store_sk = ss_store_sk 40 and ss_customer_sk = sr_customer_sk 41 and ss_item_sk = sr_item_sk 42 and ss_ticket_number = sr_ticket_number 43 and sr_returned_date_sk = d2.d_date_sk 44 and d2.d_moy between 4 and 10 45 and d2.d_year = 2000 46 and sr_customer_sk = cs_bill_customer_sk 47 and sr_item_sk = cs_item_sk 48 and cs_sold_date_sk = d3.d_date_sk 49 and d3.d_moy between 4 and 10 50 and d3.d_year = 2000 51 group by 52 i_item_id 53 ,i_item_desc 54 ,s_store_id 55 ,s_store_name 56 order by 57 i_item_id 58 ,i_item_desc 59 ,s_store_id 60 ,s_store_name 61 limit 100