aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/sql/suites/tpch/q6.sql
blob: c96b8ac098fda0813c183bc8f45c7e3711f58e7a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
-- TPC-H/TPC-R Forecasting Revenue Change Query (Q6)
-- TPC TPC-H Parameter Substitution (Version 2.17.2 build 0)
-- using 1680793381 as a seed to the RNG

$border = Date("1995-01-01");

select
    sum(l_extendedprice * l_discount) as revenue
from
    plato.lineitem
where
    CAST(l_shipdate AS Timestamp) >= $border 
    and cast(l_shipdate as Timestamp) < ($border + Interval("P365D"))
    and l_discount between 0.07 - 0.01 and 0.07 + 0.01
    and l_quantity < 25;