mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-04-18 21:44:02 +03:00
34 lines
651 B
SQL
34 lines
651 B
SQL
-- $Id: tpch05.sql 2657 2007-06-12 16:08:15Z rdempsey $
|
|
-- TPC-H/TPC-R Local Supplier Volume Query (Q5)
|
|
-- Functional Query Definition
|
|
-- Approved February 1998
|
|
|
|
define 1 = ASIA
|
|
define 2 = 1994-01-01
|
|
|
|
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 = '&1'
|
|
and o_orderdate >= date '&2'
|
|
and o_orderdate < date '&2' + interval '1' year
|
|
group by
|
|
n_name
|
|
order by
|
|
revenue desc;
|
|
|