text
stringlengths
84
1.49k
benchmark
stringclasses
4 values
SELECT s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE 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 o_orderstatus = 'F' AND l1.l_receiptdate > l1.l_commitdate AND EXIST...
tpch
SELECT c_custkey, c_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue, c_address, c_phone, c_comment, n_name, c_acctbal 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 c_salutation, c_preferred_cust_flag, c_last_name, c_first_name, 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(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 cn.country_code = '[us]' AND t.id =...
job
SELECT COUNT(*) FROM comments AS c, posts AS p, postHistory AS ph, votes AS v, users AS u WHERE u.Id = c.UserId AND p.OwnerUserId = ph.UserId AND p.AnswerCount >= 0 AND ph.UserId = v.UserId AND p.Score <= 13 AND c.UserId = p.OwnerUserId LIMIT 10;
stats
select s_name, count(*) as numwait from supplier, lineitem l1, orders, nation where l1.l_receiptdate > l1.l_commitdate AND o_orderkey = l1.l_orderkey AND s_suppkey = l1.l_suppkey AND s_nationkey = n_nationkey AND not exists ( select * from lineitem l3 where l3.l_orderkey = l1.l_orderkey and l3.l_suppkey <> l1.l_suppkey...
tpch
SELECT SUM(volume) AS revenue, cust_nation, supp_nation, 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 l_shipdate BETWEEN DATE '1995-01-0...
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 ct.kind = 'production companies' AND ct.id = mc.company_type_id AND mc.note NOT LIKE '%(as Metro-Goldwyn-M...
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 p.Id = pl.RelatedPostId AND p.Id = v.PostId AND p.Id = ph.PostId AND pl.LinkTypeId = 1 AND p.Id = c.PostId AND b.UserId = u.Id AND c.UserId = u.Id AND p.Score <= 40
stats
SELECT MIN(an.name) AS acress_pseudonym, MIN(t.title) AS japanese_anime_movie FROM aka_name AS an, cast_info AS ci, company_name AS cn, company_type AS ct, keyword AS k, movie_companies AS mc, movie_keyword AS mk, name AS n, role_type AS rt, title AS t WHERE mc.note NOT LIKE '%(USA)%' AND n.id = ci.person_id AND rt.rol...
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 kt.kind = 'movie' AND cn.country_code = '[us]' AND it1.id = mi_idx.inf...
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 b.UserId = u.Id AND p.Id = ph.PostId AND pl.LinkTypeId = 1 AND p.Score <= 40 AND p.Id = pl.RelatedPostId AND p.Id = c.PostId AND c.UserId = u.Id AND p.Id = v.PostId
stats
SELECT MIN(n.name) AS of_person, MIN(t.title) AS biography_movie FROM aka_name AS an, cast_info AS ci, info_type AS it, link_type AS lt, movie_link AS ml, name AS n, person_info AS pi, title AS t WHERE lt.id = ml.link_type_id AND n.id = an.person_id AND lt.link = 'features' AND an.name LIKE '%a%' AND n.name_pcode_cf BE...
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 ci.person_id = n.id AND ci.movie_id = ml.linked_movie_id AND pi.person_id = ci.person_id AND t.id = ci.movie_id AND t....
job
Select Avg(ss_quantity) As store_sales_quantityave, STDDEV_SAMP(cs_quantity) / Avg(cs_quantity) As catalog_sales_quantitycov, Avg(sr_return_quantity) As store_returns_quantityave, s_state, i_item_id, Count(ss_quantity) As store_sales_quantitycount, Count(cs_quantity) As catalog_sales_quantitycount, i_item_desc, STDDEV_...
tpcds
WITH _q AS ( 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 chn.id = ci.person_role_id AND ct.id = mc.company_type_id ) SELECT * FROM _q AND cn.id ...
job
WITH year_total AS ( SELECT c_birth_country AS customer_birth_country, c_email_address AS customer_email_address, 's' AS sale_type, c_last_name AS customer_last_name, c_first_name AS customer_first_name, c_login AS customer_login, c_customer_id AS customer_id, c_preferred_cust_flag AS customer_preferred_cust_flag, d_ye...
tpcds
Select dt.d_year, Sum(ss_ext_sales_price) As ext_price, item.i_brand_id As brand_id, item.i_brand As brand 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 = 57 And dt.d_moy = 12 And dt.d_year = 2002 Group By ...
tpcds
SELECT COUNT(*) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v, badges AS b, users AS u WHERE p.Id = pl.RelatedPostId AND p.Id = v.PostId AND p.Id = ph.PostId AND p.Id = c.PostId AND b.UserId = u.Id AND c.UserId = u.Id AND pl.LinkTypeId = 1 AND p.Score <= 40
stats
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.id = pi.person_id AND it.info = 'mini biography' AND an.name LIKE '%a%' AND pi.person_id = ci.person_id AND an.perso...
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 mc.note NOT LIKE '%(AS Metro-Goldwyn-Mayer Pictures)%' AND ct.kind = 'pr...
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 t.production_year > 2010 AND n.id = ci.person_id AND ci.movie_id = mk.movie_id AND n.name LIKE '%Hemsworth%Chris%' AND t.id = ci.movie_id A...
job
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 mc.note LIKE '%(Japan)%' AND ci.role_id = rt.id AND n1.name LIKE '%Yo%' AND t.id = mc.movie_id AND ci.movie_id ...
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 t.production_year > 2010 AND t.id = ci.movie_id AND t.id = mk.movie_id AND ci.movie_id = mk.movie_id AND k.keyword = 'marvel-cinematic-univ...
job
SELECT MAX(cs_net_profit) AS catalog_sales_profit, MAX(ss_net_profit) AS store_sales_profit, s_store_id, MAX(sr_net_loss) AS store_returns_loss, i_item_desc, i_item_id, s_store_name 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 c_custkey, SUM(l_quantity), o_orderkey, o_totalprice, 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 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 mc.company_id = cn.id AND ci.movie_id = mc.movie_id AND mc.note NOT LIKE '%(USA)%' AND mc.note LIKE '%(Japan)%'...
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 ct.id = mc.company_type_id AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND it.info = 'bottom 10 rank' AND (mc.note LIKE '%(co-production)...
job
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
WITH year_total AS ( SELECT c_customer_id AS customer_id, d_year AS dyear, c_email_address AS customer_email_address, c_preferred_cust_flag AS customer_preferred_cust_flag, c_first_name AS customer_first_name, c_login AS customer_login, SUM(((ss_ext_list_price - ss_ext_wholesale_cost - ss_ext_discount_amt) + ss_ext_sal...
tpcds
SELECT i_item_id, AVG(ss_list_price) AS agg2, AVG(ss_quantity) AS agg1, AVG(ss_coupon_amt) AS agg3, AVG(ss_sales_price) AS agg4 FROM store_sales INNER JOIN customer_demographics ON ss_cdemo_sk = cd_demo_sk INNER JOIN date_dim ON ss_sold_date_sk = d_date_sk INNER JOIN item ON ss_item_sk = i_item_sk INNER JOIN promotion ...
tpcds
SELECT ca_city, list_price, extended_tax, c_last_name, extended_price, ss_ticket_number, c_first_name, bought_city FROM ( SELECT ss_ticket_number, ss_customer_sk, ca_city AS bought_city, SUM(ss_ext_sales_price) AS extended_price, SUM(ss_ext_list_price) AS list_price, SUM(ss_ext_tax) AS extended_tax FROM store_sales JOI...
tpcds
SELECT ss_ticket_number, list_price, c_first_name, bought_city, c_last_name, extended_price, extended_tax, 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 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_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%' ) AND p_type NOT LIKE 1 GROUP B...
tpch
With _q As ( Select s_name, s_address From supplier, nation Where 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_suppkey = ps_suppkey And l_shipdate >=...
tpch
WITH year_total AS ( SELECT c_preferred_cust_flag AS customer_preferred_cust_flag, c_birth_country AS customer_birth_country, SUM(((ss_ext_list_price - ss_ext_wholesale_cost - ss_ext_discount_amt) + ss_ext_sales_price) / 2) AS year_total, d_year AS dyear, c_last_name AS customer_last_name, c_customer_id AS customer_id,...
tpcds
SELECT SUM(ss_ext_wholesale_cost), AVG(ss_ext_sales_price), AVG(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(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 MAX(cn.name) AS from_company, MAX(lt.link) AS link_type, MAX(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 lt.id = ml.link_type_id AND ml.movi...
job
SELECT AVG(l_discount) AS avg_disc, l_linestatus, COUNT(*) AS count_order, SUM(l_extendedprice) AS sum_base_price, l_returnflag, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, SUM(l_quantity) AS sum_qty, AVG(l_quantity) AS avg_qty, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, AVG(l_e...
tpch
WITH _q AS ( SELECT COUNT(*) FROM badges AS b, posts AS p WHERE p.AnswerCount <= 4 ) SELECT * FROM _q AND b.UserId = p.OwnerUserId AND b.Date <= '2014-09-11 08:55:52'::timestamp AND p.AnswerCount >= 0
stats
SELECT ss_ticket_number, c_preferred_cust_flag, c_salutation, cnt, c_first_name, 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 i_item_desc, AVG(ss_quantity) AS store_sales_quantityave, COUNT(ss_quantity) AS store_sales_quantitycount, COUNT(cs_quantity) AS catalog_sales_quantitycount, AVG(sr_return_quantity) AS store_returns_quantityave, COUNT(sr_return_quantity) AS store_returns_quantitycount, STDDEV_SAMP(sr_return_quantity) AS store_re...
tpcds
SELECT c_count, COUNT(*) AS custdist FROM ( SELECT c_custkey, COUNT(o_orderkey) AS c_count FROM customer LEFT INNER JOIN orders ON c_custkey = o_custkey AND o_comment NOT LIKE 1 GROUP BY c_custkey ) AS c_orders GROUP BY c_count ORDER BY custdist ASC, c_count ASC;
tpch
SELECT MIN(t.title) AS marvel_movie, MIN(n.name) AS actor_name, MIN(k.keyword) AS movie_keyword FROM cast_info AS ci, keyword AS k, movie_keyword AS mk, name AS n, title AS t WHERE t.id = ci.movie_id AND ci.movie_id = mk.movie_id AND k.id = mk.keyword_id AND k.keyword = 'marvel-cinematic-universe' AND n.id = ci.person_...
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 it.id = pi.info_type_id AND ml.linked_movie_id = t.id AND n.id = pi.person_id AND lt.link...
job
SELECT MIN(mi_idx.info) AS rating, MIN(t.title) AS movie_title FROM info_type AS it, movie_info_idx AS mi_idx, title AS t WHERE t.production_year BETWEEN 2000 AND 2010 AND it.id = mi_idx.info_type_id AND mi_idx.info > '7.0' AND t.id = mi_idx.movie_id AND it.info ='rating'
job
SELECT c_name, SUM(l_quantity), o_orderdate, o_orderkey, o_totalprice, 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 min(t.title) as marvel_movie, min(k.keyword) as movie_keyword, min(n.name) as actor_name from cast_info as ci, keyword as k, movie_keyword as mk, name as n, title as t where t.id = mk.movie_id AND n.id = ci.person_id AND ci.movie_id = mk.movie_id AND t.id = ci.movie_id AND k.keyword = 'marvel-cinematic-universe'...
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 = pl.RelatedPostId AND p.Id = ph.PostId AND p.Id = c.PostId AND p.Id = v.PostId AND b.UserId = u.Id AND pl.LinkTypeId = 1 AND c.UserId = u.Id AND p.Score <= 40
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.production_year > 2010 and t.id = mk.movie_id and k.keyword = 'marvel-cinematic-universe' and t.id = ci.movie_id and ci.movie_id = mk.mov...
job
SELECT MIN(lt.link) AS link_type, MIN(cn.name) AS from_company, 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 k.id = mk.keyword_id AND t.producti...
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 n.id = ci.person_id AND mc.company_id = cn.id AND mk.keyword_id = k.id AND k.keyword = 'cha...
job
SELECT COUNT(*) 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 c.Score = 0 AND p.Id = pl.PostId AND pl.LinkTypeId = 1 AND p.Id = ph.PostId AND p.Id = c.PostId LIMIT 200;
stats
WITH _q AS ( 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 ) SELECT * FROM _q AND p.Id = pl.RelatedPostId AND c.Score = 0 AND p.Id = c.PostId AND p.Id = ph.PostId AND b.UserId = c.UserId AND p.Id = v.PostId
stats
SELECT c_first_name, c_salutation, cnt, ss_ticket_number, c_last_name, c_preferred_cust_flag FROM ( SELECT ss_ticket_number, ss_customer_sk, COUNT(*) AS cnt FROM store_sales JOIN date_dim ON ss_sold_date_sk = d_date_sk JOIN store ON ss_store_sk = s_store_sk JOIN household_demographics ON ss_hdemo_sk = hd_demo_sk WHERE ...
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.id = ci.movie_id AND ci.note LIKE '%(uncredited)%' AND ct.id = mc.company_type_id AND rt.id = ci.r...
job
select l_orderkey, sum(l_extendedprice * (1 - l_discount)) as revenue, o_orderdate, o_shippriority from customer, orders, lineitem where l_shipdate > DATE 1 AND l_orderkey = o_orderkey AND o_orderdate < DATE 1 AND c_custkey = o_custkey AND c_mktsegment = 1 group by l_orderkey, o_orderdate, o_shippriority order by reven...
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 it.id = mi.info_type_id AND (mc.note LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%') AND t.id = mc.movie_id AND ct.kind = 'production companies' AND it.info = 'bottom 10 ran...
job
SELECT c_phone, c_custkey, SUM(l_extendedprice * (1 - l_discount)) AS revenue, c_comment, c_address, n_name, c_acctbal, 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 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 s_acctbal, s_phone, p_mfgr, s_address, p_partkey, n_name, s_comment, s_name FROM part, supplier, partsupp, nation, region WHERE p_size = 1 AND r_name = 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...
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 s_suppkey = ps_suppkey AND n_regionkey = r_regionkey AND p_size = 1 AND p_type LIKE 1 AND r_name = 1 AND ps_supplycost = ( SELECT MIN(ps_supplycost) FROM partsupp, supplier, nation, reg...
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 t.id = mc.movie_id AND t.production_year > 2005 AND ci.movie_id = mc.movie_id AND cn.id = mc.company...
job
with _q as ( 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 ct.id = mc.c...
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 mc.note LIKE '%(Japan)%' AND ct.id = mc.company_type_id AND m...
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 l_shipdate BETWEEN DATE '1995-01-0...
tpch
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 in ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Danish', 'Norwegian', 'German') AND t.id = mk.movie_id AND mk.movie_id = mi.movie_id AND k.keyword like '%sequel%' AND t.production_year > 2000 ...
job
SELECT MIN(k.keyword) AS movie_keyword, MIN(n.name) AS actor_name, MIN(t.title) AS marvel_movie FROM cast_info AS ci, keyword AS k, movie_keyword AS mk, name AS n, title AS t WHERE k.id = mk.keyword_id AND n.id = ci.person_id AND t.id = ci.movie_id AND ci.movie_id = mk.movie_id AND k.keyword = 'marvel-cinematic-univers...
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 mk.keyword_id = k.id AND t.id = mk.movie_id AND mc.movie_id = t.id AND k.keyword ='character-name-in-title' AND mc.movie_id = mk.movie_id AND cn.id = mc.company_id AND cn.country_code =...
job
SELECT s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE n_name = 1 AND l1.l_receiptdate > l1.l_commitdate AND s_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_suppkey AND l3.l_receiptdate ...
tpch
SELECT AVG(cs_coupon_amt) AS agg3, AVG(cs_sales_price) AS agg4, AVG(cs_list_price) AS agg2, i_item_id, AVG(cs_quantity) AS agg1 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 cnt, c_last_name, c_salutation, c_preferred_cust_flag, 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 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(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 ml.movie_id = mk.movie_id AND t.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 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 AVG(ss_quantity) AS agg1, AVG(ss_list_price) AS agg2, AVG(ss_coupon_amt) AS agg3, AVG(ss_sales_price) AS agg4, i_item_id 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 cc_manager AS manager, SUM(cr_net_loss) AS returns_loss, cc_call_center_id AS call_center, cc_name AS call_center_name 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
WITH _q AS ( SELECT s_name, s_address FROM supplier, nation WHERE 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_suppkey = ps_suppkey AND l_shipdate >=...
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 s_suppkey = l_suppkey...
tpch
Select Count(*) From badges As b, posts As p Where b.Date <= '2014-09-11 08:55:52'::timestamp AND b.UserId = p.OwnerUserId AND p.AnswerCount >= 0 AND p.AnswerCount <= 4 LIMIT 20;
stats
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 i_manufact_id = ANY(ARRAY[195, 412, 338, 267]) and inv_quantity_on_hand between 100 and 500 and i_current_price between 100 and 1...
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.gender = 'm' OR (n.gender = 'f' AND n.name LIKE 'B%')) AND t.production_year BETWEEN 1980 AND 1995 AND ci.person_id...
job
Select Count(*) From postHistory As ph, posts As p, votes As v, badges As b, users As u, comments As c Where p.Id = ph.PostId AND u.Id = b.UserId AND p.ViewCount >= 0 AND p.Score <= 192 AND p.Id = v.PostId AND p.Id = c.PostId AND u.Id = p.OwnerUserId
stats
WITH _q AS ( 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 = pl.RelatedPostId AND p.Id = c.PostId AND p.Score <= 40 AND p.Id = v.PostId AND pl.LinkTypeId = 1 AND b.UserId = u.Id AND p.Id = ph.PostId AND c.UserId = u.Id ) SELECT * FROM ...
stats
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 lt.id = ml.link_type_id AND ct.id =...
job
SELECT SUM(l_extendedprice) / 7.0 AS avg_yearly FROM lineitem, part WHERE l_quantity < ( SELECT 0.2 * AVG(l_quantity) FROM lineitem WHERE l_partkey = p_partkey ) AND p_partkey = l_partkey AND p_container = 1 AND p_brand = 1;
tpch
SELECT COUNT(*) FROM postHistory AS ph, posts AS p, users AS u, badges AS b WHERE p.OwnerUserId = u.Id AND u.Reputation >= 1 AND p.Score >= -7 AND ph.UserId = u.Id AND u.Id = b.UserId AND ph.PostHistoryTypeId = 3 LIMIT 500;
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 mc.movie_id = t.id AND cn.country_code ='[de]' AND mk.keyword_id = k.id AND cn.id = mc.company_id AND t.id = mk.movie_id AND k.keyword ='character-name-in-title' AND mc.movie_id = mk.mo...
job
SELECT i_item_id, MAX(ss_net_profit) AS store_sales_profit, s_store_id, MAX(sr_net_loss) AS store_returns_loss, s_store_name, i_item_desc, 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(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.movie_id = mc.movie_id AND t.id = mc.movie_id AND rt.role = 'actress' AND ci.note ...
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 cn.id = mc.company_id AND mc.note LIKE '%(USA)%' AND cn.country_code = '[...
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_shipdate < l_commitdate AND l_receiptdate ...
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 ci.person_id = an.person_id AND t.id = mc.movie_i...
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 = t.id AND ct.id = mc.company_type_...
job
SELECT p_brand, p_type, p_size, COUNT(DISTINCT ps_suppkey) AS supplier_cnt FROM partsupp, part WHERE p_size IN (1, 1, 1, 1, 1, 1, 1, 1) AND p_partkey = ps_partkey AND ps_suppkey NOT IN ( SELECT s_suppkey FROM supplier WHERE s_comment LIKE '%Customer%Complaints%' ) AND p_type NOT LIKE 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 ci.movie_id = mk.movie_id AND n.id = ci.person_id AND k.keyword = 'marvel-cinematic-universe' AND t.id = mk.movie_id AND t.production_year ...
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 it.id = mi_idx.info_type_id AND mc.movie_id = m...
job
SELECT MIN(t.title) AS northamerican_movie, MIN(mi_idx.info) AS rating 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 it1.id = mi_idx.info_type_id AND at.movie_id = mi.movie_id AND cn.coun...
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 k.id = mk.keyword_id AND t.id = mk.movie_id AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Danish', 'Swedish', 'Danish', 'Norwegian', 'German') AND t.production_year > 2010 AND k.keyword...
job