q17.sql 344 B

12345678910111213141516171819202122
  1. --!syntax_pg
  2. --ignore runonopt plan diff
  3. --TPC-H Q17
  4. select
  5. sum(l_extendedprice) / 7.0::numeric as avg_yearly
  6. from
  7. plato."lineitem",
  8. plato."part"
  9. where
  10. p_partkey = l_partkey
  11. and p_brand = 'Brand#23'
  12. and p_container = 'MED BOX'
  13. and l_quantity < (
  14. select
  15. 0.2::numeric * avg(l_quantity)
  16. from
  17. plato."lineitem"
  18. where
  19. l_partkey = p_partkey
  20. );