text
stringlengths
84
1.49k
benchmark
stringclasses
4 values
Select Min(an.name) As cool_actor_pseudonym, Min(t.title) As series_named_after_char From aka_name As an, cast_info As ci, company_name As cn, keyword As k, movie_companies As mc, movie_keyword As mk, name As n, title As t Where ci.movie_id = mk.movie_id And ci.movie_id = mc.movie_id And t.episode_nr >= 50 And mc.movie...
job
SELECT l_orderkey, o_shippriority, SUM(l_extendedprice * (1 - l_discount)) AS revenue, o_orderdate FROM customer, orders, lineitem WHERE l_orderkey = o_orderkey AND o_orderdate < DATE 1 AND l_shipdate > DATE 1 AND c_custkey = o_custkey AND c_mktsegment = 1 GROUP BY l_orderkey, o_orderdate, o_shippriority ORDER BY reven...
tpch
SELECT cust_nation, supp_nation, SUM(volume) AS revenue, l_year 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 c_nationkey = n2.n_nationkey AND s...
tpch
SELECT c_preferred_cust_flag, cnt, c_last_name, c_salutation, c_first_name, ss_ticket_number 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 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(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
WITH _q AS ( SELECT i_item_id, AVG(ss_quantity) AS agg1, AVG(ss_list_price) AS agg2, AVG(ss_coupon_amt) AS agg3, 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...
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 ci.movie_id = mc.movie_id AND ci.note LIKE '%(uncredited)%' AND t.id = ci.movie_id AND rt.id = ci.ro...
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(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 t.id = ci.movie_id And t.production_year > 2010 And k.keyword = 'marvel-cinematic-universe' And t.id = mk.movie_id...
job
Select Sum(l_extendedprice * (1 - l_discount)) As revenue From lineitem, part Where ( p_partkey = l_partkey And p_brand = 1 And p_container In ('SM Case', 'SM BOX', 'SM PACK', 'SM PKG') And l_quantity >= 1 And l_quantity <= 1 + 10 And p_size Between 1 And 5 And l_shipmode In ('AIR', 'AIR REG') And l_shipinstruct = 'DEL...
tpch
SELECT COUNT(*) FROM postHistory AS ph, posts AS p, users AS u, badges AS b WHERE p.Score >= -7 AND u.Id = b.UserId AND ph.PostHistoryTypeId = 3 AND u.Reputation >= 1 AND ph.UserId = u.Id AND p.OwnerUserId = u.Id LIMIT 200;
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 s_nationkey = n_nationkey And s_suppkey = l_suppkey And p_nam...
tpch
SELECT SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, l_linestatus, AVG(l_quantity) AS avg_qty, COUNT(*) AS count_order, AVG(l_discount) AS avg_disc, SUM(l_extendedprice) AS sum_base_price, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, AVG(l_extendedprice) AS avg_price, SUM(l_quantity...
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 it2.id = mi.info_type_id AND miidx.movie_id = t...
job
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 = ph.PostId AND pl.LinkTypeId = 1 AND b.UserId = u.Id AND p.Id = c.PostId AND p.Id = v.PostId AND p.Id = pl.RelatedPostId AND p.Score <= 40 AND c.UserId = u.Id
stats
SELECT COUNT(DISTINCT ps_suppkey) AS supplier_cnt, p_brand, p_type, p_size FROM partsupp, part WHERE p_partkey = ps_partkey AND ps_suppkey NOT IN ( SELECT s_suppkey FROM supplier WHERE s_comment LIKE '%Customer%Complaints%' ) AND p_type NOT LIKE 1 AND p_size IN (1, 1, 1, 1, 1, 1, 1, 1) AND p_brand <> 1 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.keyword = 'marvel-cinematic-universe' AND k.id = mk.keyword_id AND t.production_year > 2010 AND n.name LIKE '%Downey%Robert%' AND t.id = ...
job
SELECT MIN(t.title) AS movie_title FROM keyword AS k, movie_info AS mi, movie_keyword AS mk, title AS t WHERE k.id = mk.keyword_id AND t.id = mi.movie_id AND t.id = mk.movie_id AND t.production_year > 2000 AND mk.movie_id = mi.movie_id AND k.keyword LIKE '%sequel%' AND mi.info = ANY(ARRAY['Sweden', 'Norway', 'Germany',...
job
Select Sum(l_extendedprice * l_discount) As revenue From lineitem Where l_shipdate >= DATE 1 AND l_discount BETWEEN 1 - 0.01 AND 1 + 0.01 AND l_shipdate < DATE 1 + INTERVAL '1' YEAR AND l_quantity < 1
tpch
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 n1.id = ci.person_id AND mc.note NOT LIKE '%(USA)%' AND ci.movie_id = mc.movie_id AND an1.person_id = n1.id AND...
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 pi.note = 'Volker Boehm' AND ml.linked_movie_id = t.id AND an.name LIKE '%a%' AND n.name_pcode_cf BETWEEN 'A' AND 'F' ...
job
select count(*) from badges as b, users as u, posts as p where u.Id = b.UserId AND u.Id = p.OwnerUserId AND p.PostTypeId = 1 AND u.Reputation >= 1 limit 100;
stats
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 ci.note = '(voice: English version)' AND t.id = mc.movie_id AND n1.name NOT LIKE...
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 NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND it.info = 'bottom 10 rank' AND mc.movie_id = mi.movie_id AND ct.id = mc.company_type_id AND it.id = mi.info_type_id AND ct....
job
SELECT list_price, ss_ticket_number, extended_price, c_first_name, bought_city, extended_tax, c_last_name, 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 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 i_item_id, AVG(ss_sales_price) AS agg4, AVG(ss_quantity) AS agg1, AVG(ss_list_price) AS agg2, AVG(ss_coupon_amt) AS agg3 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 COUNT(1) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v, badges AS b WHERE p.Id = c.PostId AND p.Id = pl.RelatedPostId AND p.Id = ph.PostId AND pl.LinkTypeId = 1 AND p.Id = v.PostId AND b.UserId = c.UserId AND c.Score = 0
stats
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 t.id = mk.movie_id AND cn.country_code ='[de]' AND mc.movie_id = mk.movie_id AND mc.movie_id = t.id AND mk.keyword_id = k.id AND k.keyword ='character-name-in-...
job
Select ca_zip, Sum(cs_sales_price) From catalog_sales Inner Join customer On cs_bill_customer_sk = c_customer_sk Inner Join customer_address On c_current_addr_sk = ca_address_sk Inner Join date_dim On cs_sold_date_sk = d_date_sk Where d_year = 2000 AND d_qoy = 4 AND (SUBSTR(ca_zip, 1, 5) In ( '85669', '86197', '88274',...
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 n_regionkey = r_regionkey AND p_partkey = ps_partkey AND s_nationkey = n_nationkey AND p_type LIKE 1 AND ps_supplycost = ( SELECT MIN(ps_supplycost) FROM partsupp, suppli...
tpch
Select COUNT(1) From comments As c, postHistory As ph, votes As v, users As u Where ph.UserId = c.UserId AND u.Views >= 0 AND u.DownVotes >= 0 AND u.Id = v.UserId AND v.UserId = ph.UserId AND u.UpVotes <= 123
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 mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND mc.movie_id = mi_idx.movie_id AND ct.id = mc.co...
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 t.id = mk.movie_id AND mc.movie_id = t.id AND k.keyword ='character-name-In-title' AND mk.keyword_id = k.id AND cn.id = mc.company_id AND mc.movie_id = mk.movie_id AND cn.country_code =...
job
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 SUM(volume) AS revenue, l_year, supp_nation, cust_nation 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 o_orderkey = l_orderkey AND c_nati...
tpch
SELECT MIN(t.title) AS movie_title FROM keyword AS k, movie_info AS mi, movie_keyword AS mk, title AS t WHERE mk.movie_id = mi.movie_id AND t.id = mi.movie_id AND k.keyword LIKE '%sequel%' AND mi.info = ANY(ARRAY['Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Denish', 'Norwegian', 'German']) AND t.production_yea...
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 it.info = 'rating' and mi.movie_id = t.id and i...
job
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 mk.movie_id = mi.movie_id AND k.keyword LIKE '%sequel%' AND t.production_year > 2005 AND t.id = mk.movie_id AND k.id = mk.keyword_id AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Denmar...
job
SELECT item.i_brand_id AS brand_id, SUM(ss_ext_sales_price) AS ext_price, item.i_brand AS brand, dt.d_year 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 dt.d_year = 1999 AND item.i_manager_id = 67 AND dt.d_moy = ...
tpcds
Select Count(1) 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.Views >= 0 And u.DownVotes >= 0 And ph.UserId = c.UserId And u.UpVotes <= 123
stats
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 n.id = ci.person_id AND n.name LIKE '%Downey%Robert%' AND ci.movie_id = mk.movie_id AND k.keyword = 'marvel-cinemati...
job
select sum(l_extendedprice * l_discount) as revenue from lineitem where l_shipdate >= DATE 1 and l_shipdate < DATE 1 + INTERVAL '1' YEAR and l_discount between 1 - 0.01 and 1 + 0.01 and l_quantity < 1 limit 200;
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 ct.kind = 'production companies' AND t.id = mi.movie_id AND it.info = 'bottom 10 rank' AND it.id = mi.info_type_id AND (mc.note LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%...
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 r_name = 1 AND o_orderdate < DATE 1 + INTERVAL '1' YEAR AND n_regionkey = r_regionkey AND o_orderdate >= DATE 1 AND c_nationkey = s_na...
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 ci.person_id = an.person_id AND cn.id = mc.company_id AND mc....
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(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 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 c_custkey = o_custkey AND s_nationkey = n_nationkey AND o_orderdate >= DATE 1 AND l_suppkey = s_suppkey AND l_orderkey = o_orderkey AND n_regionk...
tpch
select p_brand, p_type, p_size, count(distinct ps_suppkey) as supplier_cnt from partsupp, part where 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_type not like 1 AND p_brand <> 1 AND p_partkey = ps_partkey group by p_brand...
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 it.id = mi_idx.info_type_id AND (mc.note LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%') AND mc.m...
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 n.name LIKE '%Hemsworth%Chris%' AND ci.movie_id = mk.movie_id AND t.id = mk.movie_id AND t.id = ci.movie_id AND t.production_year > 2010 AN...
job
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 it.info = 'top 250 rank' And ct.id = mc.company_type_id And (mc.note ...
job
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.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND (mc.note LIKE '%(co-production)%' OR mc.note LI...
job
select count(*) from postHistory as ph, posts as p, votes as v, badges as b, users as u, comments as c where u.Id = p.OwnerUserId AND p.Id = ph.PostId AND u.Id = b.UserId AND p.ViewCount >= 0 AND p.Id = v.PostId AND p.Score <= 192 AND p.Id = c.PostId
stats
SELECT MIN(lt.link) AS link_type, MIN(t.title) AS western_sequel, MIN(cn.name) AS from_company 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 mk.movie_id = mc.movie_id AND ml.mo...
job
SELECT SUM(l_extendedprice * (1 - l_discount)) AS revenue, n_name FROM customer, orders, lineitem, supplier, nation, region WHERE l_suppkey = s_suppkey AND l_orderkey = o_orderkey AND r_name = 1 AND n_regionkey = r_regionkey AND c_nationkey = s_nationkey AND o_orderdate >= DATE 1 AND s_nationkey = n_nationkey AND c_cus...
tpch
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 LIKE '%(Japan)%' AND rt.role = 'actress' AND an1.person_id = ci.person_id AND ci.role_id = rt.id AND ci...
job
SELECT p_brand, p_type, p_size, COUNT(DISTINCT ps_suppkey) AS supplier_cnt FROM partsupp, part WHERE p_brand <> 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_type NOT LIKE 1 GROUP BY p_brand...
tpch
SELECT n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, supplier, nation, region WHERE n_regionkey = r_regionkey AND s_nationkey = n_nationkey AND c_nationkey = s_nationkey AND o_orderdate < DATE 1 + INTERVAL '1' YEAR AND l_suppkey = s_suppkey AND c_custkey = o_custkey AND r_n...
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 p.Score <= 40 AND c.UserId = u.Id AND pl.LinkTypeId = 1 AND p.Id = pl.RelatedPostId AND p.Id = ph.PostId AND b.UserId = u.Id AND p.Id = c.PostId AND p.Id = v.PostId
stats
SELECT n_name, c_custkey, c_acctbal, c_address, SUM(l_extendedprice * (1 - l_discount)) AS revenue, c_comment, 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 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 ( (n1.n_name = 1 AND n2.n_name = 1...
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 mc.movie_id = t.id And t.id = mk.movie_id And cn.country_code ='[sm]' And mk.keyword_id = k.id And k.keyword ='character-name-In-title' And mc.movie_id = mk.mo...
job
SELECT total_revenue, s_name, s_suppkey, s_address, s_phone FROM supplier, revenue0 WHERE total_revenue = ( SELECT MAX(total_revenue) FROM revenue0 ) AND s_suppkey = supplier_no ORDER BY s_suppkey LIMIT 500;
tpch
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 = pl.PostId AND p.FavoriteCount >= 0 AND c.Score = 0 AND p.Id = c.PostId AND p.Id = v.PostId AND p.Id = ph.PostId
stats
SELECT MIN(t.title) AS movie_title FROM keyword AS k, movie_info AS mi, movie_keyword AS mk, title AS t WHERE k.id = mk.keyword_id AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Danish', 'Norwegian', 'German') AND t.id = mi.movie_id AND t.production_year > 2000 AND k.keyword LIKE '%sequel%' AND t...
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 at.title LIKE '%Champion%' AND mi.movie_id = mc.movie_id AND cn.countr...
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 t.id = mc.movie_id AND mc.movie_id = mi.movie_id AND t.id = mi.movie_id AND ct.id = mc.company_type_id AND it.info = 'bottom 10 rank' AND (mc.note LIKE '%(co-production)%' OR mc.note...
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 t.production_year > 2010 AND k.id = mk.keyword_id AND n.name LIKE '%Hemsworth%Chris%' AND t.id = mk.movie_id AND k.keyword = 'marvel-cinema...
job
SELECT MAX(cs_net_profit) AS catalog_sales_profit, MAX(sr_net_loss) AS store_returns_loss, s_store_name, i_item_id, s_store_id, MAX(ss_net_profit) AS store_sales_profit, i_item_desc 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 n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, supplier, nation, region WHERE c_nationkey = s_nationkey AND s_nationkey = n_nationkey AND l_suppkey = s_suppkey AND n_regionkey = r_regionkey AND l_orderkey = o_orderkey AND o_orderdate < DATE 1 + INTERVAL '1' YEAR AND c...
tpch
SELECT COUNT(1) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v WHERE p.Id = ph.PostId AND c.Score = 0 AND p.Id = pl.PostId AND p.FavoriteCount >= 0 AND pl.LinkTypeId = 1 AND p.Id = c.PostId AND p.Id = v.PostId
stats
SELECT MIN(t.title) AS western_sequel, MIN(lt.link) AS link_type, MIN(cn.name) AS from_company 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 t.production_year > 1950 AND mi.inf...
job
SELECT MIN(t.title) AS western_violent_movie, MIN(mi_idx.info) AS rating, MIN(cn.name) AS movie_company 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 Sum(cs_sales_price), ca_zip From catalog_sales Join customer On cs_bill_customer_sk = c_customer_sk Join customer_address On c_current_addr_sk = ca_address_sk Join date_dim On cs_sold_date_sk = d_date_sk Where d_year = 2001 And d_qoy = 1 And (SUBSTR(ca_zip, 1, 5) In ( '85669', '86197', '88274', '83405', '86475',...
tpcds
select COUNT(1) from comments as c, posts as p, postLinks as pl, postHistory as ph, votes as v where p.FavoriteCount >= 0 AND p.Id = v.PostId AND pl.LinkTypeId = 1 AND c.Score = 0 AND p.Id = c.PostId AND p.Id = ph.PostId AND p.Id = pl.PostId
stats
select c_first_name, c_salutation, cnt, ss_ticket_number, c_preferred_cust_flag, c_last_name 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 COUNT(*) AS count_order, AVG(l_discount) AS avg_disc, l_linestatus, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, AVG(l_extendedprice) AS avg_price, l_returnflag, SUM(l_quantity) AS sum_qty, AVG(l_quantity) AS avg_qty, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, SUM(l_extend...
tpch
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 c_nationkey = n2.n_nationkey AND c...
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 an.person_id = n.id AND mi.movie_id = mc.movie_id AND t.id = mi.movie_id ...
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 mc.movie_id = t.id AND kt.kind = 'movie' AND cn...
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.movie_id = mi.movie_id AND it.id = mi.info_type_id AND t.id = mi.movie_id AND ct.kind = 'production companies' AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND (mc.n...
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 mc.company_id = cn.id AND ci.note = '(voice: English version)' AND an1.person_id = ci.person_id AND mc.note LIK...
job
SELECT n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, supplier, nation, region WHERE c_custkey = o_custkey AND l_orderkey = o_orderkey AND l_suppkey = s_suppkey AND c_nationkey = s_nationkey AND s_nationkey = n_nationkey AND n_regionkey = r_regionkey AND r_name = 1 AND o_ord...
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 t.id = mk.movie_id AND n.id = ci.person_id AND k.keyword = 'marvel-cinematic-universe' AND t.id = ci.movie_id AND ...
job
SELECT c_comment, c_custkey, c_address, c_acctbal, SUM(l_extendedprice * (1 - l_discount)) AS revenue, c_phone, 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(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 mi.info IN ('Sweden', 'Norway', 'Germany', 'Danish', 'Swedish', 'Danish', 'Norwegian', 'German') AND mk.movie_id = mi.movie_id AND t.production_year > 2010 AND t.id = mk.movie_id AND k.id...
job
SELECT COUNT(*) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v, badges AS b WHERE pl.LinkTypeId = 1 AND p.Id = pl.RelatedPostId AND p.Id = c.PostId AND b.UserId = c.UserId AND c.Score = 0 AND p.Id = ph.PostId AND p.Id = v.PostId LIMIT 20;
stats
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 o_year, SUM(amount) AS sum_profit, nation 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_suppkey = l_suppkey AND p_partkey = l_partkey AND p_name LI...
tpch
SELECT MIN(an.name) AS cool_actor_pseudonym, MIN(t.title) AS series_named_after_char FROM aka_name AS an, cast_info AS ci, company_name AS cn, keyword AS k, movie_companies AS mc, movie_keyword AS mk, name AS n, title AS t WHERE t.id = mk.movie_id AND ci.movie_id = t.id AND ci.movie_id = mk.movie_id AND an.person_id = ...
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 it.id = mi.info_type_id AND ci.role_id = rt.id AND t.id = mi.movie_id AND...
job
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 c_custkey = o_custkey AND l_shipda...
tpch
SELECT MIN(mc.note) AS production_note, MIN(t.production_year) AS movie_year, 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 = mi_idx.movie_id AND t.id = mc.movie_id AND (mc.note LIKE '%(co-production)%' OR mc.note LIKE '%(pre...
job
select s_name, s_address from supplier, nation where s_nationkey = n_nationkey and n_name = 1 and s_suppkey in ( select ps_suppkey from partsupp where ps_partkey in ( select p_partkey from part where p_name like 1 ) and ps_availqty > ( select 0.5 * sum(l_quantity) from lineitem where l_partkey = ps_partkey and l_suppke...
tpch
SELECT i_item_id, i_item_desc, i_current_price FROM item INNER JOIN inventory ON i_item_sk = inv_item_sk INNER JOIN date_dim ON d_date_sk = inv_date_sk INNER JOIN catalog_sales ON cs_item_sk = i_item_sk WHERE i_manufact_id IN (195, 412, 338, 267) AND inv_quantity_on_hand >= 100 AND inv_quantity_on_hand <= 500 AND i_cur...
tpcds
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(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 ct.kind = 'production companies' AND mi.movie_i...
job
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.movie_id = mi_idx.movie_id AND t.id = mi_idx.movie_id AND it.id = mi_idx.info_type_id AND it.info = 'to...
job