You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
613 B
32 lines
613 B
3 years ago
|
--begin q05
|
||
|
-- $ID$
|
||
|
-- TPC-H/TPC-R Local Supplier Volume Query (Q5)
|
||
|
-- Functional Query Definition
|
||
|
-- Approved February 1998
|
||
|
:x
|
||
|
:o
|
||
|
select
|
||
|
n_name,
|
||
|
sum(l_extendedprice * (1 - l_discount)) as revenue
|
||
|
from
|
||
|
tpch.customer,
|
||
|
tpch.orders,
|
||
|
tpch.lineitem,
|
||
|
tpch.supplier,
|
||
|
tpch.nation,
|
||
|
tpch.region
|
||
|
where
|
||
|
c_custkey = o_custkey
|
||
|
and l_orderkey = o_orderkey
|
||
|
and l_suppkey = s_suppkey
|
||
|
and c_nationkey = s_nationkey
|
||
|
and s_nationkey = n_nationkey
|
||
|
and n_regionkey = r_regionkey
|
||
|
and r_name = ':1'
|
||
|
and o_orderdate >= date ':2'
|
||
|
and o_orderdate < ADD_YEARS(date ':2', 1)
|
||
|
group by
|
||
|
n_name
|
||
|
order by
|
||
|
revenue desc;
|
||
|
--end q05
|