text
stringlengths
84
1.49k
benchmark
stringclasses
4 values
SELECT promotions, CAST(promotions AS DECIMAL(15, 4)) / CAST(total AS DECIMAL(15, 4)) * 100, 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 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
SELECT COUNT(*) AS count_order, AVG(l_quantity) AS avg_qty, AVG(l_discount) AS avg_disc, SUM(l_extendedprice) AS sum_base_price, l_returnflag, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, SUM(l_quantity) AS sum_qty, AVG(l_extendedprice) AS avg_price, l_linestatus, SUM(l_extendedprice * (1 - l_di...
tpch
select min(t.title) as movie_title from keyword as k, movie_info as mi, movie_keyword as mk, title as t where k.id = mk.keyword_id AND t.id = mi.movie_id AND mi.info in ('Sweden', 'Norway', 'Germany', 'Danish', 'Swedish', 'Danish', 'Norwegian', 'German') AND mk.movie_id = mi.movie_id AND t.production_year > 2010 AND t....
job
SELECT c_custkey, c_acctbal, SUM(l_extendedprice * (1 - l_discount)) AS revenue, n_name, c_name, c_address, c_phone, c_comment 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 i_item_id, i_item_desc, s_store_id, s_store_name, Sum(ss_quantity) As store_sales_quantity, 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 cnt, c_preferred_cust_flag, c_last_name, c_first_name, ss_ticket_number, 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 COUNT(1) AS count_order, l_returnflag, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, SUM(l_quantity) AS sum_qty, SUM(l_extendedprice) AS sum_base_price, AVG(l_quantity) AS avg_qty, AVG(l_discount) AS avg_disc, AVG(l_extendedprice) AS avg_price, SUM(l_extendedprice * (1 - l_discount)) AS su...
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_partkey = ps_partkey AND s_suppkey = ps_suppkey AND r_name = 1 AND n_regionkey = r_regionkey AND p_size = 1 AND ps_supplycost = ( SELECT MIN(ps_supplycost) FROM partsupp, supplier, na...
tpch
select sum( case when o_orderpriority <> '1-URGENT' and o_orderpriority <> '2-HIGH' then 1 else 0 end ) as low_line_count, sum( case when o_orderpriority = '1-URGENT' or o_orderpriority = '2-HIGH' then 1 else 0 end ) as high_line_count, l_shipmode from orders, lineitem where l_commitdate < l_receiptdate and l_shipmode ...
tpch
Select cntrycode, Count(1) As numcust, Sum(c_acctbal) As totacctbal From ( Select SUBSTRING(c_phone From 1 FOR 2) As cntrycode, c_acctbal From customer Where SUBSTRING(c_phone From 1 FOR 2) In (1, 1, 1, 1, 1, 1, 1) And c_acctbal > ( Select Avg(c_acctbal) From customer Where c_acctbal > 0.00 And SUBSTRING(c_phone From 1...
tpch
Select Min(mc.note) As production_note, Min(t.title) As movie_title, Min(t.production_year) As movie_year From company_type As ct, info_type As it, movie_companies As mc, movie_info_idx As mi_idx, title As t Where t.id = mi_idx.movie_id And (mc.note Like '%(co-production)%' Or mc.note Like '%(presents)%') And ct.id = m...
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 mi.movie_id = mc.movie_id AND cn.country_code =...
job
Select COUNT(1) From comments As c, postHistory As ph, badges As b, votes As v, users As u Where u.Id = b.UserId And u.UpVotes = 0 And v.UserId = c.UserId And ph.UserId = v.UserId And ph.PostHistoryTypeId = 12 And b.UserId = ph.UserId
stats
SELECT MIN(chn.name) AS uncredited_voiced_character, MIN(t.title) AS russian_movie FROM char_name AS chn, cast_info AS ci, company_name AS cn, company_type AS ct, movie_companies AS mc, role_type AS rt, title AS t WHERE ct.id = mc.company_type_id AND t.production_year > 2005 AND t.id = mc.movie_id AND rt.role = 'actor'...
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 o_orderdate BETWEEN D...
tpch
SELECT i_item_id, i_item_desc, s_store_id, s_store_name, MAX(ss_net_profit) AS store_sales_profit, MAX(sr_net_loss) AS store_returns_loss, MAX(cs_net_profit) AS catalog_sales_profit FROM store_sales JOIN store_returns ON store_sales.ss_customer_sk = store_returns.sr_customer_sk AND store_sales.ss_item_sk = store_return...
tpcds
Select item.i_brand As brand, dt.d_year, Sum(ss_ext_sales_price) As ext_price, item.i_brand_id As brand_id 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 item.i_manager_id = 67 And dt.d_moy = 11 And dt.d_year = 1999 Group By ...
tpcds
SELECT p_size, p_brand, COUNT(DISTINCT ps_suppkey) AS supplier_cnt, p_type FROM partsupp, part WHERE 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 AND p_partkey = ps_partkey GROUP BY p_brand...
tpch
With year_total As ( Select c_birth_country As customer_birth_country, d_year As dyear, c_first_name As customer_first_name, c_email_address As customer_email_address, 's' As sale_type, c_login As customer_login, Sum(((ss_ext_list_price - ss_ext_wholesale_cost - ss_ext_discount_amt) + ss_ext_sales_price) / 2) As year_t...
tpcds
Select COUNT(*) From postHistory As ph, posts As p, users As u, badges As b Where u.Id = b.UserId AND ph.PostHistoryTypeId = 3 AND u.Reputation >= 1 AND p.OwnerUserId = u.Id AND p.Score >= -7 AND ph.UserId = u.Id
stats
SELECT o_orderkey, c_name, SUM(l_quantity), c_custkey, o_orderdate, 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 supp_nation, cust_nation, l_year, SUM(volume) AS revenue FROM ( SELECT n1.n_name AS supp_nation, n2.n_name AS cust_nation, EXTRACT(YEAR FROM l_shipdate) AS l_year, l_extendedprice * (1 - l_discount) AS volume FROM supplier, lineitem, orders, customer, nation n1, nation n2 WHERE o_orderkey = l_orderkey AND ( (n1....
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 o_orderkey = l_orderkey and l_shipdate < l_c...
tpch
SELECT COUNT(*) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v, badges AS b, users AS u WHERE p.Score <= 40 AND p.Id = v.PostId AND pl.LinkTypeId = 1 AND b.UserId = u.Id AND p.Id = pl.RelatedPostId AND p.Id = c.PostId AND c.UserId = u.Id AND p.Id = ph.PostId
stats
SELECT s_address, s_suppkey, total_revenue, s_phone, s_name FROM supplier, revenue0 WHERE s_suppkey = supplier_no AND total_revenue = ( SELECT MAX(total_revenue) FROM revenue0 ) ORDER BY s_suppkey LIMIT 500;
tpch
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.gender = 'm' OR (n.gender = 'f' AND n.name LIKE 'B%')) AND t.production_year BETWEEN 1980 AND 1995 AND an.person_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 ci.movie_id = mk.movie_id AND mc.company_id = cn.id AND mc.movie_id = mk.movie_id AND ci.mo...
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 t.id = mk.movie_id AND t.id = mi.movie_id AND t.production_year > 2005 AND mk.movie_id = mi.movie_id AND k.id = mk.keyword_id AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Denmar...
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.movie_id = mi_idx.movie_id AND (mc.note Like '%(co-production)%' Or mc.note Like '%(presents)%') AND mc...
job
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 o_orderstatus = 'F' AND s_nationkey = n_nationkey AND s_suppkey = l1.l_suppkey AND o_orderkey = l1.l_orderkey AND Not Exists (...
tpch
SELECT SUM( CASE WHEN o_orderpriority = '1-URGENT' OR o_orderpriority = '2-HIGH' THEN 1 ELSE 0 END ) AS high_line_count, l_shipmode, 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 o_orderkey = l_orderkey AND l_commitdate < l...
tpch
SELECT cnt, ss_ticket_number, c_preferred_cust_flag, c_salutation, c_first_name, c_last_name FROM ( SELECT ss_ticket_number, ss_customer_sk, COUNT(1) AS cnt FROM store_sales JOIN date_dim ON ss_sold_date_sk = d_date_sk JOIN store ON ss_store_sk = s_store_sk JOIN household_demographics ON ss_hdemo_sk = hd_demo_sk WHERE ...
tpcds
SELECT i_item_desc, COUNT(ss_quantity) AS store_sales_quantitycount, AVG(cs_quantity) AS catalog_sales_quantityave, i_item_id, AVG(ss_quantity) AS store_sales_quantityave, COUNT(cs_quantity) AS catalog_sales_quantitycount, STDDEV_SAMP(cs_quantity) / AVG(cs_quantity) AS catalog_sales_quantitycov, STDDEV_SAMP(ss_quantity...
tpcds
Select Count(*) From comments As c, postHistory As ph, badges As b, votes As v, users As u Where u.UpVotes = 0 And ph.PostHistoryTypeId = 12 And b.UserId = ph.UserId And v.UserId = c.UserId And ph.UserId = v.UserId And u.Id = b.UserId
stats
SELECT MIN(n.name) AS voicing_actress, MIN(t.title) AS voiced_movie FROM aka_name AS an, char_name AS chn, cast_info AS ci, company_name AS cn, info_type AS it, movie_companies AS mc, movie_info AS mi, name AS n, role_type AS rt, title AS t WHERE cn.id = mc.company_id AND mc.note LIKE '%(USA)%' AND n.gender = 'f' AND c...
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 t.id = mi_idx.movie_id AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictu...
job
SELECT cnt, c_preferred_cust_flag, c_salutation, c_first_name, ss_ticket_number, 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 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 ml.movie_id = mi.movie_id AND lt.li...
job
SELECT supp_nation, cust_nation, l_year, SUM(volume) AS revenue FROM ( SELECT n1.n_name AS supp_nation, n2.n_name AS cust_nation, EXTRACT(YEAR FROM l_shipdate) AS l_year, l_extendedprice * (1 - l_discount) AS volume FROM supplier, lineitem, orders, customer, nation n1, nation n2 WHERE o_orderkey = l_orderkey AND l_ship...
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_quantity <= 5 AND (ss_list_price BETWEEN 45 AND 45 + 10 OR ss_coupon_amt BETWEEN 671 AND 671 + 1000 OR ss_wholesale_cost BETWEEN 93 AND 93 + 20) ) AS b1, ( SELECT AVG(ss...
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 an.person_id = n.id AND mk.keyword_id = k.id AND n.id = ci.person_id AND ci.movie_id = mk.m...
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 kt.id = t.kind_id AND mi.movie_id = mc.movie_id...
job
SELECT l_orderkey, SUM(l_extendedprice * (1 - l_discount)) AS revenue, o_orderdate, o_shippriority FROM customer, orders, lineitem WHERE c_custkey = o_custkey AND l_orderkey = o_orderkey AND o_orderdate < DATE 1 AND l_shipdate > DATE 1 AND c_mktsegment = 1 GROUP BY l_orderkey, o_orderdate, o_shippriority ORDER BY reven...
tpch
select max(mi_idx.info) as rating, max(t.title) as movie_title from info_type as it, movie_info_idx as mi_idx, title as t where mi_idx.info > '7.0' and it.id = mi_idx.info_type_id and it.info ='rating' and t.id = mi_idx.movie_id and t.production_year between 2000 and 2010
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 mk.keyword_id = k.id AND t.id = mk.movie_id AND an.person_id = n.id AND ci.movie_id = t.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 it.id = mi_idx.info_type_id AND mi_idx.info > '7.0' AND it.info ='rating' AND t.production_year BETWEEN 2000 AND 2010 LIMIT 500;
job
Select Min(mc.note) As production_note, Min(t.title) As movie_title, Min(t.production_year) As movie_year From company_type As ct, info_type As it, movie_companies As mc, movie_info_idx As mi_idx, title As t Where it.id = mi_idx.info_type_id AND mc.note Not Like '%(As Metro-Goldwyn-Mayer Pictures)%' AND ct.id = mc.comp...
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 ct.kind = 'production companies' AND it.info = ...
job
SELECT p_brand, p_type, p_size, COUNT(DISTINCT ps_suppkey) AS supplier_cnt FROM partsupp, part WHERE p_partkey = ps_partkey AND NOT EXISTS (SELECT 1 FROM (SELECT s_suppkey FROM supplier WHERE s_comment LIKE '%Customer%Complaints%') AS _ne WHERE _ne.ps_suppkey = ps_suppkey) AND p_size = ANY(ARRAY[1, 1, 1, 1, 1, 1, 1, 1]...
tpch
SELECT MIN(n.name) AS voicing_actress, MIN(t.title) AS voiced_movie FROM aka_name AS an, char_name AS chn, cast_info AS ci, company_name AS cn, info_type AS it, movie_companies AS mc, movie_info AS mi, name AS n, role_type AS rt, title AS t WHERE t.production_year > 2000 AND it.info = 'release dates' AND mi.movie_id = ...
job
Select c_last_name, cnt, ss_ticket_number, c_first_name, 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 cnt, c_salutation, c_first_name, c_last_name, ss_ticket_number, 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 s_phone, s_address, s_suppkey, total_revenue, s_name FROM supplier, revenue0 WHERE s_suppkey = supplier_no AND total_revenue = ( SELECT MAX(total_revenue) FROM revenue0 ) ORDER BY s_suppkey
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.movie_id = mi_idx.movie_id AND t.id = mi_idx...
job
SELECT item.i_brand_id AS brand_id, SUM(ss_ext_sales_price) AS sum_agg, 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_moy = 12 AND item.i_manufact_id = 691 GROUP BY dt.d_year, item.i_bra...
tpcds
SELECT MIN(t.title) AS movie_title, MIN(t.production_year) AS movie_year, MIN(mc.note) AS production_note FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info_idx AS mi_idx, title AS t WHERE mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND it.info = 'top 250 rank' AND ct.kind = 'product...
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 t.production_year > 2010 AND t.id = ci.movie_id AND k.keyword = 'marvel-cinematic-universe' AND t.id = mk.movie_id AND n.name LIKE '%Hemswo...
job
SELECT SUM(l_extendedprice * l_discount) AS revenue FROM lineitem WHERE l_shipdate < DATE 1 + INTERVAL '1' YEAR AND l_quantity < 1 AND l_discount BETWEEN 1 - 0.01 AND 1 + 0.01 AND l_shipdate >= DATE 1 LIMIT 1000;
tpch
select count(*) from postHistory as ph, posts as p, votes as v, badges as b, users as u, comments as c where u.Id = b.UserId and p.Score <= 192 and p.ViewCount >= 0 and p.Id = ph.PostId and p.Id = c.PostId and p.Id = v.PostId and u.Id = p.OwnerUserId
stats
SELECT AVG(ss_quantity), AVG(ss_ext_sales_price), AVG(ss_ext_wholesale_cost), SUM(ss_ext_wholesale_cost) FROM store_sales JOIN store ON s_store_sk = ss_store_sk JOIN customer_demographics ON cd_demo_sk = ss_cdemo_sk JOIN household_demographics ON hd_demo_sk = ss_hdemo_sk JOIN customer_address ON ca_address_sk = ss_addr...
tpcds
SELECT p_brand, p_type, p_size, COUNT(DISTINCT ps_suppkey) AS supplier_cnt FROM partsupp, part WHERE p_type NOT LIKE 1 AND 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_partkey = ps_partkey GROUP BY p_brand...
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 n1.name LIKE '%Yo%' AND mc.note NOT LIKE '%(USA)%' AND cn.country_code = '[jp]' AND ci.movie_id = t.id AND n1.i...
job
SELECT ps_partkey, SUM(ps_supplycost * ps_availqty) AS VALUE FROM partsupp, supplier, nation WHERE n_name = 1 AND s_nationkey = n_nationkey AND ps_suppkey = s_suppkey GROUP BY ps_partkey HAVING SUM(ps_supplycost * ps_availqty) > ( SELECT SUM(ps_supplycost * ps_availqty) * 1 FROM partsupp, supplier, nation WHERE ps_supp...
tpch
SELECT MIN(n.name) AS actor_name, MIN(t.title) AS marvel_movie, MIN(k.keyword) AS movie_keyword 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 n.name LIKE '%Downey%Robert%' AND k.keyword = 'marvel-cinematic-universe' AND t.id = ci.movie_id AND n.id = c...
job
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 = ph.PostId AND p.Id = c.PostId AND p.PostTypeId = 1 AND p.Id = v.PostId AND p.AnswerCount >= 0 AND p.Id = pl.PostId LIMIT 50;
stats
SELECT COUNT(DISTINCT ps_suppkey) AS supplier_cnt, p_size, p_type, p_brand FROM partsupp, part WHERE p_type NOT LIKE 1 AND p_partkey = ps_partkey AND 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) GROUP BY p_brand...
tpch
SELECT MIN(an.name) AS cool_actor_pseudonym, MIN(t.title) AS series_named_after_char FROM aka_name AS an, cast_info AS ci, company_name AS cn, keyword AS k, movie_companies AS mc, movie_keyword AS mk, name AS n, title AS t WHERE ci.movie_id = mk.movie_id AND an.person_id = n.id AND an.person_id = ci.person_id AND cn.co...
job
Select Min(t.title) As movie_title From company_name As cn, keyword As k, movie_companies As mc, movie_keyword As mk, title As t Where mc.movie_id = t.id AND cn.country_code ='[de]' AND mk.keyword_id = k.id AND t.id = mk.movie_id AND mc.movie_id = mk.movie_id AND k.keyword ='character-name-In-title' AND cn.id = mc.comp...
job
Select Sum(cs_sales_price), ca_zip From catalog_sales Inner Join customer On cs_bill_customer_sk = c_customer_sk Inner Join customer_address On c_current_addr_sk = ca_address_sk Inner Join date_dim On cs_sold_date_sk = d_date_sk Where (SUBSTR(ca_zip, 1, 5) In ( '85669', '86197', '88274', '83405', '86475', '85392', '854...
tpcds
SELECT COUNT(*) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v WHERE p.Id = c.PostId AND p.Id = pl.PostId AND p.FavoriteCount >= 0 AND p.Id = ph.PostId AND c.Score = 0 AND pl.LinkTypeId = 1 AND p.Id = v.PostId
stats
SELECT AVG(ss_ext_wholesale_cost), AVG(ss_ext_sales_price), SUM(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 s_state, COUNT(ss_quantity) AS store_sales_quantitycount, AVG(cs_quantity) AS catalog_sales_quantityave, STDDEV_SAMP(ss_quantity) AS store_sales_quantitystdev, i_item_desc, COUNT(cs_quantity) AS catalog_sales_quantitycount, STDDEV_SAMP(cs_quantity) / AVG(cs_quantity) AS catalog_sales_quantitycov, COUNT(sr_return...
tpcds
SELECT MAX(cn.name) AS movie_company, MAX(mi_idx.info) AS rating, MAX(t.title) AS western_violent_movie FROM company_name AS cn, company_type AS ct, info_type AS it1, info_type AS it2, keyword AS k, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS mi_idx, movie_keyword AS mk, title AS t WHERE...
job
SELECT cust_nation, supp_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 s_suppke...
tpch
SELECT MIN(n.name) AS voicing_actress, MIN(t.title) AS voiced_movie FROM aka_name AS an, char_name AS chn, cast_info AS ci, company_name AS cn, info_type AS it, movie_companies AS mc, movie_info AS mi, name AS n, role_type AS rt, title AS t WHERE t.id = mc.movie_id AND t.production_year > 2000 AND t.id = mi.movie_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 mk.movie_id = mi.movie_id 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...
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 at.movie_id = mi.movie_id AND mi.info Like 'USA:%200%' AND kt.id = t.k...
job
SELECT nation, o_year, SUM(amount) AS sum_profit FROM ( SELECT n_name AS nation, EXTRACT(YEAR FROM o_orderdate) AS o_year, l_extendedprice * (1 - l_discount) - ps_supplycost * l_quantity AS amount FROM part, supplier, lineitem, partsupp, orders, nation WHERE ps_suppkey = l_suppkey AND p_name LIKE 1 ) AS profit AND s_na...
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 ='[de]' AND mc.movie_id = t.id AND 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 t.id = mk.mo...
job
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 = v.PostId and p.Id = c.PostId and p.Score <= 192 and u.Id = b.UserId and u.Id = p.OwnerUserId and p.ViewCount >= 0
stats
SELECT MIN(chn.name) AS uncredited_voiced_character, MIN(t.title) AS russian_movie FROM char_name AS chn, cast_info AS ci, company_name AS cn, company_type AS ct, movie_companies AS mc, role_type AS rt, title AS t WHERE ct.id = mc.company_type_id AND t.id = mc.movie_id AND t.id = ci.movie_id AND ci.note LIKE '%(uncredi...
job
SELECT AVG(ss_quantity), AVG(ss_ext_sales_price), AVG(ss_ext_wholesale_cost), SUM(ss_ext_wholesale_cost) FROM store_sales JOIN store ON s_store_sk = ss_store_sk JOIN customer_demographics ON cd_demo_sk = ss_cdemo_sk JOIN household_demographics ON hd_demo_sk = ss_hdemo_sk JOIN customer_address ON ca_address_sk = ss_addr...
tpcds
SELECT c_address, c_phone, c_comment, c_name, c_acctbal, c_custkey, n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue 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 AVG(l_extendedprice) AS avg_price, AVG(l_quantity) AS avg_qty, COUNT(*) AS count_order, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, SUM(l_quantity) AS sum_qty, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, AVG(l_discount) AS avg_disc, l_linestatus, l_returnflag, SUM(l_extend...
tpch
SELECT MIN(cn.name) AS movie_company, MIN(mi_idx.info) AS rating, MIN(t.title) AS western_violent_movie FROM company_name AS cn, company_type AS ct, info_type AS it1, info_type AS it2, keyword AS k, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS mi_idx, movie_keyword AS mk, title AS t WHERE...
job
Select c_custkey, Sum(l_quantity), o_orderdate, o_totalprice, 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 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 INNER JOIN customer_demographics ON cs_bill_cdemo_sk = cd_demo_sk INNER JOIN date_dim ON cs_sold_date_sk = d_date_sk INNER JOIN item ON cs_item_sk = i_item_sk INNER JOIN pro...
tpcds
Select Count(*) From postHistory As ph, posts As p, votes As v, badges As b, users As u, comments As c Where u.Id = b.UserId And p.Id = c.PostId And p.Id = ph.PostId And p.Score <= 192 And u.Id = p.OwnerUserId And p.ViewCount >= 0 And p.Id = v.PostId
stats
SELECT MAX(n.name) AS voicing_actress, MAX(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 cn.id = mc.company_id AND it.id = mi.info_t...
job
SELECT SUM(l_extendedprice * (1 - l_discount)) AS revenue, c_custkey, c_acctbal, c_comment, c_name, c_phone, n_name, c_address 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 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 pl.LinkTypeId = 1 AND p.Id = c.PostId AND p.Id = v.PostId AND c.Score = 0 AND p.Id = ph.PostId AND p.Id = pl.RelatedPostId
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 an.person_id = ci.person_id AND lt.link = 'features' AND ml.linked_movie_id = t.id AND (n.gender = 'm' or (n.gender = ...
job
SELECT n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, supplier, nation, region WHERE l_orderkey = o_orderkey AND s_nationkey = n_nationkey AND o_orderdate >= DATE 1 AND l_suppkey = s_suppkey AND n_regionkey = r_regionkey AND r_name = 1 AND o_orderdate < DATE 1 + INTERVAL '1'...
tpch
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 store_sales ON ss_item_sk = i_item_sk WHERE d_date BETWEEN CAST('1998-01-15' AS DATE) AND (CAST('1998-01-15' AS DATE) + INTERVAL '60 days') AND i_manufact_id...
tpcds
SELECT STDDEV_SAMP(cs_quantity) / AVG(cs_quantity) AS catalog_sales_quantitycov, STDDEV_SAMP(sr_return_quantity) / AVG(sr_return_quantity) AS store_returns_quantitycov, COUNT(ss_quantity) AS store_sales_quantitycount, AVG(sr_return_quantity) AS store_returns_quantityave, STDDEV_SAMP(ss_quantity) AS store_sales_quantity...
tpcds
SELECT MIN(miidx.info) AS rating, MIN(t.title) AS german_movie, MIN(mi.info) AS release_date 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 = mc.movie_id AND mi.movie_id = mii...
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_idx.info < '3.5' AND t.production_yea...
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 it.id = mi_idx.info_type_id AND it.info ='rating' AND mi_idx.info > '7.0' AND t.production_year BETWEEN 2000 AND 2010
job
SELECT SUM( CASE WHEN o_orderpriority <> '1-URGENT' AND o_orderpriority <> '2-HIGH' THEN 1 ELSE 0 END ) AS low_line_count, SUM( CASE WHEN o_orderpriority = '1-URGENT' OR o_orderpriority = '2-HIGH' THEN 1 ELSE 0 END ) AS high_line_count, l_shipmode FROM orders, lineitem WHERE l_shipmode IN (1, 1) AND l_receiptdate < DAT...
tpch