text
stringlengths
84
1.49k
benchmark
stringclasses
4 values
WITH _q AS ( SELECT n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, supplier, nation, region WHERE c_custkey = o_custkey AND r_name = 1 AND c_nationkey = s_nationkey AND o_orderdate >= DATE 1 AND s_nationkey = n_nationkey AND l_suppkey = s_suppkey AND o_orderdate < DATE 1 + I...
tpch
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 pl.LinkTypeId = 1 AND p.Id = pl.RelatedPostId AND p.Id = v.PostId AND b.UserId = u.Id AND p.Id = c.PostId AND c.UserId = u.Id AND p.Score <= 40 AND p.Id = ph.PostId
stats
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 o_orderkey = l_orderkey AND ps_par...
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 cn.country_code = '[ru]' AND ci.note like '%(voice)%' AND t.id = mc.movie_...
job
with _q as ( 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 ...
tpch
SELECT MIN(cn.name) AS movie_company, MIN(t.title) AS western_violent_movie, MIN(mi_idx.info) AS rating 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 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 MAX(t.title) as movie_title from keyword as k, movie_info as mi, movie_keyword as mk, title as t where mi.info in ('Sweden', 'Norway', 'Germany', 'Danish', 'Swedish', 'Danish', 'Norwegian', 'German') AND t.id = mi.movie_id AND k.id = mk.keyword_id AND t.id = mk.movie_id AND mk.movie_id = mi.movie_id AND k.keywor...
job
Select l_returnflag, l_linestatus, Sum(l_quantity) As sum_qty, Sum(l_extendedprice) As sum_base_price, Sum(l_extendedprice * (1 - l_discount)) As sum_disc_price, Sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) As sum_charge, Avg(l_quantity) As avg_qty, Avg(l_extendedprice) As avg_price, Avg(l_discount) As avg_dis...
tpch
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 r_name = 1 AND c_nati...
tpch
SELECT i_brand AS brand, i_brand_id AS brand_id, i_manufact, i_manufact_id, SUM(ss_ext_sales_price) AS ext_price FROM date_dim JOIN store_sales ON d_date_sk = ss_sold_date_sk JOIN item ON ss_item_sk = i_item_sk JOIN customer ON ss_customer_sk = c_customer_sk JOIN customer_address ON c_current_addr_sk = ca_address_sk JO...
tpcds
SELECT MIN(t.title) AS movie_title FROM keyword AS k, movie_info AS mi, movie_keyword AS mk, title AS t WHERE t.production_year > 2005 AND t.id = mk.movie_id AND mi.info = ANY(ARRAY['Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Denish', 'Norwegian', 'German']) AND t.id = mi.movie_id AND k.keyword LIKE '%sequel%...
job
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 join store_sales on dt.d_date_sk = store_sales.ss_sold_date_sk join item on store_sales.ss_item_sk = item.i_item_sk where item.i_manager_id = 11 and dt.d_year = 2001 and dt.d_moy = 12 group by ...
tpcds
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 s_nationkey = n_nationkey And ps_suppkey = l_suppkey And p_na...
tpch
SELECT nation, SUM(amount) AS sum_profit, o_year 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 p_name LIKE 1 ) AS profit AND ps_partkey = l_partkey AND o_or...
tpch
SELECT MIN(t.production_year) AS movie_year, MIN(t.title) AS movie_title, 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 mc.movie_id = mi_idx.movie_id AND (mc.note LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%') AND ct...
job
SELECT c_acctbal, SUM(l_extendedprice * (1 - l_discount)) AS revenue, c_comment, c_custkey, c_address, n_name, c_name, 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 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 cn.id = mc.company_id AND k.keyword ='character-name-in-title' AND cn.country_code ='[nl]' AND t.id = mk.movie_id AND mc.movie_id = mk.movie_id AND mc.movie_id = t.id AND mk.keyword_id ...
job
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 it2.info = 'release dates' AND at.movie_id = mc.movie_id AND t.id = mc...
job
SELECT c_phone, SUM(l_extendedprice * (1 - l_discount)) AS revenue, c_address, c_comment, c_custkey, c_acctbal, c_name, n_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 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 it.id = mi.info_type_id AND k.keywo...
job
SELECT o_orderkey, o_orderdate, c_custkey, SUM(l_quantity), o_totalprice, c_name 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 n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, supplier, nation, region WHERE r_name = 1 AND o_orderdate < DATE 1 + INTERVAL '1' YEAR AND l_suppkey = s_suppkey AND l_orderkey = o_orderkey AND o_orderdate >= DATE 1 AND n_regionkey = r_regionkey AND c_nationkey = s_nati...
tpch
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 n.name like '%Hemsworth%Chris%' AND t.production_year > 2010 AND n.id = ci.person_id AND k.id = mk.keyword_id AND k.keyword = 'marvel-cinem...
job
SELECT n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, supplier, nation, region WHERE r_name = 1 AND o_orderdate >= DATE 1 AND o_orderdate < DATE 1 + INTERVAL '1' YEAR AND c_custkey = o_custkey AND l_suppkey = s_suppkey AND n_regionkey = r_regionkey AND l_orderkey = o_orderke...
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 = t.id AND cn.id = mc.company_id AND k.keyword ='character-name-in-title' AND t.id = mk.movie_id AND cn.country_code ='[de]' AND mc.movie_id = mk.movie_id AND mk.keyword_id ...
job
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_receiptdate >= DATE 1 AND l_shipdate < l_c...
tpch
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 = ci.movie_id and k.id = mk.keyword_id and t.id = mk.movie_id and k.keyword = 'marvel-cinematic-universe' and n.id = ci.person_id and ...
job
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 t.id = mi.movie_id AND t.id = mc.movie_id AND ct.id = mc.company_type_id AND mc.note NOT LIKE '%(as Metro-Goldwy...
job
SELECT MIN(t.title) AS voiced_movie, MIN(n.name) AS voicing_actress 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 mi.movie_id = ci.movie_id AND an.person_id = n.id AND it.info = 'release ...
job
Select i_brand_id As brand_id, i_brand As brand, Sum(ss_ext_sales_price) As ext_price From date_dim Inner Join store_sales On d_date_sk = ss_sold_date_sk Inner Join item On ss_item_sk = i_item_sk Where d_moy = 11 And i_manager_id = 33 And d_year = 2001 Group By i_brand, i_brand_id Order By ext_price ASC, brand_id Limit...
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 ct.kind = 'production companies' AND t.id = mi_idx.movie_id AND it.info = 'top 250 rank' AND (mc.note LIKE...
job
SELECT extended_price, c_last_name, bought_city, c_first_name, extended_tax, list_price, ss_ticket_number, ca_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(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 mc.note not like '%(USA)%' and n1.id = ci.person_id and rt.role = 'actress' and t.id = mc.movie_id and ci.role_...
job
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 ci.role_id = rt.id AND t.id = mc.movie_id AND n.id = ci.person_id AND ci....
job
SELECT c_comment, SUM(l_extendedprice * (1 - l_discount)) AS revenue, c_address, c_acctbal, n_name, c_phone, c_custkey, 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 SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, SUM(l_extendedprice) AS sum_base_price, l_linestatus, AVG(l_discount) AS avg_disc, AVG(l_extendedprice) AS avg_price, COUNT(*) AS count_order, l_returnflag, AVG(l_quantity) AS avg_qty, SUM(l_quantity) AS sum_qty, SUM(l_extendedprice * (1 - l_discount) * ...
tpch
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 l_shipdate < l_commitdate AND l_commitdate <...
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 = mk.movie_id AND mk.movie_id = mi.movie_id AND t.production_year > 2005 AND k.id = mk.keyword_id AND k.keyword LIKE '%sequel%' AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Denish'...
job
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 r_name = 1 AND s_supp...
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 = mi_idx.movie_id AND it.id = mi_idx.info_type_id AND (mc.note LIKE '%(co-production)%' OR mc.note LI...
job
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 s_nationkey = n2.n_na...
tpch
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 mi.movie_id = miidx.movi...
job
SELECT i_item_id, AVG(ss_list_price) AS agg2, AVG(ss_coupon_amt) AS agg3, AVG(ss_quantity) AS agg1, AVG(ss_sales_price) AS agg4 FROM store_sales JOIN customer_demographics ON ss_cdemo_sk = cd_demo_sk JOIN date_dim ON ss_sold_date_sk = d_date_sk JOIN item ON ss_item_sk = i_item_sk JOIN promotion ON ss_promo_sk = p_promo...
tpcds
SELECT n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, supplier, nation, region WHERE o_orderdate >= DATE 1 AND c_custkey = o_custkey AND s_nationkey = n_nationkey AND l_orderkey = o_orderkey AND c_nationkey = s_nationkey AND l_suppkey = s_suppkey AND n_regionkey = r_regionke...
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 t.id = mc.movie_id AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND t.id = mi.movie_id AND ct.id = mc.company_type_id AND ct.kind = 'production companies' AND it.id = m...
job
SELECT MIN(t.title) AS movie_title FROM keyword AS k, movie_info AS mi, movie_keyword AS mk, title AS t WHERE mi.info = ANY(ARRAY['Sweden', 'Norway', 'Germany', 'Danish', 'Swedish', 'Danish', 'Norwegian', 'German']) AND k.id = mk.keyword_id AND t.id = mi.movie_id AND mk.movie_id = mi.movie_id AND k.keyword LIKE '%seque...
job
SELECT i_item_id, SUM(ss_quantity) AS store_sales_quantity, s_store_name, SUM(sr_return_quantity) AS store_returns_quantity, i_item_desc, SUM(cs_quantity) AS catalog_sales_quantity, s_store_id FROM store_sales JOIN store_returns ON ss_customer_sk = sr_customer_sk AND ss_item_sk = sr_item_sk AND ss_ticket_number = sr_ti...
tpcds
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.name_pcode_cf between 'A' and 'F' and ci.movie_id = ml.linked_movie_id and ml.linked_movie_id = t.id and it.id = pi....
job
SELECT p_brand, p_size, COUNT(DISTINCT ps_suppkey) AS supplier_cnt, p_type FROM partsupp, part WHERE 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_type NOT LIKE 1 AND p_partkey = ps_partkey GROUP BY p_brand...
tpch
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.id = mk.keyword_id AND n.name LIKE '%Downey%Robert%' AND t.id = mk.movie_id AND n.id = ci.person_id AND k.keyword = 'marvel-cinematic-uni...
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 = mc.movie_id AND it2.id = mi.info_...
job
SELECT SUM(ps_supplycost * ps_availqty) AS VALUE, ps_partkey FROM partsupp, supplier, nation WHERE n_name = 1 AND s_nationkey = n_nationkey AND ps_suppkey = s_suppkey 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 AVG(ss_ext_wholesale_cost), AVG(ss_ext_sales_price), SUM(ss_ext_wholesale_cost), 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 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 rt.role = 'actress' And ci.movie_id = t.id And mc.note Not Like '%(USA)%' And t.id = mc.movie_id And n1.name No...
job
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 ct.kind = 'production companies' AND mc.movie_id = mi.movie_id AND t.id = mi.movie_id AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND it.info = 'bottom 10 rank' AND it...
job
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 n1.n_regionkey = r_re...
tpch
SELECT p_brand, p_type, p_size, COUNT(DISTINCT ps_suppkey) AS supplier_cnt FROM partsupp, part WHERE p_partkey = ps_partkey AND p_brand <> 1 AND p_type NOT LIKE 1 AND p_size = ANY(ARRAY[1, 1, 1, 1, 1, 1, 1, 1]) AND ps_suppkey NOT IN ( SELECT s_suppkey FROM supplier WHERE s_comment LIKE '%Customer%Complaints%' ) GROUP B...
tpch
SELECT COUNT(*) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v, users AS u WHERE p.PostTypeId = 1 AND p.AnswerCount >= 0 AND p.Id = c.PostId AND u.Id = p.OwnerUserId AND p.Id = ph.PostId AND p.Id = pl.PostId AND p.Id = v.PostId
stats
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 s_suppkey = l_suppkey AND ps_partk...
tpch
SELECT s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE n_name = 1 AND o_orderkey = l1.l_orderkey AND EXISTS ( SELECT * FROM lineitem l2 WHERE l2.l_orderkey = l1.l_orderkey AND l2.l_suppkey <> l1.l_suppkey ) AND l1.l_receiptdate > l1.l_commitdate AND o_orderstatus = 'F' AND s_nationkey = n_n...
tpch
SELECT i_item_id, i_item_desc, s_store_id, s_store_name, MAX(ss_net_profit) AS store_sales_profit, MAX(sr_net_loss) AS store_returns_loss, MAX(cs_net_profit) AS catalog_sales_profit FROM store_sales JOIN store_returns ON store_sales.ss_customer_sk = store_returns.sr_customer_sk AND store_sales.ss_item_sk = store_return...
tpcds
SELECT MIN(n.name) AS actor_name, MIN(t.title) AS marvel_movie, 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 t.id = mk.movie_id AND k.id = mk.keyword_id AND t.id = ci.movie_id AND n.id = ci.person_id AND t.production_year > 2010 AND ci.movie_id = m...
job
SELECT o_orderkey, o_totalprice, c_custkey, SUM(l_quantity), c_name, o_orderdate 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 MAX(t.title) AS movie_title FROM keyword AS k, movie_info AS mi, movie_keyword AS mk, title AS t WHERE t.production_year > 2000 AND k.id = mk.keyword_id AND t.id = mk.movie_id AND mk.movie_id = mi.movie_id AND t.id = mi.movie_id AND k.keyword LIKE '%sequel%' AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Denmar...
job
select max(mi_idx.info) as rating, max(t.title) as movie_title from info_type as it, movie_info_idx as mi_idx, title as t where mi_idx.info > '8.0' and t.production_year between 2000 and 2005 and it.id = mi_idx.info_type_id and it.info ='rating' and t.id = mi_idx.movie_id
job
SELECT CAST(promotions AS DECIMAL(15, 4)) / CAST(total AS DECIMAL(15, 4)) * 100, total, promotions 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 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 (1, 1, 1, 1, 1, 1, 1) and not exists ( select * from orders where o_custkey = c_custkey ) ) as custsale and c_acctbal > ( selec...
tpch
select i_item_id, avg(cs_quantity) as agg1, avg(cs_list_price) as agg2, avg(cs_coupon_amt) as agg3, avg(cs_sales_price) as agg4 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(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 t.production_year > 2005 AND ct.id = mc.company_type_id AND t.id = mc.movie_id AND cn.country_code =...
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 mc.movie_id = t.id AND cn.id = mc.company_id AND t.id = mk.movie_id AND cn.country_code ='[de]' AND mc.movie_id = mk.movie_id AND mk.keyword_id = k.id AND k.keyword ='character-name-in-...
job
SELECT s_phone, p_mfgr, s_comment, s_address, n_name, s_acctbal, p_partkey, s_name FROM part, supplier, partsupp, nation, region WHERE p_partkey = ps_partkey AND s_suppkey = ps_suppkey AND p_size = 1 AND p_type LIKE 1 AND s_nationkey = n_nationkey AND n_regionkey = r_regionkey AND r_name = 1 AND ps_supplycost = ( SELEC...
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 k.keyword ='character-name-IN-title' AND cn.country_code ='[sm]' AND t.id = mk.movie_id AND mc.movie_id = mk.movie_id AND mk.keyword_id = k.id AND mc.movie_id = t.id AND cn.id = mc.comp...
job
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 an.person_id = n.id AND ci.person_id = an.person_id AND ci.ro...
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 ci.movie_id = mc.movie_id AND n1.id = ci.person_id AND an1.person_id = ci.person_id AND ci.role_id = rt.id AND ...
job
SELECT AVG(ss_sales_price) AS agg4, i_item_id, AVG(ss_coupon_amt) AS agg3, AVG(ss_quantity) AS agg1, AVG(ss_list_price) AS agg2 FROM store_sales JOIN customer_demographics ON ss_cdemo_sk = cd_demo_sk JOIN date_dim ON ss_sold_date_sk = d_date_sk JOIN item ON ss_item_sk = i_item_sk JOIN promotion ON ss_promo_sk = p_promo...
tpcds
SELECT s_name, COUNT(1) AS numwait FROM supplier, lineitem l1, orders, nation WHERE o_orderstatus = 'F' AND n_name = 1 AND EXISTS ( SELECT * FROM lineitem l2 WHERE l2.l_orderkey = l1.l_orderkey AND l2.l_suppkey <> l1.l_suppkey ) AND l1.l_receiptdate > l1.l_commitdate AND NOT EXISTS ( SELECT * FROM lineitem l3 WHERE l3....
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 ct.kind = 'production companies' AND it.id = mi.info_type_id AND mc.movie_id = mi.movie_id AND t.id = mi.movie_i...
job
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 INNER JOIN date_dim on ss_sold_date_sk = d_date_sk INNER JOIN store on ss_store_sk = s_store_sk INNER JOIN household_demographics on ss_hdemo_sk =...
tpcds
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(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 an.name LIKE '%a%' AND lt.id = ml.link_type_id AND n.name_pcode_cf BETWEEN 'A' AND 'F' AND lt.link = 'features' AND pi...
job
select p_brand, p_type, p_size, count(distinct ps_suppkey) as supplier_cnt from partsupp, part where p_partkey = ps_partkey AND 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%' ) group by p_brand...
tpch
select min(t.title) as japanese_movie_dubbed, min(an1.name) as actress_pseudonym 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 = n1.id and t.id = mc.movie_id and mc.company_id = cn.id and an1.person_id = ci.person_id and ci....
job
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 ci.person_id = an.person_id AND ci.movie_id = mc.movie_id AND cn.country_...
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 mc.movie_id = t.id AND cn.id = mc.company_id AND t.id = mk.movie_id AND mc.movie_id = mk.movie_id AND cn.country_code =...
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 it.info = 'top 250 rank' AND ct.id = mc.company_type_id AND (mc.note LIKE '%(co-production)%' OR mc.note L...
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 200;
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 s_acctbal, s_name, n_name, p_partkey, p_mfgr, s_address, s_phone, s_comment FROM part, supplier, partsupp, nation, region WHERE p_size = 1 AND 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 ...
tpch
SELECT MIN(t.production_year) AS movie_year, MIN(t.title) AS movie_title, 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 ct.id = mc.company_type_id AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND it.info = 'top 2...
job
SELECT p_mfgr, n_name, p_partkey, s_acctbal, s_phone, s_comment, s_name, s_address FROM part, supplier, partsupp, nation, region WHERE p_partkey = ps_partkey AND s_suppkey = ps_suppkey AND p_size = 1 AND p_type LIKE 1 AND s_nationkey = n_nationkey AND n_regionkey = r_regionkey AND r_name = 1 AND ps_supplycost = ( SELEC...
tpch
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 n.name LIKE '%Downey%Robert%' AND k.id = mk.keyword_id AND t.id = ci.movie_id AND n.id = ci.person_id AND k.keyword = 'marvel-cinematic-uni...
job
select c_custkey, c_name, sum(l_extendedprice * (1 - l_discount)) as revenue, c_acctbal, n_name, c_address, c_phone, c_comment from customer, orders, lineitem, nation where l_orderkey = o_orderkey AND o_orderdate < DATE 1 + INTERVAL '3' MONTH AND c_nationkey = n_nationkey AND c_custkey = o_custkey AND l_returnflag = 'R...
tpch
SELECT COUNT(1) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v, users AS u WHERE p.Id = c.PostId AND p.AnswerCount >= 0 AND p.Id = v.PostId AND p.Id = ph.PostId AND p.Id = pl.PostId AND p.PostTypeId = 1 AND u.Id = p.OwnerUserId
stats
SELECT COUNT(1) 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 p.Id = pl.RelatedPostId AND p.Id = ph.PostId AND b.UserId = u.Id AND p.Score <= 40 AND pl.LinkTypeId = 1 AND c.UserId = u.Id
stats
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 ci.movie_id = mc.movie_id AND t.production_year > 2000 AND cn.id = mc.com...
job
SELECT MIN(t.title) AS russian_movie, MIN(chn.name) AS uncredited_voiced_character 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 t.production_year > 2005 AND chn.id = ci.person_role_id AND ci.note LIKE '%(uncredited)%' AND ct.id ...
job
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 ci.movie_id = ml.linked_movie_id AND it.id = pi.info_type_id AND t.id = ci.movie_id AND pi.person_id = ci.person_id AN...
job
select count(*) from comments as c, posts as p, postHistory as ph, votes as v, users as u where p.OwnerUserId = ph.UserId AND ph.UserId = v.UserId AND p.AnswerCount >= 0 AND c.UserId = p.OwnerUserId AND p.Score <= 13 AND u.Id = c.UserId
stats
SELECT MIN(t.title) AS russian_movie, MIN(chn.name) AS uncredited_voiced_character 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.role = 'actor' AND t.id = ci.movie_id AND cn.country_code = '[ru]'...
job