text
stringlengths
84
1.49k
benchmark
stringclasses
4 values
SELECT p_brand, p_size, p_type, COUNT(DISTINCT ps_suppkey) AS supplier_cnt FROM partsupp, part WHERE p_partkey = ps_partkey AND ps_suppkey NOT IN ( SELECT s_suppkey FROM supplier WHERE s_comment LIKE '%Customer%Complaints%' ) AND p_type NOT LIKE 1 AND p_size IN (1, 1, 1, 1, 1, 1, 1, 1) AND p_brand <> 1 GROUP BY p_brand...
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 min(mi_idx.info) as rating, min(t.title) as northamerican_movie from aka_title as at, company_name as cn, info_type as it1, info_type as it2, kind_type as kt, movie_companies as mc, movie_info as mi, movie_info_idx as mi_idx, title as t where t.id = mc.movie_id and it2.id = mi.info_type_id and it1.info = 'rating...
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 k.keyword ='character-name-in-title' AND t.id = mk.movie_id AND cn.id = mc.company_id AND mk.keyword_id = k.id AND mc.movie_id = t.id AND mc.movie_id = mk.movie_id AND cn.country_code =...
job
SELECT SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, AVG(l_extendedprice) AS avg_price, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, l_returnflag, SUM(l_quantity) AS sum_qty, AVG(l_quantity) AS avg_qty, SUM(l_extendedprice) AS sum_base_price, AVG(l_discount) AS avg_disc, COUNT(*) AS...
tpch
SELECT STDDEV_SAMP(sr_return_quantity) AS store_returns_quantitystdev, STDDEV_SAMP(ss_quantity) AS store_sales_quantitystdev, STDDEV_SAMP(sr_return_quantity) / AVG(sr_return_quantity) AS store_returns_quantitycov, STDDEV_SAMP(ss_quantity) / AVG(ss_quantity) AS store_sales_quantitycov, i_item_id, COUNT(sr_return_quantit...
tpcds
SELECT c_last_name, bought_city, extended_price, list_price, c_first_name, extended_tax, ss_ticket_number, ca_city FROM ( SELECT ss_ticket_number, ss_customer_sk, ca_city AS bought_city, SUM(ss_ext_sales_price) AS extended_price, SUM(ss_ext_list_price) AS list_price, SUM(ss_ext_tax) AS extended_tax FROM store_sales JOI...
tpcds
SELECT 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 t.id = mk.movie_id AND k.keyword LIKE '%sequel%' AND mi.info = ANY(ARRAY['Sweden', 'Norway', 'Germany', 'Danish', 'Swedish', 'Danish...
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 cn.id = mc.company_id AND mc.movie_id = mk.movie_id AND mk.keyword_id = k.id AND t.id = mk.movie_id AND mc.movie_id = t.id AND k.keyword ='character-name-in-title' AND cn.country_code =...
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 cn.country_code ='[sm]' AND k.keyword ='character-name-IN-title' AND mc.movie_id = mk.movie_id AND cn.id = mc.company_id AND t.id = mk.movie_id AND mk.keyword_id = k.id AND mc.movie_id ...
job
select n_name, sum(l_extendedprice * (1 - l_discount)) as revenue from customer, orders, lineitem, supplier, nation, region where o_orderdate >= DATE 1 AND l_suppkey = s_suppkey AND c_custkey = o_custkey AND o_orderdate < DATE 1 + INTERVAL '1' YEAR AND l_orderkey = o_orderkey AND c_nationkey = s_nationkey AND r_name = ...
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 = mk.movie_id AND t.id = mk.movie_id AND cn.id = mc.company_id AND k.keyword ='character-name-in-title' AND mk.keyword_id = k.id AND cn.country_code ='[nl]' AND mc.movie_id ...
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 ( (n1.n_name = 1 AND n2.n_name = 1...
tpch
SELECT MIN(t.title) AS movie_title FROM keyword AS k, movie_info AS mi, movie_keyword AS mk, title AS t WHERE k.keyword LIKE '%sequel%' AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Danish', 'Swedish', 'Danish', 'Norwegian', 'German') AND k.id = mk.keyword_id AND t.id = mk.movie_id AND t.production_year > 2010 AND t....
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 r_name = 1 And p_type...
tpch
SELECT MIN(mc.note) AS production_note, MIN(t.title) AS movie_title, MIN(t.production_year) AS movie_year FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info_idx AS mi_idx, title AS t WHERE (mc.note LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%') AND it.info = 'top 250 rank' AND it.id =...
job
SELECT MIN(an.name) AS cool_actor_pseudonym, MIN(t.title) AS series_named_after_char FROM aka_name AS an, cast_info AS ci, company_name AS cn, keyword AS k, movie_companies AS mc, movie_keyword AS mk, name AS n, title AS t WHERE n.id = ci.person_id AND t.id = mk.movie_id AND mc.company_id = cn.id AND an.person_id = ci....
job
SELECT STDDEV_SAMP(ss_quantity) / AVG(ss_quantity) AS store_sales_quantitycov, STDDEV_SAMP(cs_quantity) / AVG(cs_quantity) AS catalog_sales_quantitycov, i_item_id, COUNT(sr_return_quantity) AS store_returns_quantitycount, i_item_desc, s_state, COUNT(cs_quantity) AS catalog_sales_quantitycount, COUNT(ss_quantity) AS sto...
tpcds
SELECT o_orderpriority, COUNT(1) AS order_count FROM orders WHERE o_orderdate >= DATE 1 AND o_orderdate < DATE 1 + INTERVAL '3' MONTH AND EXISTS ( SELECT * FROM lineitem WHERE l_orderkey = o_orderkey AND l_commitdate < l_receiptdate ) GROUP BY o_orderpriority ORDER BY o_orderpriority LIMIT 200;
tpch
SELECT i_item_id, s_store_id, SUM(ss_quantity) AS store_sales_quantity, s_store_name, i_item_desc, SUM(sr_return_quantity) AS store_returns_quantity, SUM(cs_quantity) AS catalog_sales_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 COUNT(*) FROM comments AS c, posts AS p, users AS u WHERE p.CommentCount >= 0 AND p.FavoriteCount >= 0 AND p.ViewCount >= 0 AND c.CreationDate >= '2010-08-05 00:36:02'::timestamp AND u.Id = p.OwnerUserId AND c.UserId = u.Id LIMIT 500;
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 ps_suppkey = l_suppkey AND p_partkey = l_partkey AND p_name L...
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 l_shipdate BETWEEN DATE '1995-01-0...
tpch
SELECT MIN(t.title) AS german_movie, MIN(mi.info) AS release_date, 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 miidx.movie_id = mc.movie_id AND kt.id = t.kind...
job
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 p_partkey = l_partkey AND ps_suppkey = l_suppkey AND p_name l...
tpch
SELECT COUNT(1) FROM comments AS c, posts AS p, postHistory AS ph, votes AS v, users AS u WHERE c.UserId = p.OwnerUserId AND u.Id = c.UserId AND p.Score <= 13 AND ph.UserId = v.UserId AND p.AnswerCount >= 0 AND p.OwnerUserId = ph.UserId
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 it.id = mi_idx.info_type_id AND mc.movie_id = mi_idx.movie_id AND mc.note NOT L...
job
SELECT p_size, COUNT(DISTINCT ps_suppkey) AS supplier_cnt, p_brand, p_type FROM partsupp, part WHERE 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 AND ps_suppkey NOT IN ( SELECT s_suppkey FROM supplier WHERE s_comment LIKE '%Customer%Complaints%' ) GROUP BY p_brand...
tpch
SELECT l_orderkey, o_shippriority, SUM(l_extendedprice * (1 - l_discount)) AS revenue, o_orderdate FROM customer, orders, lineitem WHERE c_mktsegment = 1 AND o_orderdate < DATE 1 AND l_shipdate > DATE 1 AND c_custkey = o_custkey 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 keyword as k, movie_info as mi, movie_keyword as mk, title as t where t.production_year > 2000 and t.id = mi.movie_id and k.id = mk.keyword_id and mk.movie_id = mi.movie_id and k.keyword like '%sequel%' and mi.info in ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Danish'...
job
SELECT SUM( CASE WHEN nation = 1 THEN volume ELSE 0 END ) / SUM(volume) AS mkt_share, o_year 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 c_nationkey = n1.n_na...
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 n.id = ci.person_id AND t.id = ci.movie_id AND n.name LIKE '%Hemsworth%Chris%' AND t.production_year > 2010 AND k.keyword = 'marvel-cinemat...
job
SELECT AVG(l_discount) AS avg_disc, l_linestatus, l_returnflag, SUM(l_quantity) AS sum_qty, COUNT(*) AS count_order, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, AVG(l_extendedprice) AS avg_price, SUM(l_extendedprice) AS sum_base_price, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, ...
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 t.id = ci.movie_id AND n.name LIKE '%Hemsworth%Chris%' AND t.production_year > 2010 AND ci.movie_id = mk.movie_id AND n.id = ci.person_id A...
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 = ci.movie_id AND rt.id = ci.role_id AND rt.role = 'actor' AND t.id = mc.movie_id AND t.product...
job
SELECT c_name, c_comment, SUM(l_extendedprice * (1 - l_discount)) AS revenue, c_address, n_name, c_acctbal, c_phone, c_custkey FROM customer, orders, lineitem, nation WHERE c_custkey = o_custkey AND l_orderkey = o_orderkey AND o_orderdate >= DATE 1 AND o_orderdate < DATE 1 + INTERVAL '3' MONTH AND l_returnflag = 'R' AN...
tpch
SELECT c_last_name, ca_city, ss_ticket_number, c_first_name, bought_city, extended_price, 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 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 t.id = mk.movie_id AND cn.id = mc.company_id AND mc.movie_id = mk.movie_id AND k.keyword ='character-name-in-title' AND mk.keyword_id = k.id AND cn.country_code =...
job
select l_shipmode, sum( case when o_orderpriority = '1-URGENT' or o_orderpriority = '2-HIGH' then 1 else 0 end ) as high_line_count, sum( case when o_orderpriority <> '1-URGENT' and o_orderpriority <> '2-HIGH' then 1 else 0 end ) as low_line_count from orders, lineitem where l_shipmode in (1, 1) AND o_orderkey = l_orde...
tpch
WITH year_total AS ( SELECT d_year AS dyear, 's' AS sale_type, c_email_address AS customer_email_address, c_birth_country AS customer_birth_country, c_preferred_cust_flag AS customer_preferred_cust_flag, c_login AS customer_login, SUM(((ss_ext_list_price - ss_ext_wholesale_cost - ss_ext_discount_amt) + ss_ext_sales_pri...
tpcds
Select Avg(cs_quantity) As catalog_sales_quantityave, STDDEV_SAMP(sr_return_quantity) / Avg(sr_return_quantity) As store_returns_quantitycov, 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_quantity) As stor...
tpcds
SELECT MIN(t.title) AS russian_movie, MIN(chn.name) AS uncredited_voiced_character FROM char_name AS chn, cast_info AS ci, company_name AS cn, company_type AS ct, movie_companies AS mc, role_type AS rt, title AS t WHERE t.id = ci.movie_id AND ci.movie_id = mc.movie_id AND ct.id = mc.company_type_id AND rt.id = ci.role_...
job
select min(k.keyword) as movie_keyword, min(n.name) as actor_name, min(t.title) as marvel_movie from cast_info as ci, keyword as k, movie_keyword as mk, name as n, title as t where k.id = mk.keyword_id AND t.id = mk.movie_id AND n.id = ci.person_id AND t.production_year > 2010 AND n.name like '%Downey%Robert%' AND k.ke...
job
SELECT c_acctbal, SUM(l_extendedprice * (1 - l_discount)) AS revenue, c_comment, c_phone, n_name, c_custkey, c_address, c_name FROM customer, orders, lineitem, nation WHERE o_orderdate < DATE 1 + INTERVAL '3' MONTH AND c_custkey = o_custkey AND c_nationkey = n_nationkey AND o_orderdate >= DATE 1 AND l_orderkey = o_orde...
tpch
SELECT AVG(cs_list_price) AS agg2, AVG(cs_quantity) AS agg1, i_item_id, AVG(cs_coupon_amt) AS agg3, AVG(cs_sales_price) AS agg4 FROM catalog_sales JOIN customer_demographics ON cs_bill_cdemo_sk = cd_demo_sk JOIN date_dim ON cs_sold_date_sk = d_date_sk JOIN item ON cs_item_sk = i_item_sk JOIN promotion ON cs_promo_sk = ...
tpcds
SELECT MIN(t.title) AS 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 (mc.note LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%') AND it.id = mi.info_type_id AND t.id = mc.movie_id AND mc.note NOT LIKE '%(AS Metro-Go...
job
SELECT COUNT(*) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v, badges AS b WHERE pl.LinkTypeId = 1 AND p.Id = pl.RelatedPostId AND p.Id = ph.PostId AND b.UserId = c.UserId AND p.Id = v.PostId AND c.Score = 0 AND p.Id = c.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 ct.kind = 'production companies' AND t.id = mc.movie_id AND ct.id = mc.company_type_id AND mc.movie_id = m...
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 cn.id = mc.company_id AND t.id = mk.movie_id AND mc.movie_id = t.id AND mk.keyword_id = k.id AND cn.country_code ='[nl]' AND k.keyword ='character-name-IN-title' AND mc.movie_id = mk.mo...
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 t.id = mc.movie_id AND mc.company_id = cn.id AND an.person_id = ci.p...
job
SELECT promotions, total, CAST(promotions AS DECIMAL(15, 4)) / CAST(total AS DECIMAL(15, 4)) * 100 FROM ( SELECT SUM(ss_ext_sales_price) AS promotions FROM store_sales JOIN store ON ss_store_sk = s_store_sk JOIN promotion ON ss_promo_sk = p_promo_sk JOIN date_dim ON ss_sold_date_sk = d_date_sk JOIN customer ON ss_custo...
tpcds
SELECT o_year, SUM( CASE WHEN nation = 1 THEN volume ELSE 0 END ) / SUM(volume) AS mkt_share FROM ( SELECT EXTRACT(YEAR FROM o_orderdate) AS o_year, l_extendedprice * (1 - l_discount) AS volume, n2.n_name AS nation FROM part, supplier, lineitem, orders, customer, nation n1, nation n2, region WHERE s_suppkey = l_suppkey...
tpch
SELECT 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 k.keyword LIKE '%sequel%' AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Danish', 'Norwegian', 'German') AND k.id = mk.keyword_id AND t.id = mi.movie_id AND t.produ...
job
SELECT SUM(l_extendedprice * (1 - l_discount)) AS revenue, c_address, c_name, n_name, c_phone, c_comment, c_custkey, c_acctbal FROM customer, orders, lineitem, nation WHERE c_custkey = o_custkey AND l_orderkey = o_orderkey AND o_orderdate >= DATE 1 AND o_orderdate < DATE 1 + INTERVAL '3' MONTH AND l_returnflag = 'R' AN...
tpch
SELECT MAX(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 k.keyword LIKE '%sequel%' AND mk.movie_id = mi.movie_id AND t.production_year > 2000 AND t.id = mk.movie_id AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Denmar...
job
Select s_name, Count(*) As numwait From supplier, lineitem l1, orders, nation Where s_nationkey = n_nationkey AND 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 n_name = 1 AND l1.l_receiptdate > l1.l_commitdate AND o_orderstatus...
tpch
SELECT c_preferred_cust_flag, cnt, c_first_name, ss_ticket_number, c_salutation, c_last_name FROM ( SELECT ss_ticket_number, ss_customer_sk, COUNT(*) AS cnt FROM store_sales JOIN date_dim ON ss_sold_date_sk = d_date_sk JOIN store ON ss_store_sk = s_store_sk JOIN household_demographics ON ss_hdemo_sk = hd_demo_sk WHERE ...
tpcds
Select Max(t.title) As movie_title From company_name As cn, keyword As k, movie_companies As mc, movie_keyword As mk, title As t Where cn.country_code ='[de]' And k.keyword ='character-name-In-title' And t.id = mk.movie_id And mk.keyword_id = k.id And mc.movie_id = mk.movie_id And cn.id = mc.company_id And mc.movie_id ...
job
Select Sum( Case When nation = 1 Then volume Else 0 End ) / Sum(volume) As mkt_share, o_year 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_partkey = l_partkey...
tpch
SELECT cust_nation, SUM(volume) AS revenue, 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 s_nationkey = n1.n_nationkey AND l...
tpch
select sum(l_quantity), o_totalprice, o_orderdate, c_custkey, o_orderkey, 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 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 t.id = mc.movie_id AND ct.kind = 'production companies' AND ct.id = mc.company_type_id AND it.info = 'top ...
job
SELECT nation, SUM(amount) AS sum_profit, 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 p_name LIKE 1 ) AS profit AND o_ord...
tpch
SELECT ss_ticket_number, ca_city, extended_price, extended_tax, c_last_name, c_first_name, bought_city, list_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(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 t.production_year > 1990 AND t.id = m...
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 mc.note NOT LIKE '%(USA)%' AND t.id = mc.movie_id AND ci.note = '(voice: English version)' AND n1.id = ci.perso...
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 o_orderkey = l_orderkey AND ps_par...
tpch
WITH year_total AS ( SELECT d_year AS dyear, c_customer_id AS customer_id, c_first_name AS customer_first_name, c_last_name AS customer_last_name, c_login AS customer_login, c_birth_country AS customer_birth_country, c_email_address AS customer_email_address, SUM(((ss_ext_list_price - ss_ext_wholesale_cost - ss_ext_dis...
tpcds
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 it.id = mi_idx.info_type_id And t.production_year Between 2000 And 2010 And it.info ='rating' And mi_idx.info > '7.0' And t.id = mi_idx.movie_id
job
SELECT AVG(ss_quantity), AVG(ss_ext_sales_price), AVG(ss_ext_wholesale_cost), SUM(ss_ext_wholesale_cost) FROM store_sales INNER JOIN store ON s_store_sk = ss_store_sk INNER JOIN customer_demographics ON cd_demo_sk = ss_cdemo_sk INNER JOIN household_demographics ON hd_demo_sk = ss_hdemo_sk INNER JOIN customer_address ON...
tpcds
select min(an.name) as cool_actor_pseudonym, min(t.title) as series_named_after_char from aka_name as an, cast_info as ci, company_name as cn, keyword as k, movie_companies as mc, movie_keyword as mk, name as n, title as t where n.id = ci.person_id and cn.country_code = '[us]' and an.person_id = ci.person_id and t.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 it.info ='rating' And mi_idx.info > '8.0' And t.production_year >= 2000 AND t.production_year <= 2005 And t.id = mi_idx.movie_id And it.id = mi_idx.info_type_id Limit 10;
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 cn.id = mc.company_id AND mc.movie_id = mk.movie_id AND cn.country_code ='[nl]' AND k.keyword ='character-name-in-title' AND mc.movie_id = t.id AND mk.keyword_id = k.id AND t.id = mk.mo...
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 n1.id = ci.person_id AND cn.country_code = '[jp]' AND rt.role = 'actress' AND mc.company_id = cn.id AND mc.note...
job
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 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_brand <> 1 GROUP BY p_brand...
tpch
select count(*) from votes as v, posts as p, users as u where v.PostId = p.Id AND u.Reputation >= 1 AND p.PostTypeId = 1 AND v.UserId = u.Id limit 50;
stats
SELECT ss_ticket_number, c_last_name, c_first_name, cnt, c_salutation, c_preferred_cust_flag FROM ( SELECT ss_ticket_number, ss_customer_sk, COUNT(*) AS cnt FROM store_sales JOIN date_dim ON ss_sold_date_sk = d_date_sk JOIN store ON ss_store_sk = s_store_sk JOIN household_demographics ON ss_hdemo_sk = hd_demo_sk WHERE ...
tpcds
SELECT STDDEV_SAMP(cs_quantity) / AVG(cs_quantity) AS catalog_sales_quantitycov, AVG(ss_quantity) AS store_sales_quantityave, i_item_desc, STDDEV_SAMP(sr_return_quantity) AS store_returns_quantitystdev, AVG(cs_quantity) AS catalog_sales_quantityave, STDDEV_SAMP(sr_return_quantity) / AVG(sr_return_quantity) AS store_ret...
tpcds
SELECT l_year, supp_nation, SUM(volume) AS revenue, cust_nation FROM ( SELECT n1.n_name AS supp_nation, n2.n_name AS cust_nation, EXTRACT(YEAR FROM l_shipdate) AS l_year, l_extendedprice * (1 - l_discount) AS volume FROM supplier, lineitem, orders, customer, nation n1, nation n2 WHERE l_shipdate BETWEEN DATE '1995-01-0...
tpch
SELECT MIN(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 = ci.person_id AND mc.note NOT LIKE '%(USA)%' AND cn.country_code = '[jp]' AND n1.id = ci.person_...
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 mi.movie_id = ci.movie_id AND it.id = mi.info_type_id AND t.id = mi.movie...
job
Select Min(t.title) As american_movie From company_type As ct, info_type As it, movie_companies As mc, movie_info As mi, title As t Where mc.movie_id = mi.movie_id AND mc.note Not Like '%(As Metro-Goldwyn-Mayer Pictures)%' AND it.info = 'bottom 10 rank' AND (mc.note Like '%(co-production)%' Or mc.note Like '%(presents)...
job
SELECT p_brand, p_type, p_size, COUNT(DISTINCT ps_suppkey) AS supplier_cnt FROM partsupp, part WHERE p_brand <> 1 AND p_type NOT LIKE 1 AND p_size IN (1, 1, 1, 1, 1, 1, 1, 1) AND p_partkey = ps_partkey AND ps_suppkey NOT IN ( SELECT s_suppkey FROM supplier WHERE s_comment LIKE '%Customer%Complaints%' ) GROUP BY p_brand...
tpch
WITH _q AS ( 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_d...
tpcds
select i_manufact, sum(ss_ext_sales_price) as ext_price, i_brand_id as brand_id, i_brand as brand, i_manufact_id from date_dim inner join store_sales on d_date_sk = ss_sold_date_sk inner join item on ss_item_sk = i_item_sk inner join customer on ss_customer_sk = c_customer_sk inner join customer_address on c_current_ad...
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 ( (n1.n_name = 1 AND n2.n_name = 1...
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 ct.id = mc.company_type_id AND ci.not...
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 t.production_year > 2005 AND k.id = mk.keyword_id AND t.id = mk.movie_id AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Denish', 'Norw...
job
with _q as ( 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_size in (1, 1, 1, 1, 1, 1, 1, 1) and p_brand <> 1 and p_type not like 1 gro...
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 c_nationkey = s_nationkey AND o_orderdate < DATE 1 + INTERVAL '1' YEAR AND n_regionkey = r_regionkey AND c_custkey = o_custkey AND r_name = 1 AND o_orderdate >=...
tpch
SELECT MIN(t.title) AS american_movie FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info AS mi, title AS t WHERE it.id = mi.info_type_id AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND ct.kind = 'production companies' AND t.id = mc.movie_id AND t.id = mi.movie_id AND it.info = 'b...
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
WITH _q AS ( 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 ) SELECT * FROM _q;
tpch
WITH year_total AS ( SELECT c_customer_id AS customer_id, c_email_address AS customer_email_address, c_preferred_cust_flag AS customer_preferred_cust_flag, d_year AS dyear, 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 ...
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 t.id = mc.movie_id AND it.info = 'bottom 10 rank' AND it.id = mi.info_type_id AND t.id = mi.movie_id AND (mc.note LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%') AND ct.kind...
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 it.info = 'mini biography' AND an.name LIKE '%a%' AND ci.person_id = n.id AND it.id = pi.info_type_id AND n.name_pcode...
job
SELECT COUNT(1) FROM comments AS c, postHistory AS ph, votes AS v, users AS u WHERE ph.UserId = c.UserId AND u.DownVotes >= 0 AND u.Views >= 0 AND u.UpVotes <= 123 AND v.UserId = ph.UserId AND u.Id = v.UserId
stats
SELECT MIN(t.title) AS japanese_anime_movie, MIN(an.name) AS acress_pseudonym 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 rt.role = 'actress' AND t.id = ci.movie_id AND t.id = mk.movi...
job
SELECT AVG(cs_sales_price) AS agg4, i_item_id, AVG(cs_quantity) AS agg1, AVG(cs_list_price) AS agg2, AVG(cs_coupon_amt) AS agg3 FROM catalog_sales JOIN customer_demographics ON cs_bill_cdemo_sk = cd_demo_sk JOIN date_dim ON cs_sold_date_sk = d_date_sk JOIN item ON cs_item_sk = i_item_sk JOIN promotion ON cs_promo_sk = ...
tpcds
SELECT MIN(t.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.kind = 'production companies' AND ct.id = mc.company_type_id AND t.id = mc.movie_id AND it.info = 'top ...
job