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

sql-tests.testcases.hive_tpch.q11.sql Maven / Gradle / Ivy

There is a newer version: 464
Show newest version
-- database: presto; groups: tpch; tables: partsupp,supplier,nation
SELECT
  ps_partkey,
  sum(ps_supplycost * ps_availqty) AS value
FROM
  partsupp,
  supplier,
  nation
WHERE
  ps_suppkey = s_suppkey
  AND s_nationkey = n_nationkey
  AND n_name = 'GERMANY'
GROUP BY
  ps_partkey
HAVING
  sum(ps_supplycost * ps_availqty) > (
    SELECT sum(ps_supplycost * ps_availqty) * 0.0001
    FROM
      partsupp,
      supplier,
      nation
    WHERE
      ps_suppkey = s_suppkey
      AND s_nationkey = n_nationkey
      AND n_name = 'GERMANY'
  )
ORDER BY
  value DESC




© 2015 - 2024 Weber Informatics LLC | Privacy Policy