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.

35 lines
638 B

--begin q11
-- $ID$
-- TPC-H/TPC-R Important Stock Identification Query (Q11)
-- Functional Query Definition
-- Approved February 1998
:x
:o
select
ps_partkey,
sum(ps_supplycost * ps_availqty) as val
from
tpch.partsupp,
tpch.supplier,
tpch.nation
where
ps_suppkey = s_suppkey
and s_nationkey = n_nationkey
and n_name = ':1'
group by
ps_partkey having
sum(ps_supplycost * ps_availqty) > (
select
sum(ps_supplycost * ps_availqty) * :2
from
tpch.partsupp,
tpch.supplier,
tpch.nation
where
ps_suppkey = s_suppkey
and s_nationkey = n_nationkey
and n_name = ':1'
)
order by
val desc;
--end q11