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

redshiftTableauQueries.2.sql Maven / Gradle / Ivy

There is a newer version: 0.5.8
Show newest version
SELECT "nation"."n_name" AS "n_name",
  "part"."p_mfgr" AS "p_mfgr",
  "partsupp"."ps_partkey" AS "ps_partkey",
  "partsupp"."ps_suppkey" AS "ps_suppkey",
  "supplier"."s_address" AS "s_address",
  "supplier"."s_comment" AS "s_comment",
  "supplier"."s_name" AS "s_name",
  "supplier"."s_phone" AS "s_phone",
  "supplier"."s_acctbal" AS "sum_s_acctbal_ok"
FROM "tpch10g"."partsupp" "partsupp"
  INNER JOIN "tpch10g"."part" "part" ON ("partsupp"."ps_partkey" = "part"."p_partkey")
  INNER JOIN "tpch10g"."supplier" "supplier" ON ("partsupp"."ps_suppkey" = "supplier"."s_suppkey")
  INNER JOIN "tpch10g"."nation" "nation" ON ("supplier"."s_nationkey" = "nation"."n_nationkey")
  INNER JOIN "tpch10g"."region" "region" ON ("nation"."n_regionkey" = "region"."r_regionkey")
  INNER JOIN (
  SELECT "partsupp"."ps_partkey" AS "p_partkey",
    MIN("partsupp"."ps_supplycost") AS "__measure__0"
  FROM "tpch10g"."partsupp" "partsupp"
    INNER JOIN "tpch10g"."supplier" "supplier" ON ("partsupp"."ps_suppkey" = "supplier"."s_suppkey")
    INNER JOIN "tpch10g"."nation" "nation" ON ("supplier"."s_nationkey" = "nation"."n_nationkey")
    INNER JOIN "tpch10g"."region" "region" ON ("nation"."n_regionkey" = "region"."r_regionkey")
  WHERE ((NOT ("partsupp"."ps_partkey" IS NULL)) AND ("region"."r_name" = 'EUROPE'))
  GROUP BY 1
) "t0" ON (("part"."p_partkey" = "t0"."p_partkey") OR (("part"."p_partkey" IS NULL) AND ("t0"."p_partkey" IS NULL)))
WHERE (("region"."r_name" = 'EUROPE') AND (("partsupp"."ps_supplycost" = "t0"."__measure__0") AND ("part"."p_size" = 15) AND (SUBSTRING(RTRIM("part"."p_type", ' '), (CASE WHEN (LENGTH(RTRIM("part"."p_type", ' ')) - LENGTH('BRASS')) < 0 THEN 1 ELSE LENGTH(RTRIM("part"."p_type", ' ')) - LENGTH('BRASS') + 1 END), LENGTH('BRASS')) = 'BRASS')))




© 2015 - 2025 Weber Informatics LLC | Privacy Policy