blob: 21afc0ee42b7a0dfcac435eba1229debdcaaf028 [file] [log] [blame]
-- @@@ START COPYRIGHT @@@
--
-- Licensed to the Apache Software Foundation (ASF) under one
-- or more contributor license agreements. See the NOTICE file
-- distributed with this work for additional information
-- regarding copyright ownership. The ASF licenses this file
-- to you under the Apache License, Version 2.0 (the
-- "License"); you may not use this file except in compliance
-- with the License. You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing,
-- software distributed under the License is distributed on an
-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-- KIND, either express or implied. See the License for the
-- specific language governing permissions and limitations
-- under the License.
--
-- @@@ END COPYRIGHT @@@
obey regr.init;
-- modified Q7
select
supp_nation, cust_nation, yr -- , sum(volume) as revenue
from
(select
n1.n_name as supp_nation,
n2.n_name as cust_nation,
extract (year from l_shipdate) as yr,
l_extendedprice*(1-l_discount) as volume
from supplier,lineitem,orders,customer, nation n1, nation n2
where
(s_suppkey = (l_suppkey * l_suppkey) + o_orderkey - c_custkey )
and o_orderkey = l_orderkey
and c_custkey = o_custkey
and s_nationkey = n1.n_nationkey
and c_nationkey = n2.n_nationkey
and
(n1.n_name = 'FRANCE' and
n2.n_name = 'GERMANY')
-- or
-- (n1.n_name = 'GERMANY' and
-- n2.n_name = 'FRANCE'))
and l_shipdate between
date '1995-01-01' and date '1996-12-31'
) as shipping
group by supp_nation, cust_nation, yr;