should be it
This commit is contained in:
31
external/duckdb/benchmark/tpch_plan_cost/queries/q22.sql
vendored
Normal file
31
external/duckdb/benchmark/tpch_plan_cost/queries/q22.sql
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
SELECT
|
||||
cntrycode,
|
||||
count(*) AS numcust,
|
||||
sum(c_acctbal) AS totacctbal
|
||||
FROM (
|
||||
SELECT
|
||||
substring(c_phone FROM 1 FOR 2) AS cntrycode,
|
||||
c_acctbal
|
||||
FROM
|
||||
customer
|
||||
WHERE
|
||||
substring(c_phone FROM 1 FOR 2) IN ('13', '31', '23', '29', '30', '18', '17')
|
||||
AND c_acctbal > (
|
||||
SELECT
|
||||
avg(c_acctbal)
|
||||
FROM
|
||||
customer
|
||||
WHERE
|
||||
c_acctbal > 0.00
|
||||
AND substring(c_phone FROM 1 FOR 2) IN ('13', '31', '23', '29', '30', '18', '17'))
|
||||
AND NOT EXISTS (
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
orders
|
||||
WHERE
|
||||
o_custkey = c_custkey)) AS custsale
|
||||
GROUP BY
|
||||
cntrycode
|
||||
ORDER BY
|
||||
cntrycode;
|
||||
Reference in New Issue
Block a user