text
stringlengths
84
1.49k
benchmark
stringclasses
4 values
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 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_commitdate <...
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 o_orderdate < DATE 1 + INTERVAL '1' YEAR AND n_regionkey = r_regionkey AND l_orderkey = o_orderkey AND c_nationkey = s_nationkey AND s_nationkey = n_nationkey AND o...
tpch
WITH _q AS ( SELECT p_brand, p_type, p_size, COUNT(DISTINCT ps_suppkey) AS supplier_cnt 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 ps_suppkey NOT IN ( SELECT s_suppkey FROM supplier WHERE s_comment LIKE '%Customer%Complaints%' ) AND p_brand <> 1 GRO...
tpch
SELECT MIN(mi.info) AS release_date, MIN(miidx.info) AS rating, MIN(t.title) AS german_movie FROM company_name AS cn, company_type AS ct, info_type AS it, info_type AS it2, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS miidx, title AS t WHERE it2.info = 'release dates' AND kt.id = t.kind_i...
job
SELECT p_type, COUNT(DISTINCT ps_suppkey) AS supplier_cnt, p_brand, p_size 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 min(t.production_year) as movie_year, min(t.title) as movie_title, min(mc.note) as production_note from company_type as ct, info_type as it, movie_companies as mc, movie_info_idx as mi_idx, title as t where ct.id = mc.company_type_id AND t.id = mc.movie_id AND (mc.note like '%(co-production)%' or mc.note like '%...
job
SELECT MIN(mc.note) AS production_note, MIN(t.title) AS movie_title, MIN(t.production_year) AS movie_year FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info_idx AS mi_idx, title AS t WHERE ct.id = mc.company_type_id AND it.info = 'top 250 rank' AND mc.note NOT LIKE '%(AS Metro-Goldwyn-Mayer Pic...
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 t.id = mc.movie_id AND it.info = 'top 250 rank'...
job
SELECT n_name, c_custkey, c_address, c_comment, c_phone, c_acctbal, SUM(l_extendedprice * (1 - l_discount)) AS revenue, 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 SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, SUM(l_extendedprice) AS sum_base_price, l_returnflag, SUM(l_quantity) AS sum_qty, AVG(l_quantity) AS avg_qty, AVG(l_discount) AS avg_disc, COUNT(1) AS count_order, l_linestatus, AVG(l_extendedprice) AS avg_price, SUM(l_extendedprice * (1 - l_discount) * ...
tpch
SELECT s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE EXISTS ( SELECT * FROM lineitem l2 WHERE l2.l_orderkey = l1.l_orderkey AND l2.l_suppkey <> l1.l_suppkey ) AND s_nationkey = n_nationkey AND o_orderstatus = 'F' AND s_suppkey = l1.l_suppkey AND o_orderkey = l1.l_orderkey AND n_name = 1 A...
tpch
WITH _q AS ( 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.id = mk.movie_id AND ci.movie_id = mk.movie_id AND t.production_year > 2010 AND k.keywor...
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 t.id = mk.movie_id AND k.keyword Like '%sequel%' AND mk.movie_id = mi.movie_id AND t.production_year > 2005 AND k.id = mk.keyword_id AND mi.info = ANY(ARRAY['Sweden', 'Norway', 'Germany',...
job
SELECT MAX(t.title) AS movie_title FROM keyword AS k, movie_info AS mi, movie_keyword AS mk, title AS t WHERE t.id = mk.movie_id AND mk.movie_id = mi.movie_id AND k.keyword LIKE '%sequel%' AND t.id = mi.movie_id AND k.id = mk.keyword_id AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Danish', 'Swedish', 'Danish', 'Norw...
job
WITH year_total AS ( SELECT c_first_name AS customer_first_name, SUM(((ss_ext_list_price - ss_ext_wholesale_cost - ss_ext_discount_amt) + ss_ext_sales_price) / 2) AS year_total, c_login AS customer_login, 's' AS sale_type, c_customer_id AS customer_id, c_birth_country AS customer_birth_country, c_last_name AS customer_...
tpcds
SELECT dt.d_year, item.i_brand_id AS brand_id, SUM(ss_ext_sales_price) AS ext_price, 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 dt.d_year = 2002 AND item.i_manager_id = 57 AND dt.d_moy = 12 GROUP BY ...
tpcds
Select Min(t.title) As movie_title From keyword As k, movie_info As mi, movie_keyword As mk, title As t Where t.id = mi.movie_id AND k.keyword Like '%sequel%' AND t.id = mk.movie_id AND mk.movie_id = mi.movie_id AND t.production_year > 2005 AND mi.info In ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Denish', ...
job
WITH _q AS ( SELECT COUNT(*) FROM comments AS c, postHistory AS ph, badges AS b, votes AS v, users AS u WHERE v.UserId = c.UserId AND b.UserId = ph.UserId AND ph.PostHistoryTypeId = 12 AND ph.UserId = v.UserId AND u.Id = b.UserId AND u.UpVotes = 0 ) SELECT * FROM _q;
stats
SELECT nation, o_year, SUM(amount) AS sum_profit FROM ( SELECT n_name AS nation, EXTRACT(YEAR FROM o_orderdate) AS o_year, l_extendedprice * (1 - l_discount) - ps_supplycost * l_quantity AS amount FROM part, supplier, lineitem, partsupp, orders, nation WHERE o_orderkey = l_orderkey AND s_suppkey = l_suppkey AND p_partk...
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.production_year > 2005 AND ci.note LIKE '%(uncredited)%' AND rt.role = 'actor' AND cn.country_code...
job
with year_total as ( select c_birth_country as customer_birth_country, c_preferred_cust_flag as customer_preferred_cust_flag, c_email_address as customer_email_address, c_customer_id as customer_id, 's' as sale_type, d_year as dyear, c_first_name as customer_first_name, c_login as customer_login, c_last_name as custome...
tpcds
Select Count(1) From comments As c, posts As p, users As u Where u.Id = p.OwnerUserId And p.CommentCount >= 0 And c.CreationDate >= '2010-08-05 00:36:02'::timestamp And p.FavoriteCount >= 0 And c.UserId = u.Id And p.ViewCount >= 0
stats
SELECT MIN(an1.name) AS actress_pseudonym, MIN(t.title) AS japanese_movie_dubbed FROM aka_name AS an1, cast_info AS ci, company_name AS cn, movie_companies AS mc, name AS n1, role_type AS rt, title AS t WHERE mc.note LIKE '%(Japan)%' AND ci.movie_id = t.id AND t.id = mc.movie_id AND n1.name LIKE '%Yo%' AND ci.role_id =...
job
SELECT MIN(t.title) AS movie_title, MIN(mi_idx.info) AS rating FROM info_type AS it, movie_info_idx AS mi_idx, title AS t WHERE t.id = mi_idx.movie_id AND mi_idx.info > '8.0' AND it.info ='rating' AND it.id = mi_idx.info_type_id AND t.production_year BETWEEN 2000 AND 2005
job
select count(*) from votes as v, posts as p, badges as b, users as u where p.Id = v.PostId and u.Reputation >= 1 and u.Id = p.OwnerUserId and p.Score <= 22 and u.Id = b.UserId
stats
SELECT supp_nation, SUM(volume) AS revenue, cust_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_custkey = o_custkey AND s_nation...
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.id = mc.company_type_id AND t.id = mi_idx.movie_id AND it.info = 'top 250 rank' AND it.id = mi_idx.info...
job
SELECT COUNT(*) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v, badges AS b WHERE p.Id = pl.RelatedPostId AND pl.LinkTypeId = 1 AND c.Score = 0 AND b.UserId = c.UserId AND p.Id = ph.PostId AND p.Id = v.PostId AND p.Id = c.PostId
stats
SELECT i_item_id, AVG(cs_sales_price) AS agg4, AVG(cs_coupon_amt) AS agg3, AVG(cs_list_price) AS agg2, 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
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 b.UserId = c.UserId AND p.Id = c.PostId AND c.Score = 0 AND pl.LinkTypeId = 1 ) SELECT * FROM _q AND p.Id = v.PostId AND p.Id = pl.RelatedPostId AND p.Id = ph.PostId
stats
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 it.info = 'top 250 rank' AND mc.movie_id = mi_idx.movie_id AND (mc.note LIKE '%(co-production)%' OR mc.not...
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 = t.id AND mc.company_id = cn.id AND t.episode_nr >= 50 AND ci.movie_id = mk.mo...
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 chn.id = ci.person_role_id AND ci.person_id = an.person_id AND t.producti...
job
WITH year_total AS ( SELECT c_last_name AS customer_last_name, d_year AS dyear, c_birth_country AS customer_birth_country, c_customer_id AS customer_id, c_preferred_cust_flag AS customer_preferred_cust_flag, 's' AS sale_type, c_first_name AS customer_first_name, c_login AS customer_login, c_email_address AS customer_em...
tpcds
SELECT s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE s_suppkey = l1.l_suppkey AND l1.l_receiptdate > l1.l_commitdate AND s_nationkey = n_nationkey AND o_orderkey = l1.l_orderkey AND NOT EXISTS ( SELECT * FROM lineitem l3 WHERE l3.l_orderkey = l1.l_orderkey AND l3.l_suppkey <> l1.l_suppkey...
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 an1.person_id = n1.id AND ci.movie_id = t.id AND ci.note = '(voice: English version)' AND n1.id = ci.person_id ...
job
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 ci.movie_id = mk.movie_id AND t.production_year > 2010 AND k.keyword = 'marvel-cinematic-universe' AND k.id = mk.key...
job
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 mi.info IN ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Danish', 'Norwegian', 'German') AND t.id = mi.movie_id AND k.id = mk.keyword_id AND t.production_year > 2000 AND k...
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 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.info = 'release dates' AND t.id = mc.movie_i...
job
SELECT * FROM ( SELECT AVG(ss_list_price) AS b1_lp, COUNT(ss_list_price) AS b1_cnt, COUNT(DISTINCT ss_list_price) AS b1_cntd FROM store_sales WHERE (ss_list_price BETWEEN 77 AND 77 + 10 OR ss_coupon_amt BETWEEN 1614 AND 1614 + 1000 OR ss_wholesale_cost BETWEEN 88 AND 88 + 20) ) AS b3 AND (ss_list_price BETWEEN 28 AND 2...
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 MIN(n.name) AS of_person, MIN(t.title) AS biography_movie FROM aka_name AS an, cast_info AS ci, info_type AS it, link_type AS lt, movie_link AS ml, name AS n, person_info AS pi, title AS t WHERE pi.person_id = ci.person_id AND an.name LIKE '%a%' AND (n.gender = 'm' OR (n.gender = 'f' AND n.name LIKE 'B%')) AND t...
job
SELECT COUNT(DISTINCT ps_suppkey) AS supplier_cnt, p_brand, p_size, p_type FROM partsupp, part WHERE p_partkey = ps_partkey AND p_brand <> 1 AND ps_suppkey NOT IN ( SELECT s_suppkey FROM supplier WHERE s_comment LIKE '%Customer%Complaints%' ) AND p_type NOT LIKE 1 AND p_size IN (1, 1, 1, 1, 1, 1, 1, 1) GROUP BY p_brand...
tpch
SELECT i_current_price, i_item_id, i_item_desc FROM item JOIN inventory ON i_item_sk = inv_item_sk JOIN date_dim ON d_date_sk = inv_date_sk JOIN store_sales ON ss_item_sk = i_item_sk WHERE i_manufact_id IN (116, 70, 371, 438) AND inv_quantity_on_hand BETWEEN 100 AND 500 AND i_current_price BETWEEN 73 AND 73 + 30 AND d_...
tpcds
SELECT s_acctbal, s_name, s_address, s_phone, p_mfgr, p_partkey, n_name, s_comment FROM part, supplier, partsupp, nation, region WHERE n_regionkey = r_regionkey AND p_partkey = ps_partkey AND s_suppkey = ps_suppkey AND ps_supplycost = ( SELECT MIN(ps_supplycost) FROM partsupp, supplier, nation, region WHERE p_partkey =...
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 n.gender = 'f' AND mc.note LIKE '%(USA)%' AND cn.country_code = '[us]' AN...
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 t.id = mi.movie_id AND t.id = mc.movie_id AND mc.movie_id = mi.movie_id AND ct.kind = 'production companies' AND it.id = mi.info_type_id AND mc.note NO...
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 s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE s_suppkey = l1.l_suppkey AND NOT EXISTS ( SELECT * FROM lineitem l3 WHERE l3.l_orderkey = l1.l_orderkey AND l3.l_suppkey <> l1.l_suppkey AND l3.l_receiptdate > l3.l_commitdate ) AND o_orderkey = l1.l_orderkey AND o_orderstatus = 'F' AND...
tpch
Select s_acctbal, s_name, n_name, p_partkey, p_mfgr, s_address, s_phone, s_comment From part, supplier, partsupp, nation, region Where p_type Like 1 And p_size = 1 And s_suppkey = ps_suppkey And p_partkey = ps_partkey And s_nationkey = n_nationkey And r_name = 1 And n_regionkey = r_regionkey And ps_supplycost = ( Selec...
tpch
SELECT MIN(mc.note) AS production_note, MIN(t.title) AS movie_title, MIN(t.production_year) AS movie_year FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info_idx AS mi_idx, title AS t WHERE ct.kind = 'production companies' AND ct.id = mc.company_type_id AND mc.movie_id = mi_idx.movie_id AND t.id...
job
WITH _q AS ( 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.keyword LIKE '%sequel%' AND t.production_year > 2005 AND k.id = mk.keyword_id AND t.id = mi.movie_id AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedi...
job
WITH year_total AS ( SELECT c_customer_id AS customer_id, c_preferred_cust_flag AS customer_preferred_cust_flag, c_email_address AS customer_email_address, c_birth_country AS customer_birth_country, c_last_name AS customer_last_name, d_year AS dyear, c_first_name AS customer_first_name, SUM(((ss_ext_list_price - ss_ext...
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 + INTERVAL '1' YEAR A...
tpch
SELECT p_brand, p_type, p_size, COUNT(DISTINCT ps_suppkey) AS supplier_cnt FROM partsupp, part WHERE ps_suppkey NOT IN ( SELECT s_suppkey FROM supplier WHERE s_comment LIKE '%Customer%Complaints%' ) AND p_brand != 1 AND p_size IN (1, 1, 1, 1, 1, 1, 1, 1) AND p_partkey = ps_partkey AND p_type NOT LIKE 1 GROUP BY p_brand...
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 cn.id = mc.company_id AND t.production_year > 1990 AND k.keyw...
job
SELECT MAX(t.title) AS movie_title FROM company_name AS cn, keyword AS k, movie_companies AS mc, movie_keyword AS mk, title AS t WHERE mk.keyword_id = k.id AND mc.movie_id = mk.movie_id AND t.id = mk.movie_id AND k.keyword ='character-name-in-title' AND cn.id = mc.company_id AND mc.movie_id = t.id AND cn.country_code =...
job
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 LIMIT 1000;
tpch
SELECT MIN(t.title) AS movie_title FROM company_name AS cn, keyword AS k, movie_companies AS mc, movie_keyword AS mk, title AS t WHERE cn.country_code ='[nl]' AND mc.movie_id = mk.movie_id AND k.keyword ='character-name-in-title' AND mc.movie_id = t.id AND t.id = mk.movie_id AND cn.id = mc.company_id AND mk.keyword_id ...
job
SELECT MIN(t.title) AS american_movie FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info AS mi, title AS t WHERE mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND ct.id = mc.company_type_id AND t.id = mc.movie_id AND it.info = 'bottom 10 rank' AND it.id = mi.info_type_id AND t.id = mi....
job
SELECT s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE s_suppkey = l1.l_suppkey AND EXISTS ( SELECT * FROM lineitem l2 WHERE l2.l_orderkey = l1.l_orderkey AND l2.l_suppkey != l1.l_suppkey ) AND o_orderstatus = 'F' AND NOT EXISTS ( SELECT * FROM lineitem l3 WHERE l3.l_orderkey = l1.l_orderke...
tpch
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 k.keyword IN ('sequel', 'revenge', ...
job
SELECT COUNT(*) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v, users AS u WHERE p.Id = pl.PostId AND p.PostTypeId = 1 AND p.AnswerCount >= 0 AND p.Id = ph.PostId AND p.Id = v.PostId AND p.Id = c.PostId AND u.Id = p.OwnerUserId
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 n.id = ci.person_id AND k.id = mk.keyword_id AND t.id = ci.movie_id AND k.keyword = 'marvel-cinematic-universe...
job
SELECT p_size, COUNT(DISTINCT ps_suppkey) AS supplier_cnt, p_brand, p_type FROM partsupp, part WHERE p_size IN (1, 1, 1, 1, 1, 1, 1, 1) AND p_partkey = ps_partkey AND p_brand <> 1 AND ps_suppkey NOT IN ( SELECT s_suppkey FROM supplier WHERE s_comment LIKE '%Customer%Complaints%' ) AND p_type NOT LIKE 1 GROUP BY p_brand...
tpch
WITH _q AS ( 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 c...
tpcds
Select p_brand, p_type, p_size, Count(Distinct ps_suppkey) As supplier_cnt From partsupp, part Where p_type Not Like 1 And p_size = ANY(ARRAY[1, 1, 1, 1, 1, 1, 1, 1]) And p_brand <> 1 And p_partkey = ps_partkey And ps_suppkey Not In ( Select s_suppkey From supplier Where s_comment Like '%Customer%Complaints%' ) Group B...
tpch
SELECT o_orderdate, o_shippriority, SUM(l_extendedprice * (1 - l_discount)) AS revenue, l_orderkey FROM customer, orders, lineitem WHERE c_mktsegment = 1 AND c_custkey = o_custkey AND l_orderkey = o_orderkey AND o_orderdate < DATE 1 AND l_shipdate > DATE 1 GROUP BY l_orderkey, o_orderdate, o_shippriority ORDER BY reven...
tpch
SELECT MIN(t.title) AS western_violent_movie, MIN(mi_idx.info) AS rating, MIN(cn.name) AS movie_company FROM company_name AS cn, company_type AS ct, info_type AS it1, info_type AS it2, keyword AS k, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS mi_idx, movie_keyword AS mk, title AS t WHERE...
job
SELECT 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 = mc.movie_id AND ci.movie_id = t.id AND an.person_id = n.id AND mk.keyword_id = k.id ...
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 >= 2000 AND t.production_year <= 2010 AND mi_idx.info > '7.0' AND t.id = mi_idx.movie_id AND it.info ='rating' AND it.id = mi_idx.info_type_id
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 k.keyword ='character-name-IN-title' AND cn.id = mc.company_id AND mc.movie_id = mk.movie_id AND cn.country_code ='[de]' AND t.id = mk.movie_id AND mc.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 mk.movie_id = mi.movie_id and t.production_year > 2005 and t.id = mk.movie_id and mi.info in ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Denish', 'Norwegian', 'German') and k.id = mk.keyword_id and k...
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 it.info = 'top ...
job
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 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_size IN (1, 1, 1, 1, 1, 1, 1, 1) AND p_type NOT LIKE 1 AND p_partkey = ps_partkey GROUP BY p_brand...
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 chn.id = ci.person_role_id AND an.person_id = n.id AND t.production_year ...
job
SELECT ss_ticket_number, c_last_name, c_first_name, c_preferred_cust_flag, 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 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.id = mc.company_id AND mc.movie_id = mk.movie_id AND t.id = mk.movie_id AND cn.country_code ='[nl]' AND k.keyword ='character-name-in-title' AND mk.keyword_id ...
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 i_item_id, i_item_desc, s_store_id, s_store_name, MIN(ss_net_profit) AS store_sales_profit, MIN(sr_net_loss) AS store_returns_loss, MIN(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 count(*) from comments as c, posts as p, users as u where u.Id = p.OwnerUserId and c.CreationDate >= '2010-08-05 00:36:02'::timestamp and p.CommentCount >= 0 and c.UserId = u.Id and p.FavoriteCount >= 0 and p.ViewCount >= 0
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.name_pcode_cf BETWEEN 'A' AND 'F' AND an.name LIKE '%a%' AND t.id = ci.movie_id AND pi.person_id = an.person_id AND ...
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 ci.note like '%(voice)%' and ci.note like '%(uncredited)%' and cn.country_code = '[ru]' and rt.role ...
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 o_orderkey = l_orderkey AND p_name LIKE 1 ) AS profit AND s_s...
tpch
SELECT MIN(mc.note) AS production_note, MIN(t.production_year) AS movie_year, MIN(t.title) AS movie_title FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info_idx AS mi_idx, title AS t WHERE (mc.note LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%') AND it.info = 'top 250 rank' AND it.id =...
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 it1.id = mi_idx.info_type_id AND t.i...
job
SELECT COUNT(1) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v WHERE c.Score = 0 AND p.Id = ph.PostId AND p.Id = pl.PostId AND p.Id = v.PostId AND pl.LinkTypeId = 1 AND p.Id = c.PostId AND p.FavoriteCount >= 0
stats
select count(*) as custdist, c_count 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 ASC, c_count ASC LIMIT 20;
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 it1.id = mi_idx.info_type_id AND mi_idx.i...
job
SELECT SUM(sr_return_quantity) AS store_returns_quantity, i_item_id, i_item_desc, s_store_name, SUM(cs_quantity) AS catalog_sales_quantity, SUM(ss_quantity) AS store_sales_quantity, s_store_id FROM store_sales JOIN store_returns ON ss_customer_sk = sr_customer_sk AND ss_item_sk = sr_item_sk AND ss_ticket_number = sr_ti...
tpcds
SELECT n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, supplier, nation, region WHERE r_name = 1 AND l_suppkey = s_suppkey AND s_nationkey = n_nationkey AND l_orderkey = o_orderkey AND n_regionkey = r_regionkey AND c_custkey = o_custkey AND c_nationkey = s_nationkey AND o_ord...
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 mc.note LIKE '%(USA)%' AND n.id = ci.person_id AND it.info = 'release dat...
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.production_year > 2010 AND t.id = mk.movie_id AND k.keyword like '%sequel%' AND k.id = mk.keyword_id AND mk.movie_id = mi.movie_id AND t.id = mi.movie_id AND mi.info in ('Sweden', 'Norway', 'Germany', 'Danish...
job
SELECT s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE 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 > l3.l_commitdate ) AND s_nationkey = n_nationkey AND EXISTS ( SELECT * FROM lineit...
tpch
SELECT c_preferred_cust_flag, c_first_name, ss_ticket_number, cnt, c_last_name, 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 AVG(ss_quantity) AS agg1, i_item_id, AVG(ss_sales_price) AS agg4, AVG(ss_coupon_amt) AS agg3, 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_sk = p_promo...
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 it.id = mi.info_type_id AND it.info = 'bottom 10 rank' AND ct.id = mc.company_type_id AND t.id = mi.movie_id AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND mc.movie_i...
job