text
stringlengths
84
1.49k
benchmark
stringclasses
4 values
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 k.id = mk.keyword_id AND t.id = mi.movie_id AND mi.info in ('Sweden', 'Norway', 'Germany', 'Danish', 'Swedish', 'Danish', 'Norwegian', 'German') AND t.id = mk.movie_id AND k.keywor...
job
SELECT SUM(l_extendedprice) AS sum_base_price, SUM(l_quantity) AS sum_qty, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, AVG(l_discount) AS avg_disc, AVG(l_extendedprice) AS avg_price, AVG(l_quantity) AS avg_qty, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, COUNT(*) AS count_order, ...
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 k.keyword ='character-name-In-title' And cn.id = mc.company_id And cn.country_code ='[de]' And t.id = mk.movie_id And mk.keyword_id = k.id And mc.movie_id = mk.mo...
job
WITH _q AS ( select avg(ss_coupon_amt) as agg3, avg(ss_quantity) as agg1, i_item_id, avg(ss_sales_price) as agg4, avg(ss_list_price) as agg2 from store_sales join customer_demographics on ss_cdemo_sk = cd_demo_sk join date_dim on ss_sold_date_sk = d_date_sk join item on ss_item_sk = i_item_sk join promotion on ss_promo...
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 ci.role_id = rt.id And ci.note = '(voice: English version)' And mc.company_id = cn.id And t.id = mc.movie_id An...
job
Select i_brand_id As brand_id, i_brand As brand, i_manufact, Sum(ss_ext_sales_price) As ext_price, i_manufact_id From date_dim Join store_sales On d_date_sk = ss_sold_date_sk Join item On ss_item_sk = i_item_sk Join customer On ss_customer_sk = c_customer_sk Join customer_address On c_current_addr_sk = ca_address_sk Jo...
tpcds
SELECT CAST(promotions AS DECIMAL(15, 4)) / CAST(total AS DECIMAL(15, 4)) * 100, promotions, total 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 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 COUNT(*) FROM comments AS c, posts AS p, votes AS v, users AS u WHERE p.Score >= 0 AND p.ViewCount >= 0 AND u.Id = p.OwnerUserId AND u.Id = c.UserId AND c.Score = 0 AND u.Id = v.UserId LIMIT 20;
stats
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 c_custkey = o_custkey And o_orderdate < DATE 1 And c_mktsegment = 1 And l_orderkey = o_orderkey Group By l_orderkey, o_orderdate, o_shippriority Order By reven...
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 t.id = mk.movie_id and mk.keyword_id = k.id and cn.country_code ='[nl]' and mc.movie_id = mk.movie_id and mc.movie_id = t.id and k.keyword ='character-name-in-title' and cn.id = mc.comp...
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 ci.movie_id = mk.movie_id AND ci.movie_id = t.id AND k.keyword = 'character-name-in-title' ...
job
Select Count(*) From comments As c, posts As p, postLinks As pl, postHistory As ph, votes As v Where p.FavoriteCount >= 0 AND c.Score = 0 AND p.Id = ph.PostId AND p.Id = c.PostId AND p.Id = pl.PostId AND pl.LinkTypeId = 1 AND p.Id = v.PostId
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 k.keyword ='character-name-in-title' AND t.id = mk.movie_id AND mc.movie_id = t.id AND cn.country_code ='[sm]' AND mc.movie_id = mk.movie_id AND mk.keyword_id = k.id AND cn.id = mc.comp...
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 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 AVG(ss_list_price) AS agg2, AVG(ss_sales_price) AS agg4, i_item_id, AVG(ss_coupon_amt) AS agg3, 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 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 an1.person_id = n1.id AND n1.id = ci.person_id AND n1.name LIKE '%Yo%' AND ci.movie_id = mc.movie_id AND mc.not...
job
SELECT ca_city, list_price, c_first_name, c_last_name, bought_city, extended_tax, ss_ticket_number, extended_price FROM ( SELECT ss_ticket_number, ss_customer_sk, ca_city AS bought_city, SUM(ss_ext_sales_price) AS extended_price, SUM(ss_ext_list_price) AS list_price, SUM(ss_ext_tax) AS extended_tax FROM store_sales JOI...
tpcds
SELECT MIN(mi.info) AS release_date, MIN(t.title) AS german_movie, MIN(miidx.info) AS rating 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.id = mc.company_id AND kt.id = t.kind_id AND...
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 n.gender = 'f' AND cn.country_code = '[jp]' AND mk.movie_id =...
job
select ps_partkey, sum(ps_supplycost * ps_availqty) as VALUE from partsupp, supplier, nation where s_nationkey = n_nationkey AND n_name = 1 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 MIN(chn.name) AS uncredited_voiced_character, MIN(t.title) AS russian_movie FROM char_name AS chn, cast_info AS ci, company_name AS cn, company_type AS ct, movie_companies AS mc, role_type AS rt, title AS t WHERE cn.id = mc.company_id AND ci.movie_id = mc.movie_id AND rt.id = ci.role_id AND t.id = ci.movie_id AN...
job
SELECT total_revenue, s_phone, s_suppkey, s_address, s_name FROM supplier, revenue0 WHERE total_revenue = ( SELECT MAX(total_revenue) FROM revenue0 ) AND s_suppkey = supplier_no ORDER BY s_suppkey
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 t.id = mk.movie_id And mc.note Not Like '%(USA)%' And k.keywo...
job
SELECT MIN(an1.name) AS actress_pseudonym, MIN(t.title) AS japanese_movie_dubbed FROM aka_name AS an1, cast_info AS ci, company_name AS cn, movie_companies AS mc, name AS n1, role_type AS rt, title AS t WHERE rt.role = 'actress' AND mc.note NOT LIKE '%(USA)%' AND n1.name LIKE '%Yo%' AND ci.note = '(voice: English versi...
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 cn.id = mc.company_id AND cn.country_code = '[jp]' AND k.id =...
job
SELECT MIN(mc.note) AS production_note, MIN(t.title) AS movie_title, MIN(t.production_year) AS movie_year FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info_idx AS mi_idx, title AS t WHERE ct.kind = 'production companies' AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND t.id = mi_...
job
Select Count(*) From comments As c, posts As p, postLinks As pl, postHistory As ph, votes As v, badges As b Where b.UserId = c.UserId AND p.Id = pl.RelatedPostId AND p.Id = ph.PostId AND p.Id = c.PostId AND c.Score = 0 AND p.Id = v.PostId AND pl.LinkTypeId = 1
stats
SELECT COUNT(*) FROM comments AS c, votes AS v, badges AS b, users AS u WHERE u.CreationDate >= '2010-07-20 01:27:29'::timestamp AND u.Id = v.UserId AND u.Id = b.UserId AND c.Score = 1 AND u.Id = c.UserId LIMIT 100;
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 rt.role = 'actor' AND t.production_year > 2005 AND t.id = mc.movie_id AND cn.id = mc.company_id AND ...
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 t.id = mk.movie_id AND cn.id = mc.company_id AND mk.keyword_id = k.id AND cn.country_code ='[nl]' AND k.keyword ='character-name-in-title' AND mc.movie_id ...
job
SELECT s_acctbal, s_comment, s_name, p_partkey, n_name, s_address, s_phone, p_mfgr 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 c_last_name, bought_city, ca_city, extended_price, c_first_name, ss_ticket_number, list_price, extended_tax 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 s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE l1.l_receiptdate > l1.l_commitdate AND s_suppkey = l1.l_suppkey AND s_nationkey = n_nationkey AND n_name = 1 AND NOT EXISTS ( SELECT * FROM lineitem l3 WHERE l3.l_orderkey = l1.l_orderkey AND l3.l_suppkey <> l1.l_suppkey AND l3.l_receip...
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 MAX(cn.name) AS movie_company, MAX(mi_idx.info) AS rating, MAX(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(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 ct.kind = 'production companies' AND it.id = mi_idx.info_type_id AND ct.id = mc.company_type_id AND (mc.no...
job
SELECT c_first_name, c_last_name, bought_city, ss_ticket_number, list_price, ca_city, extended_tax, extended_price FROM ( SELECT ss_ticket_number, ss_customer_sk, ca_city AS bought_city, SUM(ss_ext_sales_price) AS extended_price, SUM(ss_ext_list_price) AS list_price, SUM(ss_ext_tax) AS extended_tax FROM store_sales JOI...
tpcds
SELECT MIN(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 t.production_year > 2010 AND mk.movie_id = mi.movie_id AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Danish', 'Swedish', 'Danish', 'Norwegian', 'German') AND t.id = mk.movie_id A...
job
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 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_orderkey = o_orderkey AND c_nationkey = n_nationkey AND l_returnflag = 'R' AND o_orderdate >= DATE 1 AND o_orderdate < ...
tpch
Select Count(*) From comments As c, posts As p, postLinks As pl, postHistory As ph, votes As v Where p.Id = pl.PostId AND p.Id = v.PostId AND p.Id = c.PostId AND pl.LinkTypeId = 1 AND p.Id = ph.PostId AND p.FavoriteCount >= 0 AND c.Score = 0
stats
WITH _q AS ( SELECT cust_nation, supp_nation, SUM(volume) AS revenue, l_year FROM ( SELECT n1.n_name AS supp_nation, n2.n_name AS cust_nation, EXTRACT(YEAR FROM l_shipdate) AS l_year, l_extendedprice * (1 - l_discount) AS volume FROM supplier, lineitem, orders, customer, nation n1, nation n2 WHERE c_nationkey = n2.n_na...
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 it1.info = 'rating' AND kt.kind = 'm...
job
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 >= DATE 1 And l...
tpch
SELECT SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, AVG(l_quantity) AS avg_qty, l_linestatus, COUNT(1) AS count_order, l_returnflag, AVG(l_extendedprice) AS avg_price, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, SUM(l_quantity) AS sum_qty, AVG(l_discount) AS avg_disc, SUM(l_extend...
tpch
SELECT SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, l_returnflag, l_linestatus, AVG(l_quantity) AS avg_qty, AVG(l_extendedprice) AS avg_price, SUM(l_quantity) AS sum_qty, COUNT(1) AS count_order, AVG(l_discount) AS avg_disc, SUM(l_extendedprice) AS sum_base_price, SUM(l_extendedprice * (1 - l_discount) * ...
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 mi.note LIKE '%internet%' AND lt.id...
job
SELECT COUNT(1) FROM votes AS v, users AS u WHERE u.DownVotes = 0 AND v.UserId = u.Id;
stats
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 k.keyword = 'character-name-In-title' And t.episode_nr >= 50 A...
job
SELECT SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, SUM(l_extendedprice) AS sum_base_price, COUNT(*) AS count_order, AVG(l_extendedprice) AS avg_price, SUM(l_quantity) AS sum_qty, l_linestatus, l_returnflag, AVG(l_discount) AS avg_disc, AVG(l_quantity) AS avg_qty, SUM(l_extendedprice * (1 - l_discount) * ...
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 k.id = mk.keyword_id AND k.keyword ...
job
SELECT nation, o_year, SUM(amount) AS sum_profit FROM ( SELECT n_name AS nation, EXTRACT(YEAR FROM o_orderdate) AS o_year, l_extendedprice * (1 - l_discount) - ps_supplycost * l_quantity AS amount FROM part, supplier, lineitem, partsupp, orders, nation WHERE ps_partkey = l_partkey AND p_name LIKE 1 ) AS profit AND s_na...
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_orderkey = o_orderkey AND c_nationkey = s_nationkey AND n_regionkey = r_regionkey AND c_custkey = o_custkey AND o_orderdate < DATE 1 + INTERVAL '1' YEAR AND l...
tpch
Select Min(an1.name) As actress_pseudonym, Min(t.title) As japanese_movie_dubbed From aka_name As an1, cast_info As ci, company_name As cn, movie_companies As mc, name As n1, role_type As rt, title As t Where ci.movie_id = mc.movie_id AND mc.note Like '%(Japan)%' AND an1.person_id = ci.person_id AND n1.id = ci.person_i...
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 lt.id = ml.link_type_id AND pi.note = 'Volker Boehm' AND ci.movie_id = ml.linked_movie_id AND t.id = ci.movie_id AND 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 t.id = mi.movie_id AND k.keyword LIKE '%sequel%' AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Danish', 'Swedish', 'Danish', 'Norwegian', 'German') AND t.id = mk.movie_id AND k.id = mk.keyword_id AND t.produc...
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 t.id = mk.movie_id AND an.person_id = n.id AND an.person_id = ci.person_id AND mk.keyword_i...
job
SELECT c_last_name, c_first_name, c_salutation, c_preferred_cust_flag, ss_ticket_number, cnt FROM ( SELECT ss_ticket_number, ss_customer_sk, COUNT(*) AS cnt FROM store_sales 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 l_shipmode, sum( case when o_orderpriority = '1-URGENT' or o_orderpriority = '2-HIGH' then 1 else 0 end ) as high_line_count, sum( case when o_orderpriority <> '1-URGENT' and o_orderpriority <> '2-HIGH' then 1 else 0 end ) as low_line_count from orders, lineitem where l_receiptdate >= DATE 1 AND l_shipmode in (1...
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.production_year > 2000 AND at.title LIKE '%Champion%' AND kt.id = t....
job
SELECT p_type, p_size, COUNT(DISTINCT ps_suppkey) AS supplier_cnt, p_brand FROM partsupp, part WHERE p_partkey = ps_partkey AND p_type NOT LIKE 1 AND 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%' ) GROUP BY p_brand...
tpch
SELECT supp_nation, cust_nation, l_year, SUM(volume) AS revenue FROM ( SELECT n1.n_name AS supp_nation, n2.n_name AS cust_nation, EXTRACT(YEAR FROM l_shipdate) AS l_year, l_extendedprice * (1 - l_discount) AS volume FROM supplier, lineitem, orders, customer, nation n1, nation n2 WHERE ( (n1.n_name = 1 AND n2.n_name = 1...
tpch
select i_item_desc, i_current_price, i_item_id 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_current_price between 80 and 80 + 30 and d_date between CAST('2002-01-23' as DATE) and (CAST('2002-01-23' as DA...
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 it.id = mi.info_type_id AND k.keywo...
job
SELECT c_first_name, c_preferred_cust_flag, c_salutation, c_last_name, cnt, ss_ticket_number 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 MIN(t.title) AS american_movie FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info AS mi, title AS t WHERE (mc.note LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%') AND ct.kind = 'production companies' AND ct.id = mc.company_type_id AND it.id = mi.info_type_id AND mc.movie_id = mi...
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 o_orderkey = l_orderkey AND c_cust...
tpch
WITH _q AS ( SELECT o_orderpriority, COUNT(1) AS order_count FROM orders WHERE o_orderdate < DATE 1 + INTERVAL '3' MONTH AND o_orderdate >= DATE 1 AND EXISTS ( SELECT * FROM lineitem WHERE l_orderkey = o_orderkey AND l_commitdate < l_receiptdate ) GROUP BY o_orderpriority ORDER BY o_orderpriority ) SELECT * FROM _q;
tpch
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 >= DATE 1 AND l...
tpch
SELECT MIN(t.title) AS movie_title FROM keyword AS k, movie_info AS mi, movie_keyword AS mk, title AS t WHERE t.production_year > 2000 AND t.id = mk.movie_id AND k.keyword LIKE '%sequel%' AND mi.info = ANY(ARRAY['Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Danish', 'Norwegian', 'German']) AND mk.movie_id = mi....
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 mi_idx.info > '8.0' AND it.id = mi_idx.info_type_id AND t.id = mi_idx.movie_id AND t.production_year >= 2000 AND t.production_year <= 2005 AND it.info ='rating' LIMIT 500;
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.keyword like '%sequel%' AND k.id = mk.keyword_id AND mi.info = ANY(ARRAY['Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Denish', 'Norwegian', 'German']) AND mk.movie_id = mi.movi...
job
Select o_totalprice, o_orderkey, c_custkey, Sum(l_quantity), o_orderdate, c_name From customer, orders, lineitem Where o_orderkey In ( Select l_orderkey From lineitem Group By l_orderkey Having Sum(l_quantity) > 1 ) And c_custkey = o_custkey And o_orderkey = l_orderkey Group By c_name, c_custkey, o_orderkey, o_orderdat...
tpch
Select 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_year = 2000 And item.i_manager_id = 69 And dt.d_moy = 11 Group By ...
tpcds
SELECT COUNT(cs_quantity) AS catalog_sales_quantitycount, STDDEV_SAMP(sr_return_quantity) / AVG(sr_return_quantity) AS store_returns_quantitycov, COUNT(ss_quantity) AS store_sales_quantitycount, AVG(sr_return_quantity) AS store_returns_quantityave, STDDEV_SAMP(sr_return_quantity) AS store_returns_quantitystdev, COUNT(s...
tpcds
SELECT MIN(t.title) AS movie_title, MIN(mc.note) AS production_note, 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 t.id = mi_idx.movie_id AND (mc.note LIKE '%(co-...
job
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 c_nationkey = n2.n_nationkey AND o...
tpch
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 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 n_regionkey = r_regionkey AND s_nationkey = n_nationkey AND r_name = 1 AND p_size = 1 AND s_suppkey = ps_suppkey AND p_type LIKE 1 AND ps_supplycost = ( SELEC...
tpch
select count(*) from postHistory as ph, posts as p, users as u, badges as b where p.OwnerUserId = u.Id and ph.UserId = u.Id and ph.PostHistoryTypeId = 3 and u.Reputation >= 1 and p.Score >= -7 and u.Id = b.UserId
stats
SELECT o_orderdate, o_totalprice, SUM(l_quantity), o_orderkey, c_name, 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 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.production_year > 2005 and mk.movie_id = mi.movie_id and t.id = mk.movie_id and k.keyword like '%sequel%' and t.id = mi.movie_id and mi.info in ('Sweden', 'Norway', 'Germany', 'Denmar...
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.info LIKE 'USA:%200%' AND mi_idx.info < '3.5' AND mi_idx.movie_id =...
job
SELECT MIN(t.title) AS movie_title FROM keyword AS k, movie_info AS mi, movie_keyword AS mk, title AS t WHERE mi.info IN ('Sweden', 'Norway', 'Germany', 'Danish', 'Swedish', 'Danish', 'Norwegian', 'German') AND k.id = mk.keyword_id AND t.id = mi.movie_id AND k.keyword LIKE '%sequel%' AND t.production_year > 2010 AND mk...
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 i_current_price BETWEEN 77 AND 77 + 30 AND d_date BETWEEN CAST('2001-07-13' AS DATE) AND (CAST('2001-07-13' AS DATE) + INTERVAL '...
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 cn.country_code = '[us]' AND kt.id = t.kind_id AND at.movie_id = mi_id...
job
SELECT AVG(cs_coupon_amt) AS agg3, AVG(cs_sales_price) AS agg4, AVG(cs_quantity) AS agg1, AVG(cs_list_price) AS agg2, i_item_id 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 COUNT(1) AS count_order, l_linestatus, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, SUM(l_extendedprice) AS sum_base_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, l_returnflag, AVG(l_discount) AS avg_disc, AVG(l_e...
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 mc.note NOT LIKE '%(USA)%' AND t.id = ci.movie_id AND mc.note...
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 cn.id = mc.company_id And mc.movie_id = mk.movie_id And t.id = mk.movie_id And cn.country_code ='[sm]' And mc.movie_id = t.id And k.keyword ='character-name-In-...
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 l_receiptda...
tpch
SELECT o_orderkey, SUM(l_quantity), o_orderdate, o_totalprice, c_name, 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 o_orderpriority, COUNT(*) AS order_count FROM orders WHERE EXISTS ( SELECT * FROM lineitem WHERE l_orderkey = o_orderkey AND l_commitdate < l_receiptdate ) AND o_orderdate < DATE 1 + INTERVAL '3' MONTH AND o_orderdate >= DATE 1 GROUP BY o_orderpriority ORDER BY o_orderpriority LIMIT 20;
tpch
SELECT MIN(mc.note) AS production_note, MIN(t.title) AS movie_title, MIN(t.production_year) AS movie_year FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info_idx AS mi_idx, title AS t WHERE t.id = mi_idx.movie_id AND it.info = 'top 250 rank' AND (mc.note LIKE '%(co-production)%' OR mc.note LIKE ...
job
SELECT nation, o_year, SUM(amount) AS sum_profit FROM ( SELECT n_name AS nation, EXTRACT(YEAR FROM o_orderdate) AS o_year, l_extendedprice * (1 - l_discount) - ps_supplycost * l_quantity AS amount FROM part, supplier, lineitem, partsupp, orders, nation WHERE ps_suppkey = l_suppkey AND p_name LIKE 1 ) AS profit AND ps_p...
tpch
select ps_partkey, sum(ps_supplycost * ps_availqty) as VALUE from partsupp, supplier, nation where ps_suppkey = s_suppkey and s_nationkey = n_nationkey and n_name = 1 group by ps_partkey having sum(ps_supplycost * ps_availqty) > ( select sum(ps_supplycost * ps_availqty) * 1 from partsupp, supplier, nation where ps_supp...
tpch
SELECT COUNT(*) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v, users AS u WHERE p.Id = c.PostId AND p.AnswerCount >= 0 AND p.Id = ph.PostId AND p.PostTypeId = 1 AND u.Id = p.OwnerUserId AND p.Id = pl.PostId AND p.Id = v.PostId
stats
SELECT i_item_desc, i_item_id, COUNT(ss_quantity) AS store_sales_quantitycount, s_state, STDDEV_SAMP(sr_return_quantity) AS store_returns_quantitystdev, STDDEV_SAMP(cs_quantity) / AVG(cs_quantity) AS catalog_sales_quantitycov, STDDEV_SAMP(ss_quantity) / AVG(ss_quantity) AS store_sales_quantitycov, STDDEV_SAMP(ss_quanti...
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 mc.note not like '%(USA)%' AND k.keyword = 'anime' AND an.per...
job