aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/sql/suites/pg-tpch/q14.sql
blob: e515a5d480505a91bb37ae12dc9c92dc0ff36cca (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
--!syntax_pg
--TPC-H Q14


select
100.00::numeric * sum(case 
when p_type like 'PROMO%'
then l_extendedprice*(1::numeric-l_discount)
else 0::numeric
end) / (sum(l_extendedprice * (1::numeric - l_discount)) + 1e-12::numeric) as promo_revenue
from 
plato."lineitem", 
plato."part"
where
l_partkey = p_partkey
and l_shipdate >= date '1995-09-01'
and l_shipdate < date '1995-09-01' + interval '1' month;