All Downloads are FREE. Search and download functionalities are using the official Maven repository.

sql.trino.tpch.q03.sql Maven / Gradle / Ivy

There is a newer version: 465
Show newest version
SELECT
  l.orderkey,
  sum(l.extendedprice * (1 - l.discount)) AS revenue,
  o.orderdate,
  o.shippriority
FROM
  "${database}"."${schema}"."${prefix}customer" AS c,
  "${database}"."${schema}"."${prefix}orders" AS o,
  "${database}"."${schema}"."${prefix}lineitem" AS l
WHERE
  c.mktsegment = 'BUILDING'
  AND c.custkey = o.custkey
  AND l.orderkey = o.orderkey
  AND o.orderdate < DATE '1995-03-15'
  AND l.shipdate > DATE '1995-03-15'
GROUP BY
  l.orderkey,
  o.orderdate,
  o.shippriority
ORDER BY
  revenue DESC,
  o.orderdate
LIMIT 10
;




© 2015 - 2024 Weber Informatics LLC | Privacy Policy