q14.sql 400 B

1234567891011121314151617
  1. --!syntax_pg
  2. --TPC-H Q14
  3. select
  4. 100.00::numeric * sum(case
  5. when p_type like 'PROMO%'
  6. then l_extendedprice*(1::numeric-l_discount)
  7. else 0::numeric
  8. end) / (sum(l_extendedprice * (1::numeric - l_discount)) + 1e-12::numeric) as promo_revenue
  9. from
  10. plato."lineitem",
  11. plato."part"
  12. where
  13. l_partkey = p_partkey
  14. and l_shipdate >= date '1995-09-01'
  15. and l_shipdate < date '1995-09-01' + interval '1' month;