Skip to content

Commit

Permalink
[sql 207/208] chore(snowflake): regen tpch sql
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud authored and kszucs committed Dec 21, 2023
1 parent 589d7fb commit cabd7e8
Show file tree
Hide file tree
Showing 20 changed files with 1,604 additions and 1,570 deletions.
Original file line number Diff line number Diff line change
@@ -1,59 +1,62 @@
SELECT
*
"t2"."l_returnflag" AS "l_returnflag",
"t2"."l_linestatus" AS "l_linestatus",
"t2"."sum_qty" AS "sum_qty",
"t2"."sum_base_price" AS "sum_base_price",
"t2"."sum_disc_price" AS "sum_disc_price",
"t2"."sum_charge" AS "sum_charge",
"t2"."avg_qty" AS "avg_qty",
"t2"."avg_price" AS "avg_price",
"t2"."avg_disc" AS "avg_disc",
"t2"."count_order" AS "count_order"
FROM (
SELECT
"t2"."l_returnflag" AS "l_returnflag",
"t2"."l_linestatus" AS "l_linestatus",
SUM("t2"."l_quantity") AS "sum_qty",
SUM("t2"."l_extendedprice") AS "sum_base_price",
SUM("t2"."l_extendedprice" * (
1 - "t2"."l_discount"
"t1"."l_returnflag" AS "l_returnflag",
"t1"."l_linestatus" AS "l_linestatus",
SUM("t1"."l_quantity") AS "sum_qty",
SUM("t1"."l_extendedprice") AS "sum_base_price",
SUM("t1"."l_extendedprice" * (
1 - "t1"."l_discount"
)) AS "sum_disc_price",
SUM(
(
"t2"."l_extendedprice" * (
1 - "t2"."l_discount"
"t1"."l_extendedprice" * (
1 - "t1"."l_discount"
)
) * (
"t2"."l_tax" + 1
"t1"."l_tax" + 1
)
) AS "sum_charge",
AVG("t2"."l_quantity") AS "avg_qty",
AVG("t2"."l_extendedprice") AS "avg_price",
AVG("t2"."l_discount") AS "avg_disc",
AVG("t1"."l_quantity") AS "avg_qty",
AVG("t1"."l_extendedprice") AS "avg_price",
AVG("t1"."l_discount") AS "avg_disc",
COUNT(*) AS "count_order"
FROM (
SELECT
*
FROM (
SELECT
"t0"."L_ORDERKEY" AS "l_orderkey",
"t0"."L_PARTKEY" AS "l_partkey",
"t0"."L_SUPPKEY" AS "l_suppkey",
"t0"."L_LINENUMBER" AS "l_linenumber",
"t0"."L_QUANTITY" AS "l_quantity",
"t0"."L_EXTENDEDPRICE" AS "l_extendedprice",
"t0"."L_DISCOUNT" AS "l_discount",
"t0"."L_TAX" AS "l_tax",
"t0"."L_RETURNFLAG" AS "l_returnflag",
"t0"."L_LINESTATUS" AS "l_linestatus",
"t0"."L_SHIPDATE" AS "l_shipdate",
"t0"."L_COMMITDATE" AS "l_commitdate",
"t0"."L_RECEIPTDATE" AS "l_receiptdate",
"t0"."L_SHIPINSTRUCT" AS "l_shipinstruct",
"t0"."L_SHIPMODE" AS "l_shipmode",
"t0"."L_COMMENT" AS "l_comment"
FROM "LINEITEM" AS "t0"
) AS "t1"
"t0"."L_ORDERKEY" AS "l_orderkey",
"t0"."L_PARTKEY" AS "l_partkey",
"t0"."L_SUPPKEY" AS "l_suppkey",
"t0"."L_LINENUMBER" AS "l_linenumber",
"t0"."L_QUANTITY" AS "l_quantity",
"t0"."L_EXTENDEDPRICE" AS "l_extendedprice",
"t0"."L_DISCOUNT" AS "l_discount",
"t0"."L_TAX" AS "l_tax",
"t0"."L_RETURNFLAG" AS "l_returnflag",
"t0"."L_LINESTATUS" AS "l_linestatus",
"t0"."L_SHIPDATE" AS "l_shipdate",
"t0"."L_COMMITDATE" AS "l_commitdate",
"t0"."L_RECEIPTDATE" AS "l_receiptdate",
"t0"."L_SHIPINSTRUCT" AS "l_shipinstruct",
"t0"."L_SHIPMODE" AS "l_shipmode",
"t0"."L_COMMENT" AS "l_comment"
FROM "LINEITEM" AS "t0"
WHERE
(
"t1"."l_shipdate" <= DATEFROMPARTS(1998, 9, 2)
)
) AS "t2"
"t0"."L_SHIPDATE" <= DATEFROMPARTS(1998, 9, 2)
) AS "t1"
GROUP BY
1,
2
) AS "t3"
) AS "t2"
ORDER BY
"t3"."l_returnflag" ASC,
"t3"."l_linestatus" ASC
"t2"."l_returnflag" ASC,
"t2"."l_linestatus" ASC
Loading

0 comments on commit cabd7e8

Please sign in to comment.