text
stringlengths
84
1.49k
benchmark
stringclasses
4 values
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 it.info = 'top 250 rank' AND it.id = mi_idx.info_type_id AND ct.id = mc....
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 t.id = mi.movie_id AND (mc.note LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%') AND ct.id = mc.company_type_id AND it.id = mi.info_type_id AND mc.note...
job
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 AVG(l_quantity) AS avg_qty, l_returnflag, SUM(l_quantity) AS sum_qty, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, SUM(l_extendedprice) AS sum_base_price, l_linestatus, COUNT(*) AS count_order, AVG(l_discount) AS avg_disc, AVG(l_e...
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 i_item_desc, i_item_id, i_current_price From item Join inventory On i_item_sk = inv_item_sk Join date_dim On d_date_sk = inv_date_sk Join catalog_sales On cs_item_sk = i_item_sk Where d_date Between CAST('2001-07-13' As DATE) And (CAST('2001-07-13' As DATE) + INTERVAL '60 days') And inv_quantity_on_hand Between ...
tpcds
Select s_suppkey, s_name, total_revenue, s_address, s_phone From supplier, revenue0 Where s_suppkey = supplier_no AND total_revenue = ( Select Max(total_revenue) From revenue0 ) Order By s_suppkey
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.country_code ='[nl]' AND k.keyword ='character-name-in-title' AND cn.id = mc.company_id 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 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 SUM( CASE WHEN o_orderpriority <> '1-URGENT' AND o_orderpriority <> '2-HIGH' THEN 1 ELSE 0 END ) AS low_line_count, l_shipmode, 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_commitdate < l_receiptdate AND l_receiptda...
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.production_year > 2010 AND k.keyword Like '%sequel%' AND t.id = mk.movie_id AND k.id = mk.keyword_id AND mi.info In ('Sweden', 'Norway', 'Germany', 'Danish', 'Swedish', 'Danish',...
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 it.id = mi_idx.info_type_id AND ct.id = mc.company_type_id AND t.id = mc.movie_id AND mc.movie_id = mi_idx...
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 inner join store on ss_store_sk = s_store_sk inner join promotion on ss_promo_sk = p_promo_sk inner join date_dim on ss_sold_date_sk = d_date_sk inner j...
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.id = mc.company_type_id AND t.id = mi_idx.movie_id AND t.id = mc.movie_id AND mc.movie_id = mi_idx.movi...
job
SELECT ss_ticket_number, c_salutation, c_first_name, c_preferred_cust_flag, cnt, 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 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 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 ci.movie_id = mk.movie_id AND k.keyword = 'marvel-cinematic-universe' AND n.name LIKE '%Hemsworth%Chris%' AND n.id = ci.person_id AND t.id ...
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 = b.UserId AND p.ViewCount >= 0 AND p.Id = c.PostId AND p.Score <= 192 AND u.Id = p.OwnerUserId AND p.Id = ph.PostId AND p.Id = v.PostId
stats
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 o_custkey = c_custkey...
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 pi.person_id = ci.person_id AND (n.gender = 'm' OR (n.gender = 'f' AND n.name LIKE 'B%')) AND t.id = ci.movie_id AND c...
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_commitdate < l_receiptdate AND o_orderkey ...
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 ci.movie_id = mk.movie_id AND k.keyword = 'marvel-cinematic-universe' AND n.id = ci.person_id AND k.id = mk.keyword_id AND t.id = mk.movie_...
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 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.id = mc.company_type_id AND it.info = 'top 250 rank' AND it.id = mi_idx.info_type_id AND mc.movie_id = ...
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.name_pcode_cf BETWEEN 'A' AND 'F' AND ci.movie_id = ml.linked_movie_id AND t.id = ci.movie_id AND ml.linked_movie_id...
job
select o_totalprice, c_name, sum(l_quantity), o_orderdate, o_orderkey, c_custkey 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 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 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 ct.kind = 'production companies' AND ct.id = mc...
job
SELECT s_name, COUNT(1) AS numwait FROM supplier, lineitem l1, orders, nation WHERE s_nationkey = n_nationkey AND l1.l_receiptdate > l1.l_commitdate AND o_orderkey = l1.l_orderkey AND NOT EXISTS ( SELECT * FROM lineitem l3 WHERE l3.l_orderkey = l1.l_orderkey AND l3.l_suppkey <> l1.l_suppkey AND l3.l_receiptdate > l3.l_...
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 k.id = mk.keyword_id AND ci.note LIKE '%(voice: English versi...
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 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.note LIKE '%(voice: English version)%' AND t.id = mc.movie...
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 t.id = mc.movie_id AND it1.id = mi_idx.info_type_id AND mi.movie_id = ...
job
Select i_item_id, i_item_desc, s_state, Count(ss_quantity) As store_sales_quantitycount, Avg(ss_quantity) As store_sales_quantityave, STDDEV_SAMP(ss_quantity) As store_sales_quantitystdev, STDDEV_SAMP(ss_quantity) / Avg(ss_quantity) As store_sales_quantitycov, Count(sr_return_quantity) As store_returns_quantitycount, A...
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
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.Id = ph.PostId AND p.AnswerCount >= 0 AND p.Id = c.PostId AND u.Id = p.OwnerUserId AND p.Id = pl.PostId AND p.Id = v.PostId
stats
Select dt.d_year, item.i_brand_id As brand_id, item.i_brand As brand, Sum(ss_ext_sales_price) As ext_price 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 dt.d_moy = 12 AND item.i_manager_id = 95 AND dt.d_year = 1999 Group By ...
tpcds
select c_acctbal, c_address, c_comment, c_custkey, n_name, c_name, sum(l_extendedprice * (1 - l_discount)) as revenue, 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(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 an.person_id = n.id AND mi.movie_id = ci....
job
SELECT SUM(l_extendedprice * (1 - l_discount)) AS revenue, o_orderdate, o_shippriority, l_orderkey FROM customer, orders, lineitem WHERE l_orderkey = o_orderkey AND c_custkey = o_custkey AND o_orderdate < DATE 1 AND l_shipdate > DATE 1 AND c_mktsegment = 1 GROUP BY l_orderkey, o_orderdate, o_shippriority ORDER BY reven...
tpch
SELECT MIN(t.title) AS movie_title FROM keyword AS k, movie_info AS mi, movie_keyword AS mk, title AS t WHERE k.keyword LIKE '%sequel%' AND mk.movie_id = mi.movie_id AND k.id = mk.keyword_id AND t.production_year > 2010 AND t.id = mk.movie_id AND mi.info = ANY(ARRAY['Sweden', 'Norway', 'Germany', 'Danish', 'Swedish', '...
job
Select o_orderdate, o_totalprice, c_name, c_custkey, Sum(l_quantity), o_orderkey 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 s_acctbal, s_name, n_name, p_partkey, p_mfgr, s_address, s_phone, s_comment FROM part, supplier, partsupp, nation, region WHERE p_type LIKE 1 AND r_name = 1 AND p_size = 1 AND n_regionkey = r_regionkey AND ps_supplycost = ( SELECT MIN(ps_supplycost) FROM partsupp, supplier, nation, region WHERE p_partkey = ps_pa...
tpch
SELECT MAX(mi.info) AS release_date, MAX(miidx.info) AS rating, MAX(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 it.info = 'rating'...
job
SELECT AVG(cs_quantity) AS agg1, i_item_id, 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(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 k.keyword LIKE '%sequel%' AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Denish', 'Norwegian', 'German') AND k.id = mk.keyword_id AND ...
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 o_orderdate BETWEEN D...
tpch
WITH year_total AS ( SELECT c_email_address AS customer_email_address, c_login AS customer_login, d_year AS dyear, c_first_name AS customer_first_name, c_preferred_cust_flag AS customer_preferred_cust_flag, SUM(((ss_ext_list_price - ss_ext_wholesale_cost - ss_ext_discount_amt) + ss_ext_sales_price) / 2) AS year_total, ...
tpcds
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 cn.country_code = '[us]' AND ci.movie_id = mc.movie_id AND t.id = mi.movi...
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 kt.kind = 'movie' AND miidx.movie_id = t.id AND...
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 = mk.movie_id AND t.id = mi.movie_id AND t.production_year > 2000 AND k.keyword LIKE '%sequel%' AND mk.movie_id = mi.movie_id AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Denmar...
job
SELECT i_item_id, AVG(ss_coupon_amt) AS agg3, AVG(ss_sales_price) AS agg4, AVG(ss_list_price) AS agg2, AVG(ss_quantity) AS agg1 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(*) from comments as c, postHistory as ph, users as u where u.UpVotes <= 27 AND u.Id = c.UserId AND c.UserId = ph.UserId AND u.Reputation >= 1 LIMIT 200;
stats
Select Sum(ss_quantity) As store_sales_quantity, s_store_name, i_item_desc, Sum(cs_quantity) As catalog_sales_quantity, Sum(sr_return_quantity) As store_returns_quantity, s_store_id, i_item_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(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 k.keyword = 'anime' AND ci.movie_id = mc.movie_id AND mc.note...
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 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 ct.kind = 'production companies' and ct.id = mc...
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 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 t.id = mc.movie_id AND an1.person_id = n1.id AND ci.movie_id = mc.movie_id AND mc.company_id = cn.id AND ci.not...
job
Select COUNT(1) 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 = v.PostId And p.Id = c.PostId And p.Id = ph.PostId And p.Id = pl.RelatedPostId And pl.LinkTypeId = 1 And b.UserId = c.UserId
stats
Select Sum(l_extendedprice * (1 - l_discount)) As revenue, n_name 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(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 LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%') AND t.id = mi.movie_id AND ct.id = mc.company_type_id AND it.info = 'bottom 10 rank' AND mc.m...
job
SELECT i_item_id, i_current_price, i_item_desc 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 store_sales ON ss_item_sk = i_item_sk WHERE i_manufact_id IN (116, 70, 371, 438) AND inv_quantity_on_hand BETWEEN 100 AND 500 AND i_current_price BETWEEN 73 ...
tpcds
SELECT s_state, STDDEV_SAMP(sr_return_quantity) / AVG(sr_return_quantity) AS store_returns_quantitycov, STDDEV_SAMP(ss_quantity) AS store_sales_quantitystdev, COUNT(sr_return_quantity) AS store_returns_quantitycount, AVG(cs_quantity) AS catalog_sales_quantityave, STDDEV_SAMP(sr_return_quantity) AS store_returns_quantit...
tpcds
SELECT MAX(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.country_code ='[sm]' 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 mc.movie_id = t.id AND t.id = mk.mo...
job
select s_suppkey, s_name, s_address, s_phone, total_revenue from supplier, revenue0 where total_revenue = ( select MIN(total_revenue) from revenue0 ) and s_suppkey = supplier_no order by s_suppkey
tpch
SELECT n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, supplier, nation, region WHERE s_nationkey = n_nationkey AND l_suppkey = s_suppkey AND r_name = 1 AND o_orderdate >= DATE 1 AND l_orderkey = o_orderkey AND o_orderdate < DATE 1 + INTERVAL '1' YEAR AND c_custkey = o_custke...
tpch
SELECT COUNT(1) FROM comments AS c, votes AS v, users AS u WHERE c.CreationDate >= '2010-08-10 17:55:45'::timestamp AND u.Id = v.UserId AND u.Reputation >= 1 AND u.Id = c.UserId LIMIT 500;
stats
select count(*) from postHistory as ph, posts as p, users as u where ph.PostId = p.Id and ph.PostHistoryTypeId = 5 and p.OwnerUserId = u.Id and p.Score >= -1 LIMIT 200;
stats
SELECT p_size, COUNT(DISTINCT ps_suppkey) AS supplier_cnt, p_type, p_brand FROM partsupp, part WHERE p_size IN (1, 1, 1, 1, 1, 1, 1, 1) AND p_type NOT LIKE 1 AND ps_suppkey NOT IN ( SELECT s_suppkey FROM supplier WHERE s_comment LIKE '%Customer%Complaints%' ) AND p_partkey = ps_partkey AND p_brand <> 1 GROUP BY p_brand...
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(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 an.person_id = n.id AND cn.country_code = '[us]' AND ci.movie_id = mk.movie_id AND ci.movie...
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 t.id = mk.movie_id AND mk.movie_id = mc.movie_id AND n.id = c...
job
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 cn.country_code = '[us]' AND t.episode_nr < 100 AND mc.movie_id = mk.movie_id AND n.id = ci...
job
SELECT 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, l_shipmode FROM orders, lineitem WHERE l_commitdate < l_receiptdate AND l_shipmode ...
tpch
SELECT n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, supplier, nation, region WHERE l_orderkey = o_orderkey AND o_orderdate < DATE 1 + INTERVAL '1' YEAR AND l_suppkey = s_suppkey AND c_nationkey = s_nationkey AND o_orderdate >= DATE 1 AND s_nationkey = n_nationkey AND n_reg...
tpch
SELECT cnt, c_first_name, c_last_name, c_salutation, c_preferred_cust_flag, 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 s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE EXISTS ( SELECT * FROM lineitem l2 WHERE l2.l_orderkey = l1.l_orderkey AND l2.l_suppkey <> l1.l_suppkey ) AND o_orderstatus = 'F' AND NOT EXISTS ( SELECT * FROM lineitem l3 WHERE l3.l_orderkey = l1.l_orderkey AND l3.l_suppkey <> l1.l_su...
tpch
SELECT s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE o_orderkey = l1.l_orderkey AND s_suppkey = l1.l_suppkey AND NOT EXISTS ( SELECT * FROM lineitem l3 WHERE l3.l_orderkey = l1.l_orderkey AND l3.l_suppkey <> l1.l_suppkey AND l3.l_receiptdate > l3.l_commitdate ) AND n_name = 1 AND l1.l_rec...
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.country_code ='[de]' AND cn.id = mc.company_id AND k.keyword ='character-name-in-title' AND mk.keyword_id = k.id AND mc.movie_id = mk.movie_id AND t.id = mk.mo...
job
select o_year, nation, 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_suppkey = l_suppkey and ps_suppkey = l_suppkey and ps_partk...
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_shipmode IN (1, 1) AND l_commitdate < l_re...
tpch
WITH _q AS ( 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 c.UserId = u.Id AND p.Id = pl.RelatedPostId AND pl.LinkTypeId = 1 AND p.Score <= 40 AND p.Id = v.PostId AND p.Id = ph.PostId AND b.UserId = u.Id AND p.Id = c.PostId ) SELECT * FROM ...
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 p_partkey = l_partkey AND o_orderkey = l_orderkey AND s_suppk...
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 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 postHistory As ph, posts As p, votes As v, badges As b, users As u, comments As c Where p.Id = v.PostId AND p.Score <= 192 AND p.Id = c.PostId AND p.Id = ph.PostId AND u.Id = b.UserId AND p.ViewCount >= 0 AND u.Id = p.OwnerUserId
stats
SELECT MIN(t.title) AS movie_title, MIN(mi_idx.info) AS rating FROM info_type AS it, movie_info_idx AS mi_idx, title AS t WHERE t.production_year >= 2000 AND mi_idx.info > '8.0' AND t.id = mi_idx.movie_id AND it.info ='rating' AND t.production_year <= 2005 AND it.id = mi_idx.info_type_id
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(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 t.id = mc.movie_id AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' A...
job
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 c.UserId = u.Id AND b.UserId = u.Id AND p.Score <= 40 AND p.Id = c.PostId AND p.Id = ph.PostId AND p.Id = pl.RelatedPostId AND p.Id = v.PostId AND pl.LinkTypeId = 1
stats
WITH year_total AS ( SELECT c_birth_country AS customer_birth_country, c_customer_id AS customer_id, SUM(((ss_ext_list_price - ss_ext_wholesale_cost - ss_ext_discount_amt) + ss_ext_sales_price) / 2) AS year_total, 's' AS sale_type, d_year AS dyear, c_first_name AS customer_first_name, c_preferred_cust_flag AS customer_...
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 s_suppkey = ps_suppkey AND s_nationkey = n_nationkey AND p_partkey = ps_partkey AND p_size = 1 AND r_name = 1 AND p_type LIKE 1 AND n_regionkey = r_regionkey AND ps_supplycost = ( SELEC...
tpch
select ps_partkey, sum(ps_supplycost * ps_availqty) as VALUE 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 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_brand <> 1 AND p_type NOT LIKE 1 AND p_partkey = ps_partkey AND p_size IN (1, 1, 1, 1, 1, 1, 1, 1) GROUP BY p_brand...
tpch
WITH _q AS ( SELECT COUNT(*) FROM comments AS c, posts AS p, postLinks AS pl, votes AS v WHERE c.PostId = pl.PostId AND c.CreationDate >= '2010-08-02 23:52:10'::timestamp AND pl.PostId = v.PostId AND p.Id = c.PostId AND p.Score >= -3 AND v.VoteTypeId = 2 ) SELECT * FROM _q;
stats
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.note LIKE '%(voice)%' AND cn.country_code = '[ru]' AND ct.id = mc.company_type_id AND ci.note LIK...
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 p_brand, p_type, p_size, count(distinct ps_suppkey) as supplier_cnt from partsupp, part where p_brand <> 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 AND p_size in (1, 1, 1, 1, 1, 1, 1, 1) group by p_brand...
tpch
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 at.movie_id = mc.movie_id AND mi.movie_...
job
SELECT i_item_id, i_item_desc, i_current_price FROM item JOIN inventory ON i_item_sk = inv_item_sk JOIN date_dim ON d_date_sk = inv_date_sk JOIN catalog_sales ON cs_item_sk = i_item_sk WHERE d_date BETWEEN CAST('2000-05-01' AS DATE) AND (CAST('2000-05-01' AS DATE) + INTERVAL '60 days') AND inv_quantity_on_hand BETWEEN ...
tpcds