mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-10 06:52:55 +00:00
35 lines
612 B
SQL
35 lines
612 B
SQL
-- $ID$
|
|
-- TPC-H/TPC-R Important Stock Identification Query (Q11)
|
|
-- Functional Query Definition
|
|
-- Approved February 1998
|
|
|
|
|
|
select
|
|
ps_partkey,
|
|
sum(ps_supplycost * ps_availqty) as value
|
|
from
|
|
partsupp,
|
|
supplier,
|
|
nation
|
|
where
|
|
ps_suppkey = s_suppkey
|
|
and s_nationkey = n_nationkey
|
|
and n_name = 'INDONESIA'
|
|
group by
|
|
ps_partkey having
|
|
sum(ps_supplycost * ps_availqty) > (
|
|
select
|
|
sum(ps_supplycost * ps_availqty) * 0.0001000000
|
|
from
|
|
partsupp,
|
|
supplier,
|
|
nation
|
|
where
|
|
ps_suppkey = s_suppkey
|
|
and s_nationkey = n_nationkey
|
|
and n_name = 'INDONESIA'
|
|
)
|
|
order by
|
|
value desc
|
|
;
|