mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-09 22:42:57 +00:00
32 lines
583 B
SQL
32 lines
583 B
SQL
-- $ID$
|
|
-- TPC-H/TPC-R Local Supplier Volume Query (Q5)
|
|
-- Functional Query Definition
|
|
-- Approved February 1998
|
|
|
|
|
|
select
|
|
n_name,
|
|
sum(l_extendedprice * (1 - l_discount)) as revenue
|
|
from
|
|
customer,
|
|
orders,
|
|
lineitem,
|
|
supplier,
|
|
nation,
|
|
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 = 'ASIA'
|
|
and o_orderdate >= date '1996-01-01'
|
|
and o_orderdate < date '1996-01-01' + interval '1' year
|
|
group by
|
|
n_name
|
|
order by
|
|
revenue desc
|
|
;
|