aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/sql/suites/pg-tpch/q17.sql
blob: e893138f09e24aa83c2694f5491e53bf63eda157 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
--!syntax_pg
--ignore runonopt plan diff
--TPC-H Q17


select
sum(l_extendedprice) / 7.0::numeric as avg_yearly
from 
plato."lineitem", 
plato."part"
where 
p_partkey = l_partkey
and p_brand = 'Brand#23'
and p_container = 'MED BOX'
and l_quantity < (
select
0.2::numeric * avg(l_quantity)
from 
plato."lineitem"
where 
l_partkey = p_partkey
);