text
stringlengths
84
1.49k
benchmark
stringclasses
4 values
with _q as ( 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_current_price between 95 and 95 + 30 and d_date between CAST('2002-01-23' as DATE) and (CAST('2002-01-23' as DATE)...
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 ml.linked_movie_id = t.id AND an.person_id = ci.person_id AND n.id = an.person_id AND t.id = ci.movie_id AND pi.person...
job
SELECT MIN(t.title) AS american_movie FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info AS mi, title AS t WHERE ct.id = mc.company_type_id AND it.id = mi.info_type_id AND mc.movie_id = mi.movie_id AND ct.kind = 'production companies' AND t.id = mc.movie_id AND it.info = 'bottom 10 rank' AND mc...
job
SELECT MIN(chn.name) AS uncredited_voiced_character, MIN(t.title) AS russian_movie FROM char_name AS chn, cast_info AS ci, company_name AS cn, company_type AS ct, movie_companies AS mc, role_type AS rt, title AS t WHERE t.id = mc.movie_id AND rt.id = ci.role_id AND t.production_year > 2005 AND cn.id = mc.company_id AND...
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.country_code = '[us]' AND n.gender = 'f' AND t.id = ci.movie_id AND n....
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 it1.id = mi_idx.info_type_id AND mi.movie_id = mi_idx.movie_id AND it2...
job
SELECT total_revenue, s_name, s_suppkey, s_phone, s_address FROM supplier, revenue0 WHERE total_revenue = ( SELECT MAX(total_revenue) FROM revenue0 ) AND s_suppkey = supplier_no ORDER BY s_suppkey
tpch
SELECT MIN(n.name) AS voicing_actress, MIN(t.title) AS voiced_movie FROM aka_name AS an, char_name AS chn, cast_info AS ci, company_name AS cn, info_type AS it, movie_companies AS mc, movie_info AS mi, name AS n, role_type AS rt, title AS t WHERE t.id = mc.movie_id AND ci.note IN ('(voice)', '(voice: Japanese version)'...
job
SELECT MIN(t.title) AS movie_title FROM company_name AS cn, keyword AS k, movie_companies AS mc, movie_keyword AS mk, title AS t WHERE mc.movie_id = mk.movie_id AND k.keyword ='character-name-IN-title' AND cn.country_code ='[nl]' AND cn.id = mc.company_id AND mc.movie_id = t.id AND mk.keyword_id = k.id AND t.id = mk.mo...
job
SELECT i_item_id, SUM(ss_quantity) AS store_sales_quantity, s_store_name, SUM(cs_quantity) AS catalog_sales_quantity, i_item_desc, s_store_id, SUM(sr_return_quantity) AS store_returns_quantity 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(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 (mc.note LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%') AND...
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 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 p_type = 1 ) as all_n...
tpch
SELECT COUNT(1) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v, users AS u WHERE p.AnswerCount >= 0 AND p.Id = ph.PostId AND p.PostTypeId = 1 AND u.Id = p.OwnerUserId AND p.Id = v.PostId AND p.Id = c.PostId AND p.Id = pl.PostId
stats
SELECT MIN(mc.note) AS production_note, MIN(t.title) AS movie_title, MIN(t.production_year) AS movie_year FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info_idx AS mi_idx, title AS t WHERE t.id = mi_idx.movie_id AND (mc.note LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%') AND it.info =...
job
SELECT c_salutation, ss_ticket_number, c_preferred_cust_flag, c_last_name, c_first_name, cnt FROM ( SELECT ss_ticket_number, ss_customer_sk, COUNT(*) AS cnt FROM store_sales INNER JOIN date_dim ON ss_sold_date_sk = d_date_sk INNER JOIN store ON ss_store_sk = s_store_sk INNER JOIN household_demographics ON ss_hdemo_sk =...
tpcds
SELECT 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 p_mfgr, s_comment, s_address, p_partkey, s_name, s_phone, s_acctbal, n_name FROM part, supplier, partsupp, nation, region WHERE p_partkey = ps_partkey AND s_suppkey = ps_suppkey AND p_size = 1 AND p_type LIKE 1 AND s_nationkey = n_nationkey AND n_regionkey = r_regionkey AND r_name = 1 AND ps_supplycost = ( SELEC...
tpch
SELECT MIN(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 = mi.movie_id AND t.id = at.movie_id AND mi.movie_id = mc.movie_i...
job
SELECT AVG(sr_return_quantity) AS store_returns_quantityave, COUNT(cs_quantity) AS catalog_sales_quantitycount, STDDEV_SAMP(sr_return_quantity) / AVG(sr_return_quantity) AS store_returns_quantitycov, i_item_desc, STDDEV_SAMP(ss_quantity) AS store_sales_quantitystdev, i_item_id, AVG(ss_quantity) AS store_sales_quantitya...
tpcds
SELECT i_item_id, i_item_desc, s_store_id, s_store_name, MAX(ss_net_profit) AS store_sales_profit, MAX(sr_net_loss) AS store_returns_loss, MAX(cs_net_profit) AS catalog_sales_profit FROM store_sales JOIN store_returns ON store_sales.ss_customer_sk = store_returns.sr_customer_sk AND store_sales.ss_item_sk = store_return...
tpcds
SELECT MIN(mi_idx.info) AS rating, MIN(cn.name) AS movie_company, 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 l_linestatus, SUM(l_extendedprice) AS sum_base_price, COUNT(*) AS count_order, AVG(l_extendedprice) AS avg_price, AVG(l_discount) AS avg_disc, SUM(l_quantity) AS sum_qty, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, l_returnflag, ...
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.movie_id = mi_idx.movie_id AND at.movie_id = mc.movie_id AND t.id =...
job
SELECT MIN(an.name) AS acress_pseudonym, MIN(t.title) AS japanese_anime_movie FROM aka_name AS an, cast_info AS ci, company_name AS cn, company_type AS ct, keyword AS k, movie_companies AS mc, movie_keyword AS mk, name AS n, role_type AS rt, title AS t WHERE an.person_id = n.id AND mk.movie_id = mc.movie_id AND t.produ...
job
select o_year, sum( case when nation = 1 then volume else 0 end ) / sum(volume) as mkt_share from ( select EXTRACT(YEAR from o_orderdate) as o_year, l_extendedprice * (1 - l_discount) as volume, n2.n_name as nation from part, supplier, lineitem, orders, customer, nation n1, nation n2, region where n1.n_regionkey = r_re...
tpch
SELECT n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, supplier, nation, region WHERE l_suppkey = s_suppkey AND c_custkey = o_custkey AND c_nationkey = s_nationkey AND r_name = 1 AND n_regionkey = r_regionkey AND s_nationkey = n_nationkey AND o_orderdate >= DATE 1 AND l_order...
tpch
SELECT AVG(ss_coupon_amt) AS agg3, AVG(ss_list_price) AS agg2, AVG(ss_sales_price) AS agg4, AVG(ss_quantity) AS agg1, 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 SUM(amount) AS sum_profit, o_year, 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 ps_suppkey = l_suppkey AND p_partkey = l_partkey AND s_suppke...
tpch
with ss as ( select i_manufact_id, sum(ss_ext_sales_price) as total_sales from store_sales join date_dim on ss_sold_date_sk = d_date_sk join customer_address on ss_addr_sk = ca_address_sk join item on ss_item_sk = i_item_sk where i_category = ANY(ARRAY['Home']) AND d_year = 2002 AND d_moy = 1 AND ca_gmt_offset = -5 gro...
tpcds
SELECT SUM(amount) AS sum_profit, nation, o_year FROM ( SELECT n_name AS nation, EXTRACT(YEAR FROM o_orderdate) AS o_year, l_extendedprice * (1 - l_discount) - ps_supplycost * l_quantity AS amount FROM part, supplier, lineitem, partsupp, orders, nation WHERE s_suppkey = l_suppkey AND ps_partkey = l_partkey AND ps_suppk...
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 p_type, COUNT(DISTINCT ps_suppkey) AS supplier_cnt, p_size, p_brand FROM partsupp, part WHERE p_size IN (1, 1, 1, 1, 1, 1, 1, 1) AND p_brand <> 1 AND ps_suppkey NOT IN ( SELECT s_suppkey FROM supplier WHERE s_comment LIKE '%Customer%Complaints%' ) AND p_partkey = ps_partkey AND p_type NOT LIKE 1 GROUP BY p_brand...
tpch
SELECT supp_nation, l_year, cust_nation, SUM(volume) AS revenue FROM ( SELECT n1.n_name AS supp_nation, n2.n_name AS cust_nation, EXTRACT(YEAR FROM l_shipdate) AS l_year, l_extendedprice * (1 - l_discount) AS volume FROM supplier, lineitem, orders, customer, nation n1, nation n2 WHERE ( (n1.n_name = 1 AND n2.n_name = 1...
tpch
SELECT MIN(t.title) AS american_movie FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info AS mi, title AS t WHERE mc.movie_id = mi.movie_id AND t.id = mi.movie_id AND t.id = mc.movie_id AND ct.kind = 'production companies' AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND it.id = mi...
job
SELECT MAX(mi_idx.info) AS rating, MAX(t.title) AS movie_title FROM info_type AS it, movie_info_idx AS mi_idx, title AS t WHERE it.info ='rating' AND it.id = mi_idx.info_type_id AND mi_idx.info > '8.0' AND t.production_year BETWEEN 2000 AND 2005 AND t.id = mi_idx.movie_id
job
SELECT c_last_name, c_preferred_cust_flag, c_first_name, ss_ticket_number, cnt, c_salutation FROM ( SELECT ss_ticket_number, ss_customer_sk, COUNT(*) AS cnt FROM store_sales JOIN date_dim ON ss_sold_date_sk = d_date_sk JOIN store ON ss_store_sk = s_store_sk JOIN household_demographics ON ss_hdemo_sk = hd_demo_sk WHERE ...
tpcds
SELECT SUM( 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_receiptdate >= DATE 1 AND l_shipmode IN (1...
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 mi.movie_id = t.id AND mc.movie_id = t.id AND c...
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 ci.movie_id = mk.movie_id AND t.id = mk.movie_id AND k.keyword = 'marvel-cinematic-universe' AND n.name LIKE '%Hemsworth%Chris%' AND t.prod...
job
SELECT MIN(t.title) AS movie_title FROM company_name AS cn, keyword AS k, movie_companies AS mc, movie_keyword AS mk, title AS t WHERE mc.movie_id = t.id AND k.keyword ='character-name-in-title' AND mk.keyword_id = k.id AND cn.id = mc.company_id AND cn.country_code ='[sm]' AND mc.movie_id = mk.movie_id AND t.id = mk.mo...
job
Select l_orderkey, Sum(l_extendedprice * (1 - l_discount)) As revenue, o_orderdate, o_shippriority From customer, orders, lineitem Where c_mktsegment = 1 AND l_orderkey = o_orderkey AND c_custkey = o_custkey AND o_orderdate < DATE 1 AND l_shipdate > DATE 1 Group By l_orderkey, o_orderdate, o_shippriority Order By reven...
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 AVG(ss_quantity), AVG(ss_ext_sales_price), SUM(ss_ext_wholesale_cost), AVG(ss_ext_wholesale_cost) FROM store_sales JOIN store ON s_store_sk = ss_store_sk JOIN customer_demographics ON cd_demo_sk = ss_cdemo_sk JOIN household_demographics ON hd_demo_sk = ss_hdemo_sk JOIN customer_address ON ca_address_sk = ss_addr...
tpcds
SELECT MIN(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 it1.info = 'rating' AND it1.id = mi_idx.info_type_id AND mi.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.id = an.person_id AND (n.gender = 'm' OR (n.gender = 'f' AND n.name LIKE 'B%')) AND lt.link = 'features' AND pi.note...
job
SELECT COUNT(1) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v, users AS u WHERE p.Id = ph.PostId AND p.PostTypeId = 1 AND p.Id = v.PostId AND u.Id = p.OwnerUserId AND p.Id = pl.PostId AND p.AnswerCount >= 0 AND p.Id = c.PostId
stats
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_partkey = ps_partkey AND p_type NOT LIKE 1 AND p_size = ANY(ARRAY[1, 1, 1, 1, 1, 1, 1, 1]) AND p_brand <> 1 GROUP B...
tpch
SELECT s_acctbal, p_mfgr, n_name, p_partkey, s_name, s_address, s_phone, s_comment FROM part, supplier, partsupp, nation, region WHERE p_partkey = ps_partkey AND s_suppkey = ps_suppkey AND p_size = 1 AND p_type LIKE 1 AND s_nationkey = n_nationkey AND n_regionkey = r_regionkey AND r_name = 1 AND ps_supplycost = ( SELEC...
tpch
select s_phone, s_name, s_acctbal, s_comment, p_mfgr, p_partkey, n_name, s_address from part, supplier, partsupp, nation, region where p_partkey = ps_partkey and s_suppkey = ps_suppkey and p_size = 1 and p_type like 1 and s_nationkey = n_nationkey and n_regionkey = r_regionkey and r_name = 1 and ps_supplycost = ( selec...
tpch
With _q As ( Select c_count, Count(*) As custdist From ( Select c_custkey, Count(o_orderkey) As c_count From customer Left Outer 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 Desc, c_count Desc ) Select * From _q;
tpch
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('2002-01-23' AS DATE) AND (CAST('2002-01-23' AS DATE) + INTERVAL '60 days') AND i_manufact_id = ANY(ARRAY[148...
tpcds
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', 'Denish', 'Norwegian', 'German') and k.keyword like '%sequel%' and t.production_year > 2005 and k.id = mk.keyword_id and t.id = mk.movie_id and t...
job
SELECT s_phone, s_suppkey, s_name, total_revenue, s_address FROM supplier, revenue0 WHERE s_suppkey = supplier_no AND total_revenue = ( SELECT MAX(total_revenue) FROM revenue0 ) ORDER BY s_suppkey
tpch
WITH _q AS ( SELECT COUNT(*) FROM comments AS c, votes AS v, users AS u WHERE u.Reputation >= 1 AND u.Id = c.UserId AND c.CreationDate >= '2010-08-10 17:55:45'::timestamp AND u.Id = v.UserId ) SELECT * FROM _q;
stats
SELECT COUNT(*) FROM comments AS c, posts AS p, votes AS v, users AS u WHERE u.Id = p.OwnerUserId AND p.ViewCount >= 0 AND c.Score = 0 AND u.Id = v.UserId AND u.Id = c.UserId AND p.Score >= 0 LIMIT 200;
stats
select count(distinct ps_suppkey) as supplier_cnt, p_brand, p_type, p_size from partsupp, part where p_partkey = ps_partkey AND p_size in (1, 1, 1, 1, 1, 1, 1, 1) AND NOT EXISTS (SELECT 1 FROM (select s_suppkey from supplier where s_comment like '%Customer%Complaints%') AS _ne WHERE _ne.ps_suppkey = ps_suppkey) AND p_b...
tpch
SELECT COUNT(*) FROM votes AS v, posts AS p, badges AS b, users AS u WHERE u.Id = b.UserId AND p.Score <= 22 AND u.Id = p.OwnerUserId AND u.Reputation >= 1 AND p.Id = v.PostId LIMIT 1000;
stats
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 cn.country_code = '[de]' And it2.info = 'releas...
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 mc.company_id = cn.id AND t.episode_nr < 100 AND t.id = mc.movie_id AND an.person_id = ci.p...
job
SELECT total_revenue, s_suppkey, s_phone, s_address, s_name FROM supplier, revenue0 WHERE s_suppkey = supplier_no AND total_revenue = ( SELECT MIN(total_revenue) FROM revenue0 ) ORDER BY s_suppkey
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.id = mk.keyword_id AND mk.movie_id = mi.movie_id AND k.keyword Like '%sequel%' AND t.production_year > 2000 AND t.id = mk.movie_id AND t.id = mi.movie_id AND mi.info = ANY(ARRAY['Sweden', 'Norway', 'Germany',...
job
select ps_partkey, sum(ps_supplycost * ps_availqty) as VALUE from partsupp, supplier, nation where n_name = 1 and ps_suppkey = s_suppkey and s_nationkey = n_nationkey 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 i_item_id, AVG(cs_quantity) AS agg1, AVG(cs_list_price) AS agg2, AVG(cs_coupon_amt) AS agg3, AVG(cs_sales_price) AS agg4 FROM catalog_sales JOIN customer_demographics ON cs_bill_cdemo_sk = cd_demo_sk JOIN date_dim ON cs_sold_date_sk = d_date_sk JOIN item ON cs_item_sk = i_item_sk JOIN promotion ON cs_promo_sk = ...
tpcds
SELECT MIN(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 = an.person_id AND it.info = 'mini biography' AND it.id = pi.info_type_id AND lt.id = ml.link_type_id AND pi.note...
job
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_partkey = ps_partkey AND p_type NOT LIKE 1 AND p_size IN (1, 1, 1, 1, 1, 1, 1, 1) GROUP BY p_brand...
tpch
SELECT MAX(t.title) AS movie_title FROM keyword AS k, movie_info AS mi, movie_keyword AS mk, title AS t WHERE mi.info IN ('Sweden', 'Norway', 'Germany', 'Danish', 'Swedish', 'Danish', 'Norwegian', 'German') AND t.production_year > 2010 AND t.id = mi.movie_id AND k.id = mk.keyword_id AND mk.movie_id = mi.movie_id AND t....
job
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 r_name = 1 AND s_nationkey = n_nationkey AND o_orderdate >= DATE 1 AND c_custkey = o_custke...
tpch
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 l1.l_receiptdate > l1.l_commitdate AND o_orderstatus = 'F' AND n_name = 1 AND s_nat...
tpch
SELECT AVG(ss_quantity), AVG(ss_ext_sales_price), AVG(ss_ext_wholesale_cost), SUM(ss_ext_wholesale_cost) FROM store_sales JOIN store ON s_store_sk = ss_store_sk JOIN customer_demographics ON cd_demo_sk = ss_cdemo_sk JOIN household_demographics ON hd_demo_sk = ss_hdemo_sk JOIN customer_address ON ca_address_sk = ss_addr...
tpcds
SELECT MIN(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 = an.person_id AND an.person_id = ci.person_id AND pi.person_id = an.person_id AND t.production_year BETWEEN 1980...
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 t.production_year > 2010 AND k.keyword = 'marvel-cinematic-universe' AND t.id = mk.movie_id AND n.id = ...
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 l_orderkey = o_orderk...
tpch
SELECT AVG(l_extendedprice) AS avg_price, AVG(l_quantity) AS avg_qty, l_linestatus, AVG(l_discount) AS avg_disc, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, COUNT(*) AS count_order, SUM(l_extendedprice) AS sum_base_price, l_returnflag, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, ...
tpch
SELECT MIN(t.title) AS biography_movie, MIN(n.name) AS of_person 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 pi.person_id = an.person_id AND lt.id = ml.link_type_id AND pi.person_id = ci....
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 (mc.note LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%') AND ct.i...
job
SELECT COUNT(1) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v, users AS u WHERE p.Id = v.PostId AND p.Id = c.PostId AND p.Id = ph.PostId AND p.PostTypeId = 1 AND u.Id = p.OwnerUserId AND p.Id = pl.PostId AND p.AnswerCount >= 0
stats
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 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(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.id = t.kind_id AND it2.id = mi.info_type_id AND at.title LIKE '%Cha...
job
WITH _q AS ( 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 mc.note Not Like '%(As Metr...
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 ps_suppkey not in ( select s_suppkey from supplier where s_comment like '%Customer%Complaints%' ) and p_partkey = ps_partkey and p_type not like 1 and p_brand <> 1 group by p_brand...
tpch
SELECT o_shippriority, o_orderdate, l_orderkey, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem WHERE c_mktsegment = 1 AND l_orderkey = o_orderkey AND l_shipdate > DATE 1 AND c_custkey = o_custkey AND o_orderdate < DATE 1 GROUP BY l_orderkey, o_orderdate, o_shippriority ORDER BY reven...
tpch
SELECT c_custkey, c_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue, c_acctbal, n_name, c_address, c_phone, c_comment FROM customer, orders, lineitem, nation WHERE c_custkey = o_custkey AND l_returnflag = 'R' AND o_orderdate < DATE 1 + INTERVAL '3' MONTH AND o_orderdate >= DATE 1 AND c_nationkey = n_nationkey ...
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 t.id = ci.movie_id AND n.id = ci.person_id AND k.id = mk.keyword_id AND n.name LIKE '%Downey%Robert%' AND k.k...
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 mi.movie_id = mi_idx.movie_id AND t.id = at.movie_id AND t.id = mi_idx...
job
select i_item_id, s_store_name, s_store_id, sum(cs_quantity) as catalog_sales_quantity, sum(ss_quantity) as store_sales_quantity, i_item_desc, sum(sr_return_quantity) as store_returns_quantity 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 s_acctbal, s_name, n_name, p_partkey, p_mfgr, s_address, s_phone, s_comment FROM part, supplier, partsupp, nation, region WHERE p_partkey = ps_partkey AND s_suppkey = ps_suppkey AND n_regionkey = r_regionkey AND p_type LIKE 1 AND r_name = 1 AND p_size = 1 AND s_nationkey = n_nationkey AND ps_supplycost = ( SELEC...
tpch
Select Min(t.title) As movie_title From company_name As cn, keyword As k, movie_companies As mc, movie_keyword As mk, title As t Where mk.keyword_id = k.id AND cn.id = mc.company_id AND mc.movie_id = t.id AND cn.country_code ='[de]' AND k.keyword ='character-name-In-title' AND mc.movie_id = mk.movie_id AND t.id = mk.mo...
job
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.Id = c.PostId AND p.Id = v.PostId AND p.AnswerCount >= 0 AND p.Id = pl.PostId AND u.Id = p.OwnerUserId
stats
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 cn.id = mc.company_id AND ci.movie_id = mc.movie_id AND an.person_id = n....
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.info = 'top 250 rank' AND it.id = mi_idx.info_type_id AND ct.id = mc.company_type_id AND mc.movie_id = ...
job
SELECT MIN(t.title) AS movie_title, MIN(t.production_year) AS movie_year, MIN(mc.note) AS production_note FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info_idx AS mi_idx, title AS t WHERE mc.movie_id = mi_idx.movie_id AND it.id = mi_idx.info_type_id AND ct.id = mc.company_type_id AND mc.note N...
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 mk.movie_id = mi.movie_id AND k.keyword LIKE '%sequel%' AND t.production_year > 2000 AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Denmar...
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 mc.company_id = cn.id AND an.person_id = ci.person_id AND t.id = mk.movie_id AND cn.country...
job
select count(*) from comments as c, posts as p, postLinks as pl, votes as v where c.PostId = pl.PostId AND v.VoteTypeId = 2 AND c.CreationDate >= '2010-08-02 23:52:10'::timestamp AND pl.PostId = v.PostId AND p.Id = c.PostId AND p.Score >= -3 LIMIT 500;
stats
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.movie_id = mi.movie_id AND t.id = mi.movie_id AND mi.movie_id = mi_...
job
SELECT c_first_name, cnt, c_salutation, c_preferred_cust_flag, c_last_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