text
stringlengths
84
1.49k
benchmark
stringclasses
4 values
SELECT l_orderkey, o_shippriority, SUM(l_extendedprice * (1 - l_discount)) AS revenue, o_orderdate FROM customer, orders, lineitem WHERE o_orderdate < DATE 1 AND l_orderkey = o_orderkey AND c_mktsegment = 1 AND c_custkey = o_custkey AND l_shipdate > DATE 1 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 k.keyword LIKE '%sequel%' AND t.id = mk.movie_id AND mk.movie_id = mi.movie_id AND k.id = mk.keyword_id AND mi.info = ANY(ARRAY['Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Danish', 'Norwegian', 'Germa...
job
SELECT o_orderdate, o_shippriority, SUM(l_extendedprice * (1 - l_discount)) AS revenue, l_orderkey FROM customer, orders, lineitem WHERE l_shipdate > DATE 1 AND c_custkey = o_custkey AND c_mktsegment = 1 AND l_orderkey = o_orderkey AND o_orderdate < DATE 1 GROUP BY l_orderkey, o_orderdate, o_shippriority ORDER BY reven...
tpch
SELECT COUNT(*) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v, users AS u WHERE p.AnswerCount >= 0 AND p.Id = c.PostId AND p.Id = ph.PostId AND p.Id = v.PostId AND u.Id = p.OwnerUserId AND p.PostTypeId = 1 AND p.Id = pl.PostId
stats
select min(t.title) as movie_title, min(mc.note) as production_note, min(t.production_year) as movie_year from company_type as ct, info_type as it, movie_companies as mc, movie_info_idx as mi_idx, title as t where ct.kind = 'production companies' and it.info = 'top 250 rank' and mc.note not like '%(as Metro-Goldwyn-May...
job
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 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 ct.kind = 'production companies' AND it.info = 'top 250 rank' AND mc.note NOT LIKE '%(AS Metro-Goldwyn-May...
job
SELECT MAX(chn.name) AS uncredited_voiced_character, MAX(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 = mc.movie_id AND t.production_year > 2005 AND rt.role = 'actor' AND t.id = ci.movie_id AND ci....
job
SELECT MAX(sr_net_loss) AS store_returns_loss, i_item_desc, s_store_id, MAX(cs_net_profit) AS catalog_sales_profit, i_item_id, s_store_name, MAX(ss_net_profit) AS store_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 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 = mc.movie_id AND ct.id = mc.company_type_id AND t.id = mi_idx.movie_id AND it.info = 'top 250 rank' ...
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 l_suppkey = s_suppkey AND c_nationkey = s_nationkey AND o_orderdate < DATE 1 + INTERVAL '1' YEAR AND l_orderkey = o_orderkey AND o_orderdate >= DATE 1 AND s_nat...
tpch
Select Min(mi.info) As release_date, Min(miidx.info) As rating, Min(t.title) As german_movie From company_name As cn, company_type As ct, info_type As it, info_type As it2, kind_type As kt, movie_companies As mc, movie_info As mi, movie_info_idx As miidx, title As t Where mc.movie_id = t.id And ct.kind = 'production co...
job
Select c_preferred_cust_flag, cnt, c_first_name, c_last_name, c_salutation, ss_ticket_number 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(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.role_id = rt.id AND mi.movie_id = ci.movie_id AND n.id = ci.person_id ...
job
WITH _q AS ( SELECT i_item_id, i_item_desc, i_current_price FROM item JOIN inventory ON i_item_sk = inv_item_sk JOIN date_dim ON d_date_sk = inv_date_sk JOIN store_sales ON ss_item_sk = i_item_sk WHERE inv_quantity_on_hand BETWEEN 100 AND 500 AND i_current_price BETWEEN 73 AND 73 + 30 AND d_date BETWEEN CAST('1998-01-1...
tpcds
SELECT n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, supplier, nation, region WHERE l_orderkey = o_orderkey AND c_nationkey = s_nationkey AND s_nationkey = n_nationkey AND o_orderdate >= DATE 1 AND l_suppkey = s_suppkey AND c_custkey = o_custkey AND r_name = 1 AND o_orderda...
tpch
Select ps_partkey, Sum(ps_supplycost * ps_availqty) As VALUE From partsupp, supplier, nation Where s_nationkey = n_nationkey AND n_name = 1 AND ps_suppkey = s_suppkey Group By ps_partkey Having Sum(ps_supplycost * ps_availqty) > ( Select Sum(ps_supplycost * ps_availqty) * 1 From partsupp, supplier, nation Where ps_supp...
tpch
SELECT MIN(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 k.keyword = 'marvel-cinematic-universe' AND k.id = mk.keyword_id AND n.id = ci.person_id AND n.name LIKE '%Downey%Ro...
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 ci.note LIKE '%(voice: English version)%' AND ci.movie_id = m...
job
WITH _q AS ( SELECT MIN(t.title) AS movie_title FROM keyword AS k, movie_info AS mi, movie_keyword AS mk, title AS t WHERE k.keyword LIKE '%sequel%' AND mk.movie_id = mi.movie_id AND t.id = mi.movie_id AND k.id = mk.keyword_id AND t.production_year > 2010 AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Danish', 'Swedis...
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 t.id = mc.movie_id AND t.id = mi.movie_id AND t.id = ci.movie_id AND ci.p...
job
SELECT s_acctbal, s_name, n_name, p_partkey, p_mfgr, s_address, s_phone, s_comment FROM part, supplier, partsupp, nation, region WHERE s_suppkey = ps_suppkey AND r_name = 1 AND n_regionkey = r_regionkey AND ps_supplycost = ( SELECT MIN(ps_supplycost) FROM partsupp, supplier, nation, region WHERE p_partkey = ps_partkey ...
tpch
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 ct.kind = 'production companies' AND kt.id = t....
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 it.info = 'top 250 rank' AND ct.id = mc.company_type_id AND mc.note NOT ...
job
SELECT COUNT(*) FROM comments AS c, posts AS p, postLinks AS pl WHERE p.CreationDate <= '2014-09-09 01:43:00'::timestamp AND p.CommentCount <= 18 AND p.Id = pl.PostId AND p.CreationDate >= '2010-07-23 07:27:31'::timestamp AND c.UserId = p.OwnerUserId LIMIT 50;
stats
SELECT MIN(t.title) AS movie_title FROM company_name AS cn, keyword AS k, movie_companies AS mc, movie_keyword AS mk, title AS t WHERE k.keyword ='character-name-in-title' AND mk.keyword_id = k.id AND cn.country_code ='[de]' AND mc.movie_id = t.id AND mc.movie_id = mk.movie_id AND t.id = mk.movie_id AND cn.id = mc.comp...
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 it2.info = 'release dates' AND mi.info LI...
job
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 = mk.movie_id AND mi.in...
job
SELECT nation, o_year, SUM(amount) AS sum_profit FROM ( SELECT n_name AS nation, EXTRACT(YEAR FROM o_orderdate) AS o_year, l_extendedprice * (1 - l_discount) - ps_supplycost * l_quantity AS amount FROM part, supplier, lineitem, partsupp, orders, nation WHERE ps_partkey = l_partkey AND p_partkey = l_partkey AND s_suppke...
tpch
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 k.keyword LIKE '%sequel%' AND t.id = mk.movie_id AND t.production_year > 2005 AND t.id = mi.movie_id AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Denmar...
job
Select Min(mi_idx.info) As rating, Min(t.title) As movie_title From info_type As it, movie_info_idx As mi_idx, title As t Where it.info ='rating' AND it.id = mi_idx.info_type_id AND t.production_year BETWEEN 2000 AND 2010 AND mi_idx.info > '7.0' AND t.id = mi_idx.movie_id
job
Select a.ca_state As state, COUNT(DISTINCT a.ca_state) As cnt From customer_address As a Join customer As c On a.ca_address_sk = c.c_current_addr_sk Join store_sales As s On c.c_customer_sk = s.ss_customer_sk Join date_dim As d On s.ss_sold_date_sk = d.d_date_sk Join item As i On s.ss_item_sk = i.i_item_sk Where d.d_mo...
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 p_partkey = ps_partkey AND p_size IN (1, 1, 1, 1, 1, 1, 1, 1) AND ps_suppkey NOT IN ( SELECT s_suppkey FROM supplier WHERE s_comment LIKE '%Customer%Complaints%' ) GROUP BY p_brand...
tpch
SELECT MIN(n.name) AS voicing_actress, MIN(t.title) AS voiced_movie FROM aka_name AS an, char_name AS chn, cast_info AS ci, company_name AS cn, info_type AS it, movie_companies AS mc, movie_info AS mi, name AS n, role_type AS rt, title AS t WHERE cn.country_code = '[us]' AND it.id = mi.info_type_id AND cn.id = mc.compa...
job
select CAST(promotions as DECIMAL(15, 4)) / CAST(total as DECIMAL(15, 4)) * 100, total, promotions 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 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.PostTypeId = 1 AND p.Id = c.PostId AND p.Id = ph.PostId AND p.AnswerCount >= 0 AND p.Id = v.PostId AND p.Id = pl.PostId LIMIT 500;
stats
select ss_ticket_number, c_last_name, c_preferred_cust_flag, c_salutation, cnt, c_first_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(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 mk.movie_id = ci.movie_id AND ...
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 s_nationkey = n1.n_nationkey AND c...
tpch
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 n.id = ci.person_id AND ci.person_id = an.person_id AND t.id ...
job
SELECT COUNT(1) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v, badges AS b WHERE p.Id = v.PostId AND p.Id = pl.RelatedPostId AND pl.LinkTypeId = 1 AND b.UserId = c.UserId AND c.Score = 0 AND p.Id = c.PostId AND p.Id = ph.PostId
stats
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_receiptdate < ...
tpch
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 u.Id = b.UserId AND ph.UserId = v.UserId AND v.UserId = c.UserId AND b.UserId = ph.UserId
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 ml.linked_movie_id = t.id AND n.name_pcode_cf <= 'F' AND an.person_id = ci.person_id AND lt.id = ml.link_type_id AND n...
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 mk.movie_id = ci.movie_id AND k.keyword = 'anime' AND cn.coun...
job
SELECT cnt, c_salutation, c_first_name, ss_ticket_number, c_preferred_cust_flag, 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 AVG(l_quantity) AS avg_qty, COUNT(*) AS count_order, l_linestatus, AVG(l_extendedprice) AS avg_price, l_returnflag, SUM(l_quantity) AS sum_qty, SUM(l_extendedprice) AS sum_base_price, AVG(l_discount) AS avg_disc, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, SUM(l_extendedprice * (1 - l_di...
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 s_supp...
tpch
SELECT MIN(mi.info) AS release_date, MIN(miidx.info) AS rating, MIN(t.title) AS german_movie FROM company_name AS cn, company_type AS ct, info_type AS it, info_type AS it2, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS miidx, title AS t WHERE ct.kind = 'production companies' AND miidx.movi...
job
SELECT cnt, c_salutation, c_preferred_cust_flag, c_last_name, ss_ticket_number, c_first_name 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 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 t.id = mk.movie_id AND k.id = mk.ke...
job
SELECT AVG(ss_sales_price) AS agg4, AVG(ss_list_price) AS agg2, AVG(ss_coupon_amt) AS agg3, AVG(ss_quantity) AS agg1, i_item_id 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 c_name, c_comment, c_address, c_phone, c_custkey, sum(l_extendedprice * (1 - l_discount)) as revenue, n_name, c_acctbal from customer, orders, lineitem, nation where c_custkey = o_custkey AND l_returnflag = 'R' AND o_orderdate >= DATE 1 AND l_orderkey = o_orderkey AND c_nationkey = n_nationkey AND o_orderdate < ...
tpch
SELECT c_last_name, extended_tax, extended_price, c_first_name, bought_city, ca_city, list_price, ss_ticket_number 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 SUM(l_extendedprice * (1 - l_discount)) AS revenue, o_shippriority, l_orderkey, o_orderdate FROM customer, orders, lineitem WHERE o_orderdate < DATE 1 AND l_orderkey = o_orderkey AND l_shipdate > DATE 1 AND c_mktsegment = 1 AND c_custkey = o_custkey GROUP BY l_orderkey, o_orderdate, o_shippriority ORDER BY reven...
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 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 ct.id = mc.company_type_id AND mc.movie_id = mi.movie_id AND t.id = mi.movie_id AND mc.note NOT LIKE '%(as Metro-G...
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 rt.id = ci.role_id And ci.note Like '%(uncredited)%' And cn.country_code = '[ru]' And cn.id = mc.com...
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 an.person_id = n.id AND k.keyword = 'character-name-in-title' AND cn.country_code = '[us]' ...
job
SELECT COUNT(1) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v WHERE pl.LinkTypeId = 1 AND p.Id = c.PostId AND c.Score = 0 AND p.Id = ph.PostId AND p.Id = v.PostId AND p.Id = pl.PostId AND p.FavoriteCount >= 0
stats
Select Min(cn.name) As from_company, Min(lt.link) As link_type, Min(t.title) As western_sequel From company_name As cn, company_type As ct, info_type As it, keyword As k, link_type As lt, movie_companies As mc, movie_info As mi, movie_keyword As mk, movie_link As ml, title As t Where it.info = 'release dates' AND ml.mo...
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 ci.note Like '%(voice: English version)%' And cn.country_code...
job
SELECT COUNT(ss_quantity) AS store_sales_quantitycount, AVG(sr_return_quantity) AS store_returns_quantityave, s_state, AVG(cs_quantity) AS catalog_sales_quantityave, i_item_id, AVG(ss_quantity) AS store_sales_quantityave, i_item_desc, STDDEV_SAMP(ss_quantity) AS store_sales_quantitystdev, STDDEV_SAMP(sr_return_quantity...
tpcds
SELECT o_year, nation, 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 p_name LIKE 1 ) AS profit AND o_ord...
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.info = 'bottom 10 rank' AND ct.id = mc.company_type_id AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND t.id = mi.movie_id AND (mc.note LIKE '%(co-production)%' OR m...
job
SELECT AVG(ss_ext_sales_price), AVG(ss_ext_wholesale_cost), AVG(ss_quantity), 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 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 = mc.movie_id AND ct.kind = 'production companies' AND mc.movie_id = mi_idx.movie_id AND it.info = 't...
job
select count(*) from comments as c, posts as p, postLinks as pl, postHistory as ph, votes as v, badges as b where b.UserId = c.UserId and c.Score = 0 and p.Id = c.PostId and p.Id = ph.PostId and pl.LinkTypeId = 1 and p.Id = v.PostId and p.Id = pl.RelatedPostId
stats
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 it.info = 'rating' AND ct.id = mc.company_type_...
job
SELECT COUNT(DISTINCT ps_suppkey) AS supplier_cnt, p_size, p_type, p_brand FROM partsupp, part WHERE 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 AND p_type NOT LIKE 1 AND p_partkey = ps_partkey GROUP BY p_brand...
tpch
Select Count(*) From votes As v, users As u Where v.UserId = u.Id And u.DownVotes = 0 LIMIT 10;
stats
SELECT p_type, p_brand, COUNT(DISTINCT ps_suppkey) AS supplier_cnt, p_size 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_brand != 1 AND p_size IN (1, 1, 1, 1, 1, 1, 1, 1) GROUP BY p_brand...
tpch
Select supp_nation, cust_nation, l_year, Sum(volume) As revenue From ( Select n1.n_name As supp_nation, n2.n_name As cust_nation, EXTRACT(YEAR From l_shipdate) As l_year, l_extendedprice * (1 - l_discount) As volume From supplier, lineitem, orders, customer, nation n1, nation n2 Where c_custkey = o_custkey And l_shipda...
tpch
SELECT MIN(mc.note) AS production_note, MIN(t.title) AS movie_title, MIN(t.production_year) AS movie_year FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info_idx AS mi_idx, title AS t WHERE ct.kind = 'production companies' AND mc.movie_id = mi_idx.movie_id AND it.id = mi_idx.info_type_id AND ct....
job
Select COUNT(1) From comments As c, postHistory As ph, badges As b, votes As v, users As u Where ph.UserId = v.UserId AND u.Id = b.UserId AND v.UserId = c.UserId AND ph.PostHistoryTypeId = 12 AND b.UserId = ph.UserId AND u.UpVotes = 0
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 s_suppkey = l_suppkey AND p_name Like 1 ) As profit And s_nat...
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 k.id = mk.keyword_id AND t.id = mi.movie_id AND mk.movie_id = mi.movie_id AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Danish', 'Swedish', 'Danish', 'Norwegian', 'German') AND t...
job
SELECT cnt, c_salutation, c_last_name, c_first_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 i_item_id, i_item_desc, i_current_price From item Join inventory On i_item_sk = inv_item_sk Join date_dim On d_date_sk = inv_date_sk Join store_sales On ss_item_sk = i_item_sk Where inv_quantity_on_hand Between 100 And 500 And i_current_price Between 73 And 73 + 30 And d_date Between CAST('1998-01-15' As DATE) A...
tpcds
SELECT n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, supplier, nation, region WHERE o_orderdate < DATE 1 + INTERVAL '1' YEAR AND c_nationkey = s_nationkey AND o_orderdate >= DATE 1 AND c_custkey = o_custkey AND l_suppkey = s_suppkey AND n_regionkey = r_regionkey AND s_natio...
tpch
SELECT MIN(t.title) AS biography_movie, MIN(n.name) AS of_person 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.id = pi.person_id AND n.id = an.person_id AND t.id = ci.movie_id AND ci.movie_id = ml.linked_movie_id AND it.id = pi...
job
SELECT AVG(l_quantity) AS avg_qty, l_linestatus, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, AVG(l_extendedprice) AS avg_price, SUM(l_quantity) AS sum_qty, AVG(l_discount) AS avg_disc, COUNT(*) AS count_order, l_returnflag, SUM(l_extendedprice) AS sum_base_price, SUM(l_extendedprice * (1 - l_discount) * ...
tpch
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 mi_idx.movie_id = mc.movie_id AND it1.id = mi_idx.info_type_id AND at....
job
Select Min(n.name) As of_person, Min(t.title) As biography_movie From aka_name As an, cast_info As ci, info_type As it, link_type As lt, movie_link As ml, name As n, person_info As pi, title As t Where pi.person_id = an.person_id AND (n.gender = 'm' Or (n.gender = 'f' And n.name Like 'B%')) AND ci.movie_id = ml.linked_...
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 n.name LIKE '%Hemsworth%Chris%' AND t.production_year > 2010 AND k.keyword = 'marvel-cinematic-universe' AND n.id = ci.person_id AND t.id =...
job
WITH _q AS ( 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_name LIKE 1 ) AS profit AND o_orderkey = l_ord...
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.id = mi.movie_id AND mi.info = ANY(ARRAY['Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Denish', 'Norwegian', 'German']) AND t.id = mk.movie_id AND mk.movie_id = mi.movie_id AND t.production_year > 200...
job
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 mc.note Like '%(USA)%' AND t.produc...
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 cn.country_code = '[us]' AND it1.id = mi_idx.info_type_id AND mi_idx.i...
job
SELECT c_last_name, c_first_name, c_salutation, c_preferred_cust_flag, ss_ticket_number, cnt FROM ( SELECT ss_ticket_number, ss_customer_sk, COUNT(*) AS cnt FROM store_sales JOIN date_dim ON ss_sold_date_sk = d_date_sk JOIN store ON ss_store_sk = s_store_sk JOIN household_demographics ON ss_hdemo_sk = hd_demo_sk WHERE ...
tpcds
SELECT COUNT(cs_quantity) AS catalog_sales_quantitycount, STDDEV_SAMP(ss_quantity) AS store_sales_quantitystdev, COUNT(ss_quantity) AS store_sales_quantitycount, STDDEV_SAMP(sr_return_quantity) AS store_returns_quantitystdev, STDDEV_SAMP(ss_quantity) / AVG(ss_quantity) AS store_sales_quantitycov, i_item_desc, AVG(sr_re...
tpcds
SELECT n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, supplier, nation, region WHERE c_nationkey = s_nationkey AND s_nationkey = n_nationkey AND l_orderkey = o_orderkey AND c_custkey = o_custkey AND n_regionkey = r_regionkey AND o_orderdate >= DATE 1 AND o_orderdate < DATE 1...
tpch
WITH year_total AS ( SELECT c_login AS customer_login, c_first_name AS customer_first_name, c_last_name AS customer_last_name, c_customer_id AS customer_id, d_year AS dyear, c_email_address AS customer_email_address, c_birth_country AS customer_birth_country, SUM(((ss_ext_list_price - ss_ext_wholesale_cost - ss_ext_dis...
tpcds
Select Count(*) From comments As c, posts As p, postLinks As pl, postHistory As ph, votes As v, badges As b Where c.Score = 0 And p.Id = v.PostId And pl.LinkTypeId = 1 And p.Id = ph.PostId And p.Id = c.PostId And b.UserId = c.UserId And p.Id = pl.RelatedPostId Limit 50;
stats
SELECT s_suppkey, s_address, s_name, s_phone, total_revenue FROM supplier, revenue0 WHERE s_suppkey = supplier_no AND total_revenue = ( SELECT MAX(total_revenue) FROM revenue0 ) ORDER BY s_suppkey
tpch
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_name L...
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 rt.id = ci.role_id AND ci.note LIKE '%(voice)%' AND t.id = mc.movie_id AND chn.id = ci.person_role_i...
job
Select cc_call_center_id As call_center, cc_name As call_center_name, cc_manager As manager, Sum(cr_net_loss) As returns_loss From call_center 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(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.id = pi.person_id AND it.info = 'mini biography' AND an.name LIKE '%a%' AND pi.person_id = ci.person_id AND it.id = ...
job
Select Min(mc.note) As production_note, Min(t.title) As movie_title, Min(t.production_year) As movie_year From company_type As ct, info_type As it, movie_companies As mc, movie_info_idx As mi_idx, title As t Where (mc.note Like '%(co-production)%' Or mc.note Like '%(presents)%') And it.id = mi_idx.info_type_id And ct.i...
job