mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-05-11 13:21:30 +03:00
49 lines
1.2 KiB
SQL
49 lines
1.2 KiB
SQL
-- $Id: tpch19.sql 2657 2007-06-12 16:08:15Z rdempsey $
|
|
-- TPC-H/TPC-R Discounted Revenue Query (Q19)
|
|
-- Functional Query Definition
|
|
-- Approved February 1998
|
|
|
|
define 1 = Brand#12
|
|
define 2 = Brand#23
|
|
define 3 = Brand#34
|
|
define 4 = 1
|
|
define 5 = 10
|
|
define 6 = 20
|
|
|
|
select
|
|
sum(l_extendedprice* (1 - l_discount)) as revenue
|
|
from
|
|
lineitem,
|
|
part
|
|
where
|
|
(
|
|
p_partkey = l_partkey
|
|
and p_brand = '&1'
|
|
and p_container in ('SM CASE', 'SM BOX', 'SM PACK', 'SM PKG')
|
|
and l_quantity >= &4 and l_quantity <= &4 + 10
|
|
and p_size between 1 and 5
|
|
and l_shipmode in ('AIR', 'AIR REG')
|
|
and l_shipinstruct = 'DELIVER IN PERSON'
|
|
)
|
|
or
|
|
(
|
|
p_partkey = l_partkey
|
|
and p_brand = '&2'
|
|
and p_container in ('MED BAG', 'MED BOX', 'MED PKG', 'MED PACK')
|
|
and l_quantity >= &5 and l_quantity <= &5 + 10
|
|
and p_size between 1 and 10
|
|
and l_shipmode in ('AIR', 'AIR REG')
|
|
and l_shipinstruct = 'DELIVER IN PERSON'
|
|
)
|
|
or
|
|
(
|
|
p_partkey = l_partkey
|
|
and p_brand = '&3'
|
|
and p_container in ('LG CASE', 'LG BOX', 'LG PACK', 'LG PKG')
|
|
and l_quantity >= &6 and l_quantity <= &6 + 10
|
|
and p_size between 1 and 15
|
|
and l_shipmode in ('AIR', 'AIR REG')
|
|
and l_shipinstruct = 'DELIVER IN PERSON'
|
|
);
|
|
|