text
stringlengths
84
1.49k
benchmark
stringclasses
4 values
SELECT SUM(l_extendedprice * (1 - l_discount)) AS revenue, n_name, c_custkey, c_comment, c_name, c_phone, c_acctbal, c_address FROM customer, orders, lineitem, nation WHERE c_custkey = o_custkey AND l_orderkey = o_orderkey AND o_orderdate >= DATE 1 AND o_orderdate < DATE 1 + INTERVAL '3' MONTH AND l_returnflag = 'R' AN...
tpch
SELECT i_item_id, AVG(cs_sales_price) AS agg4, AVG(cs_list_price) AS agg2, AVG(cs_coupon_amt) AS agg3, AVG(cs_quantity) AS agg1 FROM catalog_sales INNER JOIN customer_demographics ON cs_bill_cdemo_sk = cd_demo_sk INNER JOIN date_dim ON cs_sold_date_sk = d_date_sk INNER JOIN item ON cs_item_sk = i_item_sk INNER JOIN pro...
tpcds
SELECT COUNT(*) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v, badges AS b, users AS u WHERE p.Id = c.PostId AND p.Id = v.PostId AND pl.LinkTypeId = 1 AND p.Score <= 40 AND b.UserId = u.Id AND p.Id = ph.PostId AND c.UserId = u.Id AND p.Id = pl.RelatedPostId
stats
SELECT c_phone, c_acctbal, SUM(l_extendedprice * (1 - l_discount)) AS revenue, n_name, c_custkey, c_comment, c_address, c_name FROM customer, orders, lineitem, nation WHERE c_custkey = o_custkey AND l_orderkey = o_orderkey AND o_orderdate >= DATE 1 AND o_orderdate < DATE 1 + INTERVAL '3' MONTH AND l_returnflag = 'R' AN...
tpch
SELECT l_shipmode, SUM( CASE WHEN o_orderpriority = '1-URGENT' OR o_orderpriority = '2-HIGH' THEN 1 ELSE 0 END ) AS high_line_count, SUM( CASE WHEN o_orderpriority != '1-URGENT' AND o_orderpriority != '2-HIGH' THEN 1 ELSE 0 END ) AS low_line_count FROM orders, lineitem WHERE l_commitdate < l_receiptdate AND l_shipmode ...
tpch
SELECT item.i_brand AS brand, SUM(ss_ext_sales_price) AS ext_price, dt.d_year, item.i_brand_id AS brand_id FROM date_dim AS dt INNER JOIN store_sales ON dt.d_date_sk = store_sales.ss_sold_date_sk INNER JOIN item ON store_sales.ss_item_sk = item.i_item_sk WHERE item.i_manager_id = 57 AND dt.d_moy = 12 AND dt.d_year = 20...
tpcds
SELECT MIN(mi.info) AS release_date, MIN(miidx.info) AS rating, MIN(t.title) AS german_movie FROM company_name AS cn, company_type AS ct, info_type AS it, info_type AS it2, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS miidx, title AS t WHERE mi.movie_id = t.id AND mc.movie_id = t.id AND i...
job
select min(t.title) as movie_title from company_name as cn, keyword as k, movie_companies as mc, movie_keyword as mk, title as t where k.keyword ='character-name-in-title' AND mk.keyword_id = k.id AND cn.id = mc.company_id AND t.id = mk.movie_id AND cn.country_code ='[de]' AND mc.movie_id = t.id AND mc.movie_id = mk.mo...
job
SELECT MIN(cn.name) AS movie_company, MIN(mi_idx.info) AS rating, MIN(t.title) AS western_violent_movie FROM company_name AS cn, company_type AS ct, info_type AS it1, info_type AS it2, keyword AS k, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS mi_idx, movie_keyword AS mk, title AS t WHERE...
job
Select COUNT(1) From postHistory As ph, posts As p, users As u, badges As b Where u.Id = b.UserId And p.OwnerUserId = u.Id And ph.UserId = u.Id And ph.PostHistoryTypeId = 3 And p.Score >= -7 And u.Reputation >= 1 LIMIT 10;
stats
SELECT n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, supplier, nation, region WHERE n_regionkey = r_regionkey AND r_name = 1 AND c_custkey = o_custkey AND o_orderdate < DATE 1 + INTERVAL '1' YEAR AND l_suppkey = s_suppkey AND c_nationkey = s_nationkey AND o_orderdate >= DAT...
tpch
SELECT c_custkey, c_name, o_totalprice, o_orderkey, o_orderdate, SUM(l_quantity) FROM customer, orders, lineitem WHERE o_orderkey IN ( SELECT l_orderkey FROM lineitem GROUP BY l_orderkey HAVING SUM(l_quantity) > 1 ) AND c_custkey = o_custkey AND o_orderkey = l_orderkey GROUP BY c_name, c_custkey, o_orderkey, o_orderdat...
tpch
SELECT MIN(t.title) AS american_movie FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info AS mi, title AS t WHERE (mc.note LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%') AND it.id = mi.info_type_id AND ct.id = mc.company_type_id AND ct.kind = 'production companies' AND t.id = mi.movie_...
job
SELECT promotions, total, CAST(promotions AS DECIMAL(15, 4)) / CAST(total AS DECIMAL(15, 4)) * 100 FROM ( SELECT SUM(ss_ext_sales_price) AS promotions FROM store_sales JOIN store ON ss_store_sk = s_store_sk JOIN promotion ON ss_promo_sk = p_promo_sk JOIN date_dim ON ss_sold_date_sk = d_date_sk JOIN customer ON ss_custo...
tpcds
select min(k.keyword) as movie_keyword, min(n.name) as actor_name, min(t.title) as marvel_movie from cast_info as ci, keyword as k, movie_keyword as mk, name as n, title as t where t.id = mk.movie_id and t.id = ci.movie_id and n.name like '%Downey%Robert%' and k.keyword = 'marvel-cinematic-universe' and k.id = mk.keywo...
job
Select Count(*) From comments As c, posts As p, postLinks As pl, postHistory As ph, votes As v, badges As b Where c.Score = 0 AND p.Id = c.PostId AND b.UserId = c.UserId AND p.Id = ph.PostId AND pl.LinkTypeId = 1 AND p.Id = pl.RelatedPostId AND p.Id = v.PostId
stats
SELECT supp_nation, cust_nation, l_year, SUM(volume) AS revenue FROM ( SELECT n1.n_name AS supp_nation, n2.n_name AS cust_nation, EXTRACT(YEAR FROM l_shipdate) AS l_year, l_extendedprice * (1 - l_discount) AS volume FROM supplier, lineitem, orders, customer, nation n1, nation n2 WHERE l_shipdate BETWEEN DATE '1995-01-0...
tpch
SELECT AVG(l_extendedprice) AS avg_price, l_returnflag, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, l_linestatus, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, SUM(l_quantity) AS sum_qty, SUM(l_extendedprice) AS sum_base_price, AVG(l_quantity) AS avg_qty, AVG(l_discount) AS avg_dis...
tpch
SELECT p_type, p_brand, p_size, COUNT(DISTINCT ps_suppkey) AS supplier_cnt FROM partsupp, part WHERE p_type NOT LIKE 1 AND p_brand != 1 AND p_size IN (1, 1, 1, 1, 1, 1, 1, 1) AND ps_suppkey NOT IN ( SELECT s_suppkey FROM supplier WHERE s_comment LIKE '%Customer%Complaints%' ) AND p_partkey = ps_partkey GROUP BY p_brand...
tpch
SELECT n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue, c_phone, c_name, c_comment, c_acctbal, c_address, c_custkey FROM customer, orders, lineitem, nation WHERE c_custkey = o_custkey AND l_orderkey = o_orderkey AND o_orderdate >= DATE 1 AND o_orderdate < DATE 1 + INTERVAL '3' MONTH AND l_returnflag = 'R' AN...
tpch
SELECT MIN(t.title) AS movie_title FROM company_name AS cn, keyword AS k, movie_companies AS mc, movie_keyword AS mk, title AS t WHERE mc.movie_id = mk.movie_id AND t.id = mk.movie_id AND mk.keyword_id = k.id AND mc.movie_id = t.id AND k.keyword ='character-name-IN-title' AND cn.country_code ='[sm]' AND cn.id = mc.comp...
job
SELECT COUNT(*) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v, badges AS b WHERE p.Id = pl.RelatedPostId AND p.Id = c.PostId AND pl.LinkTypeId = 1 AND p.Id = ph.PostId AND b.UserId = c.UserId AND p.Id = v.PostId AND c.Score = 0
stats
SELECT n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, supplier, nation, region WHERE o_orderdate < DATE 1 + INTERVAL '1' YEAR AND l_orderkey = o_orderkey AND c_custkey = o_custkey AND c_nationkey = s_nationkey AND l_suppkey = s_suppkey AND s_nationkey = n_nationkey AND n_reg...
tpch
SELECT MIN(miidx.info) AS rating, MIN(t.title) AS german_movie, MIN(mi.info) AS release_date FROM company_name AS cn, company_type AS ct, info_type AS it, info_type AS it2, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS miidx, title AS t WHERE it2.id = mi.info_type_id AND it.info = 'rating'...
job
SELECT MIN(n.name) AS of_person, MIN(t.title) AS biography_movie FROM aka_name AS an, cast_info AS ci, info_type AS it, link_type AS lt, movie_link AS ml, name AS n, person_info AS pi, title AS t WHERE (n.gender = 'm' OR (n.gender = 'f' AND n.name LIKE 'B%')) AND pi.person_id = an.person_id AND pi.note = 'Volker Boehm'...
job
SELECT nation, o_year, SUM(amount) AS sum_profit FROM ( SELECT n_name AS nation, EXTRACT(YEAR FROM o_orderdate) AS o_year, l_extendedprice * (1 - l_discount) - ps_supplycost * l_quantity AS amount FROM part, supplier, lineitem, partsupp, orders, nation WHERE ps_suppkey = l_suppkey AND p_name LIKE 1 ) AS profit AND p_pa...
tpch
select min(chn.name) as uncredited_voiced_character, min(t.title) as russian_movie from char_name as chn, cast_info as ci, company_name as cn, company_type as ct, movie_companies as mc, role_type as rt, title as t where cn.id = mc.company_id AND t.id = mc.movie_id AND chn.id = ci.person_role_id AND cn.country_code = '[...
job
SELECT COUNT(*) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v WHERE pl.LinkTypeId = 1 AND p.Id = v.PostId AND p.FavoriteCount >= 0 AND c.Score = 0 AND p.Id = c.PostId AND p.Id = pl.PostId AND p.Id = ph.PostId LIMIT 20;
stats
SELECT MIN(t.title) AS marvel_movie, MIN(n.name) AS actor_name, MIN(k.keyword) AS movie_keyword FROM cast_info AS ci, keyword AS k, movie_keyword AS mk, name AS n, title AS t WHERE n.name LIKE '%Downey%Robert%' AND t.id = ci.movie_id AND ci.movie_id = mk.movie_id AND k.keyword = 'marvel-cinematic-universe' AND t.produc...
job
SELECT MIN(chn.name) AS uncredited_voiced_character, MIN(t.title) AS russian_movie FROM char_name AS chn, cast_info AS ci, company_name AS cn, company_type AS ct, movie_companies AS mc, role_type AS rt, title AS t WHERE ct.id = mc.company_type_id AND ci.movie_id = mc.movie_id AND ci.note LIKE '%(voice)%' AND rt.id = ci...
job
Select * From ( Select Avg(ss_list_price) As b1_lp, Count(ss_list_price) As b1_cnt, Count(Distinct ss_list_price) As b1_cntd From store_sales Where (ss_list_price Between 16 And 16 + 10 Or ss_coupon_amt Between 665 And 665 + 1000 Or ss_wholesale_cost Between 67 And 67 + 20) ) As b1, ( Select Avg(ss_list_price) As b2_lp...
tpcds
Select Count(*) From postHistory As ph, posts As p, votes As v, badges As b, users As u, comments As c Where p.Id = ph.PostId And p.Score <= 192 And p.Id = v.PostId And p.ViewCount >= 0 And u.Id = p.OwnerUserId And u.Id = b.UserId And p.Id = c.PostId
stats
SELECT MIN(mc.note) AS production_note, MIN(t.title) AS movie_title, MIN(t.production_year) AS movie_year FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info_idx AS mi_idx, title AS t WHERE it.id = mi_idx.info_type_id AND mc.movie_id = mi_idx.movie_id AND ct.kind = 'production companies' AND ct....
job
SELECT c_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue, c_custkey, c_acctbal, c_comment, n_name, c_address, c_phone FROM customer, orders, lineitem, nation WHERE c_custkey = o_custkey AND l_orderkey = o_orderkey AND o_orderdate >= DATE 1 AND o_orderdate < DATE 1 + INTERVAL '3' MONTH AND l_returnflag = 'R' AN...
tpch
SELECT o_orderdate, SUM(l_extendedprice * (1 - l_discount)) AS revenue, l_orderkey, o_shippriority FROM customer, orders, lineitem WHERE l_shipdate > DATE 1 AND l_orderkey = o_orderkey AND c_custkey = o_custkey AND c_mktsegment = 1 AND o_orderdate < DATE 1 GROUP BY l_orderkey, o_orderdate, o_shippriority ORDER BY reven...
tpch
SELECT s_acctbal, s_name, n_name, p_partkey, p_mfgr, s_address, s_phone, s_comment FROM part, supplier, partsupp, nation, region WHERE ps_supplycost = ( SELECT MIN(ps_supplycost) FROM partsupp, supplier, nation, region WHERE p_partkey = ps_partkey AND s_suppkey = ps_suppkey AND s_nationkey = n_nationkey AND n_regionkey...
tpch
SELECT MIN(chn.name) AS uncredited_voiced_character, MIN(t.title) AS russian_movie FROM char_name AS chn, cast_info AS ci, company_name AS cn, company_type AS ct, movie_companies AS mc, role_type AS rt, title AS t WHERE ct.id = mc.company_type_id AND rt.id = ci.role_id AND t.id = mc.movie_id AND cn.id = mc.company_id A...
job
SELECT MIN(t.production_year) AS movie_year, MIN(mc.note) AS production_note, MIN(t.title) AS movie_title FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info_idx AS mi_idx, title AS t WHERE t.id = mc.movie_id AND it.info = 'top 250 rank' AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%'...
job
select sum(l_extendedprice) / 7.0 as avg_yearly from lineitem, part where p_partkey = l_partkey and p_brand = 1 and p_container = 1 and l_quantity < ( select 0.2 * avg(l_quantity) from lineitem where l_partkey = p_partkey ) LIMIT 1000;
tpch
select sum(l_extendedprice * (1 - l_discount)) as revenue, o_shippriority, o_orderdate, l_orderkey from customer, orders, lineitem where c_mktsegment = 1 and c_custkey = o_custkey and l_orderkey = o_orderkey and o_orderdate < DATE 1 and l_shipdate > DATE 1 group by l_orderkey, o_orderdate, o_shippriority order by reven...
tpch
SELECT s_acctbal, s_name, n_name, p_partkey, p_mfgr, s_address, s_phone, s_comment FROM part, supplier, partsupp, nation, region WHERE p_partkey = ps_partkey AND p_type LIKE 1 AND s_suppkey = ps_suppkey AND p_size = 1 AND n_regionkey = r_regionkey AND s_nationkey = n_nationkey AND ps_supplycost = ( SELECT MIN(ps_supply...
tpch
SELECT c_count, COUNT(DISTINCT c_count) AS custdist FROM ( SELECT c_custkey, COUNT(o_orderkey) AS c_count FROM customer LEFT JOIN orders ON c_custkey = o_custkey AND o_comment NOT LIKE 1 GROUP BY c_custkey ) AS c_orders GROUP BY c_count ORDER BY custdist ASC, c_count ASC
tpch
SELECT MIN(cn.name) AS movie_company, MIN(mi_idx.info) AS rating, MIN(t.title) AS western_violent_movie FROM company_name AS cn, company_type AS ct, info_type AS it1, info_type AS it2, keyword AS k, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS mi_idx, movie_keyword AS mk, title AS t WHERE...
job
SELECT MIN(mi.info) AS release_date, MIN(miidx.info) AS rating, MIN(t.title) AS german_movie FROM company_name AS cn, company_type AS ct, info_type AS it, info_type AS it2, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS miidx, title AS t WHERE mi.movie_id = miidx.movie_id AND miidx.movie_id...
job
SELECT n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, supplier, nation, region WHERE s_nationkey = n_nationkey AND c_custkey = o_custkey AND o_orderdate >= DATE 1 AND r_name = 1 AND l_orderkey = o_orderkey AND n_regionkey = r_regionkey AND l_suppkey = s_suppkey AND o_orderda...
tpch
Select c_last_name, c_first_name, c_salutation, c_preferred_cust_flag, ss_ticket_number, cnt From ( Select ss_ticket_number, ss_customer_sk, Count(*) As cnt From store_sales Join date_dim On ss_sold_date_sk = d_date_sk Join store On ss_store_sk = s_store_sk Join household_demographics On ss_hdemo_sk = hd_demo_sk Where ...
tpcds
SELECT SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, SUM(l_quantity) AS sum_qty, l_linestatus, l_returnflag, COUNT(*) AS count_order, AVG(l_extendedprice) AS avg_price, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, AVG(l_quantity) AS avg_qty, SUM(l_extendedprice) AS sum_base_price, A...
tpch
SELECT l_orderkey, o_orderdate, SUM(l_extendedprice * (1 - l_discount)) AS revenue, o_shippriority FROM customer, orders, lineitem WHERE c_mktsegment = 1 AND o_orderdate < DATE 1 AND l_orderkey = o_orderkey AND l_shipdate > DATE 1 AND c_custkey = o_custkey GROUP BY l_orderkey, o_orderdate, o_shippriority ORDER BY reven...
tpch
SELECT MIN(n.name) AS of_person, MIN(t.title) AS biography_movie FROM aka_name AS an, cast_info AS ci, info_type AS it, link_type AS lt, movie_link AS ml, name AS n, person_info AS pi, title AS t WHERE it.info = 'mini biography' AND n.id = pi.person_id AND t.id = ci.movie_id AND it.id = pi.info_type_id AND ml.linked_mo...
job
SELECT MIN(n.name) AS of_person, MIN(t.title) AS biography_movie FROM aka_name AS an, cast_info AS ci, info_type AS it, link_type AS lt, movie_link AS ml, name AS n, person_info AS pi, title AS t WHERE lt.id = ml.link_type_id AND n.id = pi.person_id AND lt.link = 'features' AND ci.movie_id = ml.linked_movie_id AND an.n...
job
SELECT MIN(t.title) AS marvel_movie, MIN(k.keyword) AS movie_keyword, MIN(n.name) AS actor_name FROM cast_info AS ci, keyword AS k, movie_keyword AS mk, name AS n, title AS t WHERE k.id = mk.keyword_id AND t.id = ci.movie_id AND n.name LIKE '%Downey%Robert%' AND ci.movie_id = mk.movie_id AND t.production_year > 2010 AN...
job
WITH _q AS ( Select w_state, i_item_id, Sum(Case When (CAST(d_date As DATE) < CAST('2000-03-11' As DATE)) Then cs_sales_price - COALESCE(cr_refunded_cash, 0) Else 0 End) As sales_before, Sum(Case When (CAST(d_date As DATE) >= CAST('2000-03-11' As DATE)) Then cs_sales_price - COALESCE(cr_refunded_cash, 0) Else 0 End) As...
tpcds
SELECT MIN(t.title) AS german_movie, MIN(miidx.info) AS rating, MIN(mi.info) AS release_date FROM company_name AS cn, company_type AS ct, info_type AS it, info_type AS it2, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS miidx, title AS t WHERE it2.id = mi.info_type_id AND it2.info = 'releas...
job
SELECT i_item_id, i_item_desc, s_store_id, s_store_name, SUM(ss_quantity) AS store_sales_quantity, SUM(sr_return_quantity) AS store_returns_quantity, SUM(cs_quantity) AS catalog_sales_quantity FROM store_sales INNER JOIN store_returns ON ss_customer_sk = sr_customer_sk AND ss_item_sk = sr_item_sk AND ss_ticket_number =...
tpcds
select count(*) from postHistory as ph, posts as p, votes as v, badges as b, users as u, comments as c where p.Id = c.PostId and p.Id = ph.PostId and u.Id = p.OwnerUserId and u.Id = b.UserId and p.Score <= 192 and p.Id = v.PostId and p.ViewCount >= 0
stats
SELECT p_brand, p_size, COUNT(DISTINCT ps_suppkey) AS supplier_cnt, p_type FROM partsupp, part WHERE ps_suppkey NOT IN ( SELECT s_suppkey FROM supplier WHERE s_comment LIKE '%Customer%Complaints%' ) AND p_type NOT LIKE 1 AND p_size = ANY(ARRAY[1, 1, 1, 1, 1, 1, 1, 1]) AND p_brand <> 1 AND p_partkey = ps_partkey GROUP B...
tpch
WITH _q AS ( SELECT l_orderkey, SUM(l_extendedprice * (1 - l_discount)) AS revenue, o_orderdate, o_shippriority FROM customer, orders, lineitem WHERE l_orderkey = o_orderkey AND c_custkey = o_custkey AND l_shipdate > DATE 1 AND c_mktsegment = 1 AND o_orderdate < DATE 1 GROUP BY l_orderkey, o_orderdate, o_shippriority O...
tpch
SELECT MIN(cn.name) AS from_company, MIN(lt.link) AS link_type, MIN(t.title) AS western_sequel FROM company_name AS cn, company_type AS ct, info_type AS it, keyword AS k, link_type AS lt, movie_companies AS mc, movie_info AS mi, movie_keyword AS mk, movie_link AS ml, title AS t WHERE mc.note NOT LIKE '%(as Metro-Goldwy...
job
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 = 1 Group By ps_partkey Having Sum(ps_supplycost * ps_availqty) > ( Select Sum(ps_supplycost * ps_availqty) * 1 From partsupp, supplier, nation Where ps_supp...
tpch
SELECT extended_tax, extended_price, list_price, ca_city, ss_ticket_number, c_last_name, c_first_name, bought_city FROM ( SELECT ss_ticket_number, ss_customer_sk, ca_city AS bought_city, SUM(ss_ext_sales_price) AS extended_price, SUM(ss_ext_list_price) AS list_price, SUM(ss_ext_tax) AS extended_tax FROM store_sales JOI...
tpcds
SELECT MIN(mi.info) AS release_date, MIN(miidx.info) AS rating, MIN(t.title) AS german_movie FROM company_name AS cn, company_type AS ct, info_type AS it, info_type AS it2, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS miidx, title AS t WHERE kt.kind = 'movie' AND mi.movie_id = miidx.movie...
job
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 c_acctbal > ( select avg(c_acctbal) from customer where c_acctbal > 0.00 and SUBSTRING(c_phone from 1 FOR 2) in (1, 1, 1, 1, 1, 1, 1) ) AND not exists ( select * ...
tpch
Select Min(mc.note) As production_note, Min(t.title) As movie_title, Min(t.production_year) As movie_year From company_type As ct, info_type As it, movie_companies As mc, movie_info_idx As mi_idx, title As t Where t.id = mc.movie_id AND it.id = mi_idx.info_type_id AND ct.kind = 'production companies' AND (mc.note Like ...
job
WITH _q AS ( SELECT ss_ticket_number, c_first_name, cnt, c_salutation, c_last_name, c_preferred_cust_flag FROM ( SELECT ss_ticket_number, ss_customer_sk, COUNT(*) AS cnt FROM store_sales JOIN date_dim ON ss_sold_date_sk = d_date_sk JOIN store ON ss_store_sk = s_store_sk JOIN household_demographics ON ss_hdemo_sk = hd_d...
tpcds
select cc_manager as manager, cc_name as call_center_name, cc_call_center_id as call_center, sum(cr_net_loss) as returns_loss from call_center INNER JOIN catalog_returns on cr_call_center_sk = cc_call_center_sk INNER JOIN date_dim on cr_returned_date_sk = d_date_sk INNER JOIN customer on cr_returning_customer_sk = c_cu...
tpcds
Select Count(*) From comments As c, posts As p, postLinks As pl, postHistory As ph, votes As v Where c.Score = 0 And p.Id = v.PostId And p.FavoriteCount >= 0 And p.Id = ph.PostId And p.Id = c.PostId And pl.LinkTypeId = 1 And p.Id = pl.PostId
stats
Select o_shippriority, o_orderdate, l_orderkey, Sum(l_extendedprice * (1 - l_discount)) As revenue From customer, orders, lineitem Where c_mktsegment = 1 And l_orderkey = o_orderkey And l_shipdate > DATE 1 And o_orderdate < DATE 1 And c_custkey = o_custkey Group By l_orderkey, o_orderdate, o_shippriority Order By reven...
tpch
select min(an.name) as acress_pseudonym, min(t.title) as japanese_anime_movie from aka_name as an, cast_info as ci, company_name as cn, company_type as ct, keyword as k, movie_companies as mc, movie_keyword as mk, name as n, role_type as rt, title as t where mc.note like '%(Japan)%' and ci.person_id = an.person_id and ...
job
SELECT cust_nation, l_year, supp_nation, SUM(volume) AS revenue FROM ( SELECT n1.n_name AS supp_nation, n2.n_name AS cust_nation, EXTRACT(YEAR FROM l_shipdate) AS l_year, l_extendedprice * (1 - l_discount) AS volume FROM supplier, lineitem, orders, customer, nation n1, nation n2 WHERE s_nationkey = n1.n_nationkey AND c...
tpch
SELECT AVG(l_extendedprice) AS avg_price, l_linestatus, AVG(l_discount) AS avg_disc, COUNT(*) AS count_order, SUM(l_quantity) AS sum_qty, SUM(l_extendedprice) AS sum_base_price, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, AVG(l_quantity) AS avg_qty, SUM(l_extendedprice * (1 - l_discount)) AS su...
tpch
SELECT AVG(ss_quantity), AVG(ss_ext_sales_price), AVG(ss_ext_wholesale_cost), SUM(ss_ext_wholesale_cost) FROM store_sales JOIN store ON s_store_sk = ss_store_sk JOIN customer_demographics ON cd_demo_sk = ss_cdemo_sk JOIN household_demographics ON hd_demo_sk = ss_hdemo_sk JOIN customer_address ON ca_address_sk = ss_addr...
tpcds
SELECT MIN(t.title) AS marvel_movie, MIN(k.keyword) AS movie_keyword, MIN(n.name) AS actor_name FROM cast_info AS ci, keyword AS k, movie_keyword AS mk, name AS n, title AS t WHERE k.id = mk.keyword_id AND k.keyword = 'marvel-cinematic-universe' AND n.name LIKE '%Downey%Robert%' AND t.id = mk.movie_id AND t.production_...
job
SELECT MIN(k.keyword) AS movie_keyword, MIN(n.name) AS actor_name, MIN(t.title) AS marvel_movie FROM cast_info AS ci, keyword AS k, movie_keyword AS mk, name AS n, title AS t WHERE k.keyword = 'marvel-cinematic-universe' AND t.production_year > 2010 AND t.id = mk.movie_id AND n.name LIKE '%Hemsworth%Chris%' AND n.id = ...
job
SELECT l_shipmode, SUM( CASE WHEN o_orderpriority <> '1-URGENT' AND o_orderpriority <> '2-HIGH' THEN 1 ELSE 0 END ) AS low_line_count, SUM( CASE WHEN o_orderpriority = '1-URGENT' OR o_orderpriority = '2-HIGH' THEN 1 ELSE 0 END ) AS high_line_count FROM orders, lineitem WHERE o_orderkey = l_orderkey AND l_shipdate < l_c...
tpch
SELECT l_returnflag, AVG(l_extendedprice) AS avg_price, AVG(l_quantity) AS avg_qty, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, l_linestatus, SUM(l_extendedprice) AS sum_base_price, AVG(l_discount) AS avg_disc, COUNT(*) AS count_order, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, ...
tpch
select min(t.title) as movie_title from keyword as k, movie_info as mi, movie_keyword as mk, title as t where t.id = mi.movie_id and k.keyword like '%sequel%' and mk.movie_id = mi.movie_id and t.production_year > 2010 and mi.info in ('Sweden', 'Norway', 'Germany', 'Danish', 'Swedish', 'Danish', 'Norwegian', 'German') a...
job
SELECT MIN(k.keyword) AS movie_keyword, MIN(t.title) AS marvel_movie, MIN(n.name) AS actor_name FROM cast_info AS ci, keyword AS k, movie_keyword AS mk, name AS n, title AS t WHERE ci.movie_id = mk.movie_id AND t.id = ci.movie_id AND n.id = ci.person_id AND t.id = mk.movie_id AND t.production_year > 2010 AND n.name LIK...
job
Select Min(mi_idx.info) As rating, Min(t.title) As movie_title From info_type As it, movie_info_idx As mi_idx, title As t Where t.id = mi_idx.movie_id AND it.id = mi_idx.info_type_id AND it.info ='rating' AND mi_idx.info > '8.0' AND t.production_year >= 2000 AND t.production_year <= 2005
job
SELECT MIN(t.title) AS movie_title, MIN(t.production_year) AS movie_year, MIN(mc.note) AS production_note FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info_idx AS mi_idx, title AS t WHERE it.info = 'top 250 rank' AND it.id = mi_idx.info_type_id AND ct.kind = 'production companies' AND t.id = m...
job
SELECT AVG(cs_coupon_amt) AS agg3, i_item_id, AVG(cs_quantity) AS agg1, AVG(cs_sales_price) AS agg4, AVG(cs_list_price) AS agg2 FROM catalog_sales JOIN customer_demographics ON cs_bill_cdemo_sk = cd_demo_sk JOIN date_dim ON cs_sold_date_sk = d_date_sk JOIN item ON cs_item_sk = i_item_sk JOIN promotion ON cs_promo_sk = ...
tpcds
SELECT MIN(mc.note) AS production_note, MIN(t.title) AS movie_title, MIN(t.production_year) AS movie_year FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info_idx AS mi_idx, title AS t WHERE (mc.note LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%') AND t.id = mi_idx.movie_id AND ct.kind =...
job
Select Min(an1.name) As actress_pseudonym, Min(t.title) As japanese_movie_dubbed From aka_name As an1, cast_info As ci, company_name As cn, movie_companies As mc, name As n1, role_type As rt, title As t Where an1.person_id = ci.person_id AND n1.name Like '%Yo%' AND ci.movie_id = mc.movie_id AND n1.name Not Like '%Yu%' ...
job
WITH _q AS ( SELECT o_year, SUM( CASE WHEN nation = 1 THEN volume ELSE 0 END ) / SUM(volume) AS mkt_share FROM ( SELECT EXTRACT(YEAR FROM o_orderdate) AS o_year, l_extendedprice * (1 - l_discount) AS volume, n2.n_name AS nation FROM part, supplier, lineitem, orders, customer, nation n1, nation n2, region WHERE l_orderk...
tpch
SELECT c_custkey, c_name, SUM(l_quantity), o_orderkey, o_orderdate, o_totalprice FROM customer, orders, lineitem WHERE o_orderkey IN ( SELECT l_orderkey FROM lineitem GROUP BY l_orderkey HAVING SUM(l_quantity) > 1 ) AND c_custkey = o_custkey AND o_orderkey = l_orderkey GROUP BY c_name, c_custkey, o_orderkey, o_orderdat...
tpch
SELECT l_returnflag, AVG(l_discount) AS avg_disc, SUM(l_quantity) AS sum_qty, SUM(l_extendedprice) AS sum_base_price, l_linestatus, COUNT(1) AS count_order, AVG(l_extendedprice) AS avg_price, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, AVG(l_quantity) AS avg_qty, SUM(l_extendedprice * (1 - l_discount) * ...
tpch
SELECT MAX(n.name) AS of_person, MAX(t.title) AS biography_movie FROM aka_name AS an, cast_info AS ci, info_type AS it, link_type AS lt, movie_link AS ml, name AS n, person_info AS pi, title AS t WHERE ml.linked_movie_id = t.id AND n.name_pcode_cf BETWEEN 'A' AND 'F' AND pi.person_id = ci.person_id AND lt.id = ml.link_...
job
WITH _q AS ( SELECT p_brand, p_type, p_size, COUNT(DISTINCT ps_suppkey) AS supplier_cnt FROM partsupp, part WHERE p_size IN (1, 1, 1, 1, 1, 1, 1, 1) AND p_partkey = ps_partkey AND p_type NOT LIKE 1 AND p_brand <> 1 AND ps_suppkey NOT IN ( SELECT s_suppkey FROM supplier WHERE s_comment LIKE '%Customer%Complaints%' ) GRO...
tpch
SELECT c_last_name, c_first_name, list_price, extended_price, bought_city, extended_tax, ca_city, ss_ticket_number FROM ( SELECT ss_ticket_number, ss_customer_sk, ca_city AS bought_city, SUM(ss_ext_sales_price) AS extended_price, SUM(ss_ext_list_price) AS list_price, SUM(ss_ext_tax) AS extended_tax FROM store_sales JOI...
tpcds
WITH _q AS ( select * from ( select avg(ss_list_price) as b1_lp, count(ss_list_price) as b1_cnt, count(distinct ss_list_price) as b1_cntd from store_sales where (ss_list_price between 99 and 99 + 10 or ss_coupon_amt between 2779 and 2779 + 1000 or ss_wholesale_cost between 69 and 69 + 20) ) as b2, ( select avg(ss_list_...
tpcds
SELECT c_first_name, bought_city, extended_price, ss_ticket_number, ca_city, list_price, extended_tax, c_last_name FROM ( SELECT ss_ticket_number, ss_customer_sk, ca_city AS bought_city, SUM(ss_ext_sales_price) AS extended_price, SUM(ss_ext_list_price) AS list_price, SUM(ss_ext_tax) AS extended_tax FROM store_sales JOI...
tpcds
SELECT p_brand, p_type, p_size, COUNT(DISTINCT ps_suppkey) AS supplier_cnt FROM partsupp, part WHERE p_type NOT LIKE 1 AND p_partkey = ps_partkey AND ps_suppkey NOT IN ( SELECT s_suppkey FROM supplier WHERE s_comment LIKE '%Customer%Complaints%' ) AND p_size IN (1, 1, 1, 1, 1, 1, 1, 1) AND p_brand != 1 GROUP BY p_brand...
tpch
SELECT MIN(n.name) AS voicing_actress, MIN(t.title) AS voiced_movie FROM aka_name AS an, char_name AS chn, cast_info AS ci, company_name AS cn, info_type AS it, movie_companies AS mc, movie_info AS mi, name AS n, role_type AS rt, title AS t WHERE t.id = ci.movie_id AND t.id = mc.movie_id AND ci.note IN ('(voice)', '(vo...
job
Select Count(*) From comments As c, postHistory As ph, votes As v, users As u Where v.UserId = ph.UserId AND u.Id = v.UserId AND u.DownVotes >= 0 AND u.UpVotes <= 123 AND ph.UserId = c.UserId AND u.Views >= 0
stats
SELECT cnt, c_last_name, ss_ticket_number, c_preferred_cust_flag, c_first_name, c_salutation FROM ( SELECT ss_ticket_number, ss_customer_sk, COUNT(1) AS cnt FROM store_sales JOIN date_dim ON ss_sold_date_sk = d_date_sk JOIN store ON ss_store_sk = s_store_sk JOIN household_demographics ON ss_hdemo_sk = hd_demo_sk WHERE ...
tpcds
SELECT MIN(mi_idx.info) AS rating, MIN(t.title) AS northamerican_movie FROM aka_title AS at, company_name AS cn, info_type AS it1, info_type AS it2, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS mi_idx, title AS t WHERE t.id = mc.movie_id AND kt.id = t.kind_id AND mi_idx.info < '3.5' AND t...
job
SELECT SUM(ps_supplycost * ps_availqty) AS VALUE, ps_partkey FROM partsupp, supplier, nation WHERE ps_suppkey = s_suppkey AND s_nationkey = n_nationkey AND n_name = 1 GROUP BY ps_partkey HAVING SUM(ps_supplycost * ps_availqty) > ( SELECT SUM(ps_supplycost * ps_availqty) * 1 FROM partsupp, supplier, nation WHERE ps_supp...
tpch
select cc_call_center_id as call_center, cc_name as call_center_name, cc_manager as manager, sum(cr_net_loss) as returns_loss from call_center join catalog_returns on cr_call_center_sk = cc_call_center_sk join date_dim on cr_returned_date_sk = d_date_sk join customer on cr_returning_customer_sk = c_customer_sk join cus...
tpcds
SELECT SUM(ss_ext_wholesale_cost), AVG(ss_ext_wholesale_cost), AVG(ss_ext_sales_price), AVG(ss_quantity) FROM store_sales JOIN store ON s_store_sk = ss_store_sk JOIN customer_demographics ON cd_demo_sk = ss_cdemo_sk JOIN household_demographics ON hd_demo_sk = ss_hdemo_sk JOIN customer_address ON ca_address_sk = ss_addr...
tpcds
SELECT ca_city, ss_ticket_number, extended_price, c_last_name, extended_tax, c_first_name, list_price, bought_city FROM ( SELECT ss_ticket_number, ss_customer_sk, ca_city AS bought_city, SUM(ss_ext_sales_price) AS extended_price, SUM(ss_ext_list_price) AS list_price, SUM(ss_ext_tax) AS extended_tax FROM store_sales JOI...
tpcds
WITH year_total AS ( SELECT SUM(((ss_ext_list_price - ss_ext_wholesale_cost - ss_ext_discount_amt) + ss_ext_sales_price) / 2) AS year_total, d_year AS dyear, 's' AS sale_type, c_login AS customer_login, c_customer_id AS customer_id, c_email_address AS customer_email_address, c_preferred_cust_flag AS customer_preferred_...
tpcds