text
stringlengths
84
1.49k
benchmark
stringclasses
4 values
SELECT p_brand, p_type, p_size, COUNT(DISTINCT ps_suppkey) AS supplier_cnt FROM partsupp, part WHERE p_partkey = ps_partkey AND p_brand != 1 AND p_type NOT LIKE 1 AND p_size IN (1, 1, 1, 1, 1, 1, 1, 1) AND NOT EXISTS (SELECT 1 FROM (SELECT s_suppkey FROM supplier WHERE s_comment LIKE '%Customer%Complaints%') AS _ne WHE...
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 ci.note = '(voice: ...
job
SELECT o_year, SUM( CASE WHEN nation = 1 THEN volume ELSE 0 END ) / SUM(volume) AS mkt_share FROM ( SELECT EXTRACT(YEAR FROM o_orderdate) AS o_year, l_extendedprice * (1 - l_discount) AS volume, n2.n_name AS nation FROM part, supplier, lineitem, orders, customer, nation n1, nation n2, region WHERE p_type = 1 ) AS all_n...
tpch
SELECT 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 (mc.note LIKE '%(co-production)%' OR mc.note LI...
job
SELECT AVG(cs_coupon_amt) AS agg3, AVG(cs_quantity) AS agg1, i_item_id, AVG(cs_list_price) AS agg2, 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 i_item_id, STDDEV_SAMP(sr_return_quantity) / AVG(sr_return_quantity) AS store_returns_quantitycov, STDDEV_SAMP(sr_return_quantity) AS store_returns_quantitystdev, COUNT(ss_quantity) AS store_sales_quantitycount, AVG(ss_quantity) AS store_sales_quantityave, AVG(cs_quantity) AS catalog_sales_quantityave, COUNT(sr_...
tpcds
WITH _q AS ( 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 custome...
tpcds
select count(*) from comments as c, postHistory as ph, badges as b, votes as v, users as u where ph.PostHistoryTypeId = 12 AND u.Id = b.UserId AND u.UpVotes = 0 AND ph.UserId = v.UserId AND v.UserId = c.UserId AND b.UserId = ph.UserId limit 50;
stats
WITH _q AS ( SELECT AVG(ss_quantity), AVG(ss_ext_sales_price), AVG(ss_ext_wholesale_cost), SUM(ss_ext_wholesale_cost) FROM store_sales JOIN store ON s_store_sk = ss_store_sk JOIN customer_demographics ON cd_demo_sk = ss_cdemo_sk JOIN household_demographics ON hd_demo_sk = ss_hdemo_sk JOIN customer_address ON ca_address...
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 lt.id = ml.link_type_id AND ct.id =...
job
SELECT n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, supplier, nation, region WHERE n_regionkey = r_regionkey AND o_orderdate < DATE 1 + INTERVAL '1' YEAR AND l_orderkey = o_orderkey AND c_custkey = o_custkey AND s_nationkey = n_nationkey AND l_suppkey = s_suppkey AND c_nat...
tpch
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.id = mc.company_id AND cn.country_code ='[sm]' AND mc.movie_id = t.id AND mk.keyword_id = k.id AND mc.movie_id = mk.movie_id AND t.id = mk.movie_id AND k.keyword ='character-name-in-...
job
SELECT o_orderdate, SUM(l_quantity), c_custkey, c_name, o_orderkey, o_totalprice 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(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 t.id = mk.movie_id AND k.id = mk.keyword_id AND n.name LIKE '%Hemsworth%Chris%' AND ci...
job
SELECT COUNT(*) FROM comments AS c, posts AS p, postLinks AS pl, votes AS v WHERE p.Id = c.PostId AND p.Score >= -3 AND c.CreationDate >= '2010-08-02 23:52:10'::timestamp AND v.VoteTypeId = 2 AND pl.PostId = v.PostId AND c.PostId = pl.PostId LIMIT 10;
stats
SELECT AVG(ss_ext_wholesale_cost), AVG(ss_quantity), AVG(ss_ext_sales_price), SUM(ss_ext_wholesale_cost) FROM store_sales JOIN store ON s_store_sk = ss_store_sk JOIN customer_demographics ON cd_demo_sk = ss_cdemo_sk JOIN household_demographics ON hd_demo_sk = ss_hdemo_sk JOIN customer_address ON ca_address_sk = ss_addr...
tpcds
SELECT STDDEV_SAMP(ss_quantity) AS store_sales_quantitystdev, STDDEV_SAMP(sr_return_quantity) AS store_returns_quantitystdev, COUNT(ss_quantity) AS store_sales_quantitycount, AVG(cs_quantity) AS catalog_sales_quantityave, s_state, i_item_desc, i_item_id, STDDEV_SAMP(sr_return_quantity) / AVG(sr_return_quantity) AS stor...
tpcds
SELECT SUM(ss_ext_wholesale_cost), AVG(ss_ext_sales_price), AVG(ss_ext_wholesale_cost), AVG(ss_quantity) FROM store_sales JOIN store ON s_store_sk = ss_store_sk JOIN customer_demographics ON cd_demo_sk = ss_cdemo_sk JOIN household_demographics ON hd_demo_sk = ss_hdemo_sk JOIN customer_address ON ca_address_sk = ss_addr...
tpcds
SELECT MIN(t.title) AS movie_title FROM keyword AS k, movie_info AS mi, movie_keyword AS mk, title AS t WHERE t.production_year > 2005 AND k.keyword LIKE '%sequel%' AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Denish', 'Norwegian', 'German') AND mk.movie_id = mi.movie_id AND k.id = mk.keyword_i...
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.kind = 'production companies' AND it.info = 'bottom 10 rank' AND t.id = mc.movie_id AND it.id = mi.info_type_id AND ct.id = mc.company_type_id AND mc.note NOT LIKE '%(as Metro-Gol...
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 p_partkey = l_partkey AND p_name LIKE 1 ) AS profit AND s_sup...
tpch
SELECT o_year, SUM( CASE WHEN nation = 1 THEN volume ELSE 0 END ) / SUM(volume) AS mkt_share FROM ( SELECT EXTRACT(YEAR FROM o_orderdate) AS o_year, l_extendedprice * (1 - l_discount) AS volume, n2.n_name AS nation FROM part, supplier, lineitem, orders, customer, nation n1, nation n2, region WHERE p_partkey = l_partkey...
tpch
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 s_name, p_partkey, p_mfgr, s_phone, s_address, s_comment, n_name, s_acctbal 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 * 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 10 AND 10 + 10 OR ss_coupon_amt BETWEEN 984 AND 984 + 1000 OR ss_wholesale_cost BETWEEN 72 AND 72 + 20) ) AS b1, ( SELECT AVG(ss_list_price) AS b2_lp...
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(t.title) AS japanese_movie_dubbed, MIN(an1.name) AS actress_pseudonym FROM aka_name AS an1, cast_info AS ci, company_name AS cn, movie_companies AS mc, name AS n1, role_type AS rt, title AS t WHERE ci.movie_id = t.id AND ci.note = '(voice: English version)' AND rt.role = 'actress' AND n1.id = ci.person_id AN...
job
SELECT MIN(t.title) AS northamerican_movie, MIN(mi_idx.info) AS rating FROM aka_title AS at, company_name AS cn, info_type AS it1, info_type AS it2, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS mi_idx, title AS t WHERE at.movie_id = mi.movie_id AND mi.info LIKE 'USA:%200%' AND it1.info = ...
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 cn.country_code ='[de]' AND cn.id = mc.company_id AND mc.movie_id = t.id AND mc.movie_id = mk.movie_id AND mk.keyword_id = k.id AND k.keyword ='character-name-in-title' AND t.id = mk.mo...
job
SELECT COUNT(DISTINCT ps_suppkey) AS supplier_cnt, p_size, p_brand, p_type FROM partsupp, part WHERE p_partkey = ps_partkey AND p_size IN (1, 1, 1, 1, 1, 1, 1, 1) AND p_type NOT LIKE 1 AND ps_suppkey NOT IN ( SELECT s_suppkey FROM supplier WHERE s_comment LIKE '%Customer%Complaints%' ) AND p_brand <> 1 GROUP BY p_brand...
tpch
SELECT c_address, c_acctbal, c_custkey, c_phone, c_comment, c_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue, n_name FROM customer, orders, lineitem, nation WHERE l_returnflag = 'R' AND o_orderdate < DATE 1 + INTERVAL '3' MONTH AND o_orderdate >= DATE 1 AND l_orderkey = o_orderkey AND c_nationkey = n_nationke...
tpch
SELECT COUNT(*) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v, users AS u WHERE u.Id = p.OwnerUserId AND p.Id = v.PostId AND p.Id = c.PostId AND p.Id = ph.PostId AND p.AnswerCount >= 0 AND p.Id = pl.PostId AND p.PostTypeId = 1 LIMIT 50;
stats
SELECT SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, SUM(l_extendedprice) AS sum_base_price, SUM(l_quantity) AS sum_qty, AVG(l_discount) AS avg_disc, l_returnflag, COUNT(*) AS count_order, AVG(l_extendedprice) AS avg_price, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, l_linestatus, ...
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.movie_id = mi_idx.movie_id AND t.id = mc.movie_id AND it.info = 'top 250 rank' AND t.id = mi_idx.movie_...
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 > 2000 AND t.id = mi.movie_id AND k.id = mk.keyword_id AND t.id = mk.movie_id AND mi.info In ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Danish', 'Norwegian', 'German') AND mk.movie...
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 it2.id = mi.info_type_id AND cn.id = mc.company_id AND mi_idx.info < '...
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 rt.role = 'actress' AND ci.person_id = an.person_id AND mc.note LIKE '%(U...
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 promotions, total, CAST(promotions AS DECIMAL(15, 4)) / CAST(total AS DECIMAL(15, 4)) * 100 FROM ( SELECT SUM(ss_ext_sales_price) AS promotions FROM store_sales INNER JOIN store ON ss_store_sk = s_store_sk INNER JOIN promotion ON ss_promo_sk = p_promo_sk INNER JOIN date_dim ON ss_sold_date_sk = d_date_sk INNER J...
tpcds
SELECT MIN(t.title) AS voiced_movie, MIN(n.name) AS voicing_actress 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 ci.movie_id = mc.movie_id AND t.id = mi.movie_id AND an.person_id = n.id ...
job
Select Min(mi.info) As release_date, Min(miidx.info) As rating, Min(t.title) As german_movie From company_name As cn, company_type As ct, info_type As it, info_type As it2, kind_type As kt, movie_companies As mc, movie_info As mi, movie_info_idx As miidx, title As t Where it2.info = 'release dates' And cn.id = mc.compa...
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 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_suppkey = l1.l_suppkey AND s_nationkey = n_nationkey AND NOT EXISTS ( SELECT * FROM lineitem l3 WHERE l3.l_orderkey = l1.l_o...
tpch
select count(*) from comments as c, posts as p, postLinks as pl, postHistory as ph, votes as v where p.Id = c.PostId and c.Score = 0 and p.Id = pl.PostId and p.FavoriteCount >= 0 and pl.LinkTypeId = 1 and p.Id = ph.PostId and p.Id = v.PostId
stats
SELECT MIN(mc.note) AS production_note, MIN(t.title) AS movie_title, MIN(t.production_year) AS movie_year FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info_idx AS mi_idx, title AS t WHERE t.id = mi_idx.movie_id AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND it.id = mi_idx.info_...
job
WITH _q AS ( SELECT COUNT(*) FROM comments AS c, postHistory AS ph, badges AS b, votes AS v, users AS u WHERE ph.UserId = v.UserId AND b.UserId = ph.UserId AND u.Id = b.UserId AND ph.PostHistoryTypeId = 12 AND u.UpVotes = 0 AND v.UserId = c.UserId ) SELECT * FROM _q;
stats
WITH _q AS ( 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 t.id = ci.movie_id AND mi.movi...
job
SELECT i_current_price, i_item_desc, i_item_id 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_current_price BETWEEN 91 AND 91 + 30 AND d_date BETWEEN CAST('2002-01-23' AS DATE) AND (CAST('2002-01-23' AS DATE) + INTERVAL '60...
tpcds
WITH year_total AS ( SELECT c_last_name AS customer_last_name, c_login AS customer_login, 's' AS sale_type, c_customer_id AS customer_id, d_year AS dyear, c_email_address AS customer_email_address, c_preferred_cust_flag AS customer_preferred_cust_flag, c_birth_country AS customer_birth_country, SUM(((ss_ext_list_price ...
tpcds
SELECT MIN(mi_idx.info) AS rating, MIN(t.title) AS western_violent_movie, 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 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 INNER JOIN date_dim ON ss_sold_date_sk = d_date_sk INNER JOIN store ON ss_store_sk = s_store_sk INNER JOIN household_demographics ON ss_hdemo_sk =...
tpcds
SELECT 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 b.UserId = c.UserId AND p.Id = v.PostId AND p.Id = c.PostId AND pl.LinkTypeId = 1 AND c.Score = 0 AND p.Id = ph.PostId
stats
Select Min(mi_idx.info) As rating, Min(t.title) As northamerican_movie From aka_title As at, company_name As cn, info_type As it1, info_type As it2, kind_type As kt, movie_companies As mc, movie_info As mi, movie_info_idx As mi_idx, title As t Where t.id = mi_idx.movie_id And it2.id = mi.info_type_id And it1.info = 'ra...
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 k.keyword ='character-name-in-title' AND cn.country_code ='[sm]' AND mc.movie_id = t.id AND t.id = mk.mo...
job
Select Sum( Case When o_orderpriority <> '1-URGENT' And o_orderpriority <> '2-HIGH' Then 1 Else 0 End ) As low_line_count, l_shipmode, Sum( Case When o_orderpriority = '1-URGENT' Or o_orderpriority = '2-HIGH' Then 1 Else 0 End ) As high_line_count From orders, lineitem Where l_shipmode = ANY(ARRAY[1, 1]) AND l_shipdate...
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(1) AS cnt FROM store_sales INNER JOIN date_dim ON ss_sold_date_sk = d_date_sk INNER JOIN store ON ss_store_sk = s_store_sk INNER JOIN household_demographics ON ss_hdemo_sk =...
tpcds
SELECT c_preferred_cust_flag, c_first_name, ss_ticket_number, c_last_name, c_salutation, 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 i_item_desc, s_store_name, i_item_id, SUM(ss_quantity) AS store_sales_quantity, SUM(cs_quantity) AS catalog_sales_quantity, SUM(sr_return_quantity) AS store_returns_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 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 chn.id = ci.person_role_id AND n.gender = '...
job
SELECT s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE s_nationkey = n_nationkey AND o_orderkey = l1.l_orderkey AND l1.l_receiptdate > l1.l_commitdate AND s_suppkey = l1.l_suppkey AND o_orderstatus = 'F' AND EXISTS ( SELECT * FROM lineitem l2 WHERE l2.l_orderkey = l1.l_orderkey AND l2.l_sup...
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 (427, 128, 154, 9) AND d_date BETWEEN CAST('2002-01-23' AS DATE) AND (CAST('2002-01-23' AS DATE) + INTERVAL '60 da...
tpcds
Select Min(chn.name) As uncredited_voiced_character, Min(t.title) As russian_movie From char_name As chn, cast_info As ci, company_name As cn, company_type As ct, movie_companies As mc, role_type As rt, title As t Where ci.movie_id = mc.movie_id And cn.id = mc.company_id And cn.country_code = '[ru]' And rt.id = ci.role...
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 ci.note IN ('(voice)', '(voice: Japanese version)', '(voice) (uncredited)...
job
SELECT STDDEV_SAMP(ss_quantity) AS store_sales_quantitystdev, s_state, COUNT(sr_return_quantity) AS store_returns_quantitycount, COUNT(ss_quantity) AS store_sales_quantitycount, STDDEV_SAMP(cs_quantity) / AVG(cs_quantity) AS catalog_sales_quantitycov, COUNT(cs_quantity) AS catalog_sales_quantitycount, i_item_id, STDDEV...
tpcds
SELECT c_salutation, cnt, c_preferred_cust_flag, ss_ticket_number, c_first_name, c_last_name FROM ( SELECT ss_ticket_number, ss_customer_sk, COUNT(*) AS cnt FROM store_sales JOIN date_dim ON ss_sold_date_sk = d_date_sk JOIN store ON ss_store_sk = s_store_sk JOIN household_demographics ON ss_hdemo_sk = hd_demo_sk WHERE ...
tpcds
SELECT bought_city, c_first_name, extended_tax, c_last_name, list_price, ss_ticket_number, extended_price, 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(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.movie_id = mi_idx.movie_id AND t.id = mc.movie_id AND ct.id = mc.c...
job
SELECT i_item_id, AVG(ss_quantity) AS agg1, AVG(ss_list_price) AS agg2, AVG(ss_coupon_amt) AS agg3, AVG(ss_sales_price) AS agg4 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 o_totalprice, SUM(l_quantity), c_name, o_orderkey, o_orderdate, 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 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 AVG(ss_coupon_amt) AS agg3, AVG(ss_quantity) AS agg1, AVG(ss_sales_price) AS agg4, i_item_id, 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 promotions, total, CAST(promotions AS DECIMAL(15, 4)) / CAST(total AS DECIMAL(15, 4)) * 100 FROM ( SELECT SUM(ss_ext_sales_price) AS promotions FROM store_sales INNER JOIN store ON ss_store_sk = s_store_sk INNER JOIN promotion ON ss_promo_sk = p_promo_sk INNER JOIN date_dim ON ss_sold_date_sk = d_date_sk INNER J...
tpcds
SELECT 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 mk.movie_id = mi.movie_id AND t.production_year > 2000 AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Danish', 'Norwegian', 'German') AND t.id = mk.movie_id ...
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 s_suppkey = l_suppkey AND ps_suppkey = l_suppkey AND p_partke...
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 k.keyword ='character-name-IN-title' AND cn.id = mc.company_id AND cn.country_code ='[sm]' AND mk.keyword_id = k.id AND mc.movie_id = mk.movie_id AND mc.movie_id ...
job
select min(an.name) as acress_pseudonym, min(t.title) as japanese_anime_movie from aka_name as an, cast_info as ci, company_name as cn, company_type as ct, keyword as k, movie_companies as mc, movie_keyword as mk, name as n, role_type as rt, title as t where mc.note not like '%(USA)%' and ci.note like '%(voice: English...
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 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 c_custkey = o_custkey AND o_orderk...
tpch
SELECT cc_call_center_id AS call_center, SUM(cr_net_loss) AS returns_loss, cc_name AS call_center_name, cc_manager AS manager FROM call_center JOIN catalog_returns ON cr_call_center_sk = cc_call_center_sk JOIN date_dim ON cr_returned_date_sk = d_date_sk JOIN customer ON cr_returning_customer_sk = c_customer_sk JOIN cus...
tpcds
SELECT MIN(miidx.info) AS rating, MIN(mi.info) AS release_date, 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 mc.movie_id = t.id AND cn.id = mc.company_id AN...
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 ps_suppkey = l_suppkey AND ps_partk...
tpch
SELECT MIN(t.title) AS western_sequel, MIN(lt.link) AS link_type, MIN(cn.name) AS from_company FROM company_name AS cn, company_type AS ct, info_type AS it, keyword AS k, link_type AS lt, movie_companies AS mc, movie_info AS mi, movie_keyword AS mk, movie_link AS ml, title AS t WHERE cn.country_code = '[us]' AND t.id =...
job
SELECT 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_custkey = o_custkey AND s_nation...
tpch
SELECT MIN(k.keyword) AS movie_keyword, MIN(n.name) AS actor_name, MIN(t.title) AS marvel_movie FROM cast_info AS ci, keyword AS k, movie_keyword AS mk, name AS n, title AS t WHERE ci.movie_id = mk.movie_id AND t.production_year > 2010 AND t.id = ci.movie_id AND n.name LIKE '%Downey%Robert%' AND k.id = mk.keyword_id AN...
job
SELECT MIN(t.title) AS movie_title FROM keyword AS k, movie_info AS mi, movie_keyword AS mk, title AS t WHERE k.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.id = mi.movie_id AND t.produc...
job
SELECT COUNT(1) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v, users AS u WHERE p.PostTypeId = 1 AND p.AnswerCount >= 0 AND p.Id = c.PostId AND p.Id = ph.PostId AND p.Id = v.PostId AND p.Id = pl.PostId AND u.Id = p.OwnerUserId
stats
WITH _q AS ( select i_brand_id as brand_id, i_brand as brand, sum(ss_ext_sales_price) as ext_price from date_dim join store_sales on d_date_sk = ss_sold_date_sk join item on ss_item_sk = i_item_sk where d_year = 2001 AND i_manager_id = 13 AND d_moy = 12 group by i_brand, i_brand_id order by ext_price desc, brand_id lim...
tpcds
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 it.info ='rating' AND t.production_year <= 2005 AND it.id = mi_idx.info_type_id AND mi_idx.info > '8.0' AND t.id = mi_idx.movie_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 ct.kind = 'production companies' AND (mc.note LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%') AND it.info = 'bottom 10 rank' AND it.id = mi.info_type_id AND t.id = mi.movie_...
job
SELECT MIN(mi.info) AS release_date, MIN(miidx.info) AS rating, MIN(t.title) AS german_movie FROM company_name AS cn, company_type AS ct, info_type AS it, info_type AS it2, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS miidx, title AS t WHERE it2.id = mi.info_type_id AND ct.kind = 'product...
job
Select Sum(l_extendedprice * (1 - l_discount)) As sum_disc_price, Sum(l_quantity) As sum_qty, l_linestatus, Avg(l_discount) As avg_disc, Avg(l_extendedprice) As avg_price, Sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) As sum_charge, Sum(l_extendedprice) As sum_base_price, Avg(l_quantity) As avg_qty, Count(*) As...
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 = c.PostId AND p.Id = ph.PostId AND pl.LinkTypeId = 1 AND p.Id = v.PostId AND c.Score = 0 AND p.FavoriteCount >= 0 LIMIT 10;
stats
Select i_item_id, i_item_desc, i_current_price 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 catalog_sales On cs_item_sk = i_item_sk Where i_current_price Between 75 And 75 + 30 And d_date Between CAST('2000-05-01' As DATE) And (CAST('2000-05-01' As ...
tpcds
Select item.i_brand_id As brand_id, Sum(ss_ext_sales_price) As ext_price, dt.d_year, 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 COUNT(*) FROM comments AS c, posts AS p, votes AS v, users AS u WHERE u.Id = p.OwnerUserId AND c.Score = 0 AND u.Id = v.UserId AND p.ViewCount >= 0 AND u.Id = c.UserId AND p.Score >= 0 LIMIT 50;
stats
select count(*) from comments as c, posts as p, votes as v, users as u where u.Id = c.UserId and c.Score = 0 and p.Score >= 0 and u.Id = v.UserId and u.Id = p.OwnerUserId and p.ViewCount >= 0
stats
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 MIN(mi.info) AS release_date, MIN(miidx.info) AS rating, MIN(t.title) AS german_movie FROM company_name AS cn, company_type AS ct, info_type AS it, info_type AS it2, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS miidx, title AS t WHERE mi.movie_id = miidx.movie_id AND kt.kind = 'mov...
job
select sum(ss_ext_sales_price) as ext_price, i_brand_id as brand_id, i_brand as brand 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 where i_manager_id = 1 and d_moy = 11 and d_year = 2001 group by i_brand, i_brand_id order by ext_price desc, brand_id limit...
tpcds
Select Count(*) From postHistory As ph, posts As p, votes As v, badges As b, users As u, comments As c Where p.Id = ph.PostId AND p.Id = c.PostId AND u.Id = b.UserId AND p.Id = v.PostId AND p.ViewCount >= 0 AND p.Score <= 192 AND u.Id = p.OwnerUserId
stats