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
527 B
32 lines
527 B
3 years ago
|
--begin q03
|
||
|
-- $ID$
|
||
|
-- TPC-H/TPC-R Shipping Priority Query (Q3)
|
||
|
-- Functional Query Definition
|
||
|
-- Approved February 1998
|
||
|
:x
|
||
|
:o
|
||
|
select
|
||
|
l_orderkey,
|
||
|
sum(l_extendedprice * (1 - l_discount)) as revenue,
|
||
|
o_orderdate,
|
||
|
o_shippriority
|
||
|
from
|
||
|
tpch.customer,
|
||
|
tpch.orders,
|
||
|
tpch.lineitem
|
||
|
where
|
||
|
c_mktsegment = ':1'
|
||
|
and c_custkey = o_custkey
|
||
|
and l_orderkey = o_orderkey
|
||
|
and o_orderdate < date ':2'
|
||
|
and l_shipdate > date ':2'
|
||
|
group by
|
||
|
l_orderkey,
|
||
|
o_orderdate,
|
||
|
o_shippriority
|
||
|
order by
|
||
|
revenue desc,
|
||
|
o_orderdate;
|
||
|
:n 10;
|
||
|
--end q03
|