Created
February 25, 2023 05:28
-
-
Save BohuTANG/2076c88aa6f1138ad646a86eec0f321b to your computer and use it in GitHub Desktop.
r2-tpch-q18
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- TPCH Q18 | |
SELECT c_name, | |
c_custkey, | |
o_orderkey, | |
o_orderdate, | |
o_totalprice, | |
Sum(l_quantity) | |
FROM 'https://pub-0873f8bfe2ba4caa8c1b40c21b39bc10.r2.dev/customer/part-0.parquet' (file_format => 'parquet') AS customer, | |
'https://pub-0873f8bfe2ba4caa8c1b40c21b39bc10.r2.dev/orders/part-0.parquet' (file_format => 'parquet') AS orders, | |
'https://pub-0873f8bfe2ba4caa8c1b40c21b39bc10.r2.dev/lineitem/part-0.parquet' (file_format => 'parquet') AS lineitem | |
WHERE o_orderkey IN | |
( | |
SELECT l_orderkey | |
FROM 'https://pub-0873f8bfe2ba4caa8c1b40c21b39bc10.r2.dev/lineitem/part-0.parquet' AS lineitem | |
GROUP BY l_orderkey | |
HAVING sum(l_quantity) > 300) | |
AND c_custkey = o_custkey | |
AND o_orderkey = l_orderkey | |
GROUP BY c_name, | |
c_custkey, | |
o_orderkey, | |
o_orderdate, | |
o_totalprice | |
ORDER BY o_totalprice DESC, | |
o_orderdate; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment