text
stringlengths
84
1.49k
benchmark
stringclasses
4 values
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_orderkey = o_orderkey AND r_name = 1 AND s_nationkey = n_nationkey AND c_nationkey = s_nationkey AND o_orderdate >= DATE 1 AND l_suppkey = s_suppkey AND o_ord...
tpch
With year_total As ( Select c_birth_country As customer_birth_country, c_last_name As customer_last_name, c_login As customer_login, c_email_address As customer_email_address, 's' As sale_type, c_preferred_cust_flag As customer_preferred_cust_flag, c_first_name As customer_first_name, d_year As dyear, c_customer_id As ...
tpcds
Select i_item_id, Sum(cs_quantity) As catalog_sales_quantity, i_item_desc, Sum(sr_return_quantity) As store_returns_quantity, s_store_id, s_store_name, Sum(ss_quantity) As store_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 SUM(sr_return_quantity) AS store_returns_quantity, i_item_id, SUM(cs_quantity) AS catalog_sales_quantity, SUM(ss_quantity) AS store_sales_quantity, s_store_id, i_item_desc, s_store_name 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 SUM(l_extendedprice * (1 - l_discount)) AS revenue, l_orderkey, o_shippriority, o_orderdate FROM customer, orders, lineitem WHERE c_mktsegment = 1 AND c_custkey = o_custkey AND l_shipdate > DATE 1 AND o_orderdate < DATE 1 AND l_orderkey = o_orderkey GROUP BY l_orderkey, o_orderdate, o_shippriority ORDER BY reven...
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 rt.role = 'actress' AND ci.role_id = rt.id AND n.gender = 'f' AND it.info...
job
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 s_acctbal, s_name, n_name, p_partkey, p_mfgr, s_address, s_phone, s_comment FROM part, supplier, partsupp, nation, region WHERE p_type LIKE 1 AND r_name = 1 AND s_nationkey = n_nationkey AND s_suppkey = ps_suppkey AND p_size = 1 AND p_partkey = ps_partkey AND n_regionkey = r_regionkey AND ps_supplycost = ( SELEC...
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 supp_nation, cust_nation, l_year, SUM(volume) AS revenue FROM ( SELECT n1.n_name AS supp_nation, n2.n_name AS cust_nation, EXTRACT(YEAR FROM l_shipdate) AS l_year, l_extendedprice * (1 - l_discount) AS volume FROM supplier, lineitem, orders, customer, nation n1, nation n2 WHERE l_shipdate BETWEEN DATE '1995-01-0...
tpch
select 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 l_receiptdate >= DA...
tpch
WITH _q AS ( select min(n.name) as of_person, min(t.title) as biography_movie from aka_name as an, cast_info as ci, info_type as it, link_type as lt, movie_link as ml, name as n, person_info as pi, title as t where it.id = pi.info_type_id AND ci.person_id = n.id AND pi.note = 'Volker Boehm' AND an.person_id = ci.person...
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 t.id = mc.movie_id AND (mc.note LIKE '%(co-production)%' OR mc.note LIKE '...
job
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 t.id = mi_idx.movie_id AND mc.movie_id = mi_idx.movie_id AND it.id = mi_idx.info_type_id AND ct.kind = 'pr...
job
SELECT l_linestatus, SUM(l_extendedprice) AS sum_base_price, AVG(l_extendedprice) AS avg_price, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, l_returnflag, AVG(l_discount) AS avg_disc, AVG(l_quantity) AS avg_qty, COUNT(*) AS count_order, ...
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.id = mc.company_id AND t.id = mk.movie_id AND mk.keyword_id = k.id AND mc.movie_id = t.id AND cn.country_code ='[de]' AND k.keyword ='character-name-IN-title' AND mc.movie_id = mk.mo...
job
SELECT SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, COUNT(*) AS count_order, AVG(l_quantity) AS avg_qty, SUM(l_quantity) AS sum_qty, SUM(l_extendedprice) AS sum_base_price, l_linestatus, l_returnflag, AVG(l_discount) AS avg_disc, AVG(l_e...
tpch
SELECT s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE n_name = 1 AND o_orderkey = l1.l_orderkey AND 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 o_orderstatus = 'F' AND NOT EXISTS ( SELECT * FROM ...
tpch
SELECT o_orderdate, o_shippriority, l_orderkey, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem WHERE c_mktsegment = 1 AND l_orderkey = o_orderkey AND l_shipdate > DATE 1 AND o_orderdate < DATE 1 AND c_custkey = o_custkey GROUP BY l_orderkey, o_orderdate, o_shippriority ORDER BY reven...
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 Between 0 And 5 And (ss_list_price Between 70 And 70 + 10 Or ss_coupon_amt Between 1715 And 1715 + 1000 Or ss_wholesale_cost Between 64 And 64 + 20) ) As b3 And...
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.note LIKE '%(uncredited)%' AND t.production_year > 2005 AND cn.country_code = '[ru]' AND cn.id = ...
job
SELECT COUNT(*) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v, badges AS b WHERE p.Id = c.PostId AND c.Score = 0 AND p.Id = v.PostId AND p.Id = ph.PostId AND b.UserId = c.UserId AND pl.LinkTypeId = 1 AND p.Id = pl.RelatedPostId
stats
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 = mc.movie_id AND k.keyword = 'character-name-IN-title' AND ci.movie_id = t.id ...
job
WITH _q AS ( SELECT MIN(t.title) AS movie_title FROM company_name AS cn, keyword AS k, movie_companies AS mc, movie_keyword AS mk, title AS t WHERE cn.country_code ='[nl]' AND t.id = mk.movie_id AND mc.movie_id = t.id AND cn.id = mc.company_id AND k.keyword ='character-name-in-title' AND mk.keyword_id = k.id AND mc.mov...
job
select c_count, count(*) as custdist from ( select c_custkey, count(o_orderkey) as c_count from customer left outer join orders on c_custkey = o_custkey and o_comment not like 1 group by c_custkey ) as c_orders group by c_count order by custdist desc, c_count desc limit 200;
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.name_pcode_cf BETWEEN 'A' AND 'F' AND ci.person_id = n.id AND ci.movie_id = ml.linked_movie_id AND (n.gender = 'm' O...
job
SELECT AVG(cs_coupon_amt) AS agg3, AVG(cs_quantity) AS agg1, AVG(cs_list_price) AS agg2, i_item_id, 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 p_brand, p_type, p_size, COUNT(DISTINCT ps_suppkey) AS supplier_cnt FROM partsupp, part WHERE p_brand <> 1 AND p_size IN (1, 1, 1, 1, 1, 1, 1, 1) AND p_partkey = ps_partkey AND NOT EXISTS (SELECT 1 FROM (SELECT s_suppkey FROM supplier WHERE s_comment LIKE '%Customer%Complaints%') AS _ne WHERE _ne.ps_suppkey = ps...
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 k.keyword ='character-name-in-title' AND mc.movie_id = t.id AND t.id = mk.movie_id AND cn.country_code ='[de]' AND mk.keyword_id = k.id AND mc.movie_id = mk.movie_id AND cn.id = mc.comp...
job
SELECT COUNT(ss_quantity) AS store_sales_quantitycount, COUNT(sr_return_quantity) AS store_returns_quantitycount, COUNT(cs_quantity) AS catalog_sales_quantitycount, STDDEV_SAMP(sr_return_quantity) AS store_returns_quantitystdev, STDDEV_SAMP(cs_quantity) / AVG(cs_quantity) AS catalog_sales_quantitycov, STDDEV_SAMP(ss_qu...
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 it.id = mi_idx.info_type_id AND it.info = 'top 250 rank' AND t.id = mc.movie_id AND ct.id = mc.company_typ...
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 an.person_id = ci.person_id AND n.name_pcode_cf BETWEEN 'A' AND 'F' AND pi.note = 'Volker Boehm' AND ci.movie_id = ml....
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.id = ci.person_id And k.keyword = 'marvel-cinematic-universe' And k.id = mk.keyword_id And t.production_year > 2010 And t.id = ci.movie_i...
job
WITH _q AS ( 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 at.movie_id = mi_idx.movie_i...
job
SELECT COUNT(DISTINCT ps_suppkey) AS supplier_cnt, p_size, p_type, p_brand FROM partsupp, part WHERE p_size IN (1, 1, 1, 1, 1, 1, 1, 1) AND p_type NOT LIKE 1 AND p_partkey = ps_partkey AND p_brand <> 1 AND ps_suppkey NOT IN ( SELECT s_suppkey FROM supplier WHERE s_comment LIKE '%Customer%Complaints%' ) GROUP BY p_brand...
tpch
Select i_item_id, Avg(ss_list_price) As agg2, Avg(ss_coupon_amt) As agg3, Avg(ss_quantity) As agg1, 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_year, SUM( CASE WHEN nation = 1 THEN volume ELSE 0 END ) / SUM(volume) AS mkt_share FROM ( SELECT EXTRACT(YEAR FROM o_orderdate) AS o_year, l_extendedprice * (1 - l_discount) AS volume, n2.n_name AS nation FROM part, supplier, lineitem, orders, customer, nation n1, nation n2, region WHERE s_nationkey = n2.n_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 mk.keyword_id = k.id AND mc.movie_id = t.id AND mc.movie_id = mk.movie_id AND k.keyword ='character-name-in-title' AND t.id = mk.movie_id AND cn.id = mc.company_id AND cn.country_code =...
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_idx.movie_id AND cn.country_code = '[us]' AND it2.inf...
job
Select o_orderpriority, COUNT(1) As order_count From orders Where o_orderdate >= DATE 1 AND o_orderdate < DATE 1 + INTERVAL '3' MONTH AND Exists ( Select * From lineitem Where l_orderkey = o_orderkey And l_commitdate < l_receiptdate ) Group By o_orderpriority Order By o_orderpriority
tpch
SELECT COUNT(*) FROM comments AS c, postHistory AS ph, badges AS b, votes AS v, users AS u WHERE b.UserId = ph.UserId AND ph.PostHistoryTypeId = 12 AND ph.UserId = v.UserId AND u.Id = b.UserId AND v.UserId = c.UserId AND u.UpVotes = 0 LIMIT 100;
stats
SELECT s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE s_suppkey = l1.l_suppkey AND EXISTS ( SELECT * FROM lineitem l2 WHERE l2.l_orderkey = l1.l_orderkey AND l2.l_suppkey <> l1.l_suppkey ) AND l1.l_receiptdate > l1.l_commitdate AND o_orderkey = l1.l_orderkey AND n_name = 1 AND o_orderstatu...
tpch
Select promotions, total, CAST(promotions As DECIMAL(15, 4)) / CAST(total As DECIMAL(15, 4)) * 100 From ( Select Sum(ss_ext_sales_price) As promotions From store_sales Join store On ss_store_sk = s_store_sk Join promotion On ss_promo_sk = p_promo_sk Join date_dim On ss_sold_date_sk = d_date_sk Join customer On ss_custo...
tpcds
Select Count(*) From comments As c, posts As p, users As u Where c.UserId = u.Id And u.Id = p.OwnerUserId And p.CommentCount >= 0 And c.CreationDate >= '2010-08-05 00:36:02'::timestamp And p.ViewCount >= 0 And p.FavoriteCount >= 0
stats
WITH _q AS ( SELECT s_suppkey, s_phone, s_name, total_revenue, s_address FROM supplier, revenue0 WHERE total_revenue = ( SELECT MAX(total_revenue) FROM revenue0 ) AND s_suppkey = supplier_no ORDER BY s_suppkey ) SELECT * FROM _q;
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 t.id = ci.movie_id AND ci.movie_id = mk.movie_id AND n.id = ci.person_id AND n.name LIKE '%Downey%Robert%' AND k.id = mk.keyword_id AND t.p...
job
SELECT MAX(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 = ANY(ARRAY['Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Danish', 'Norwegian', 'German']) AND t.id = mk.movie_id AND k.id = mk.keywor...
job
With _q As ( Select cntrycode, Count(*) As numcust, Sum(c_acctbal) As totacctbal From ( Select SUBSTRING(c_phone From 1 FOR 2) As cntrycode, c_acctbal From customer Where Not Exists ( Select * From orders Where o_custkey = c_custkey ) ) As custsale And c_acctbal > ( Select Avg(c_acctbal) From customer Where c_acctbal >...
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.Id = v.PostId and pl.LinkTypeId = 1 and c.UserId = u.Id and p.Score <= 40 and p.Id = pl.RelatedPostId and p.Id = ph.PostId and p.Id = c.PostId and b.UserId = u.Id
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_nationkey = n_nationkey AND p_partkey = l_partkey AND p_nam...
tpch
Select c_last_name, c_first_name, c_salutation, c_preferred_cust_flag, ss_ticket_number, cnt From ( Select ss_ticket_number, ss_customer_sk, Count(*) As cnt From store_sales 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
WITH _q AS ( Select l_shipmode, Sum( Case When o_orderpriority = '1-URGENT' Or o_orderpriority = '2-HIGH' Then 1 Else 0 End ) As high_line_count, Sum( Case When o_orderpriority <> '1-URGENT' And o_orderpriority <> '2-HIGH' Then 1 Else 0 End ) As low_line_count From orders, lineitem Where l_shipdate < l_commitdate AND l...
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 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 = miidx.movie...
job
SELECT AVG(cs_sales_price) AS agg4, AVG(cs_list_price) AS agg2, AVG(cs_quantity) AS agg1, i_item_id, AVG(cs_coupon_amt) AS agg3 FROM catalog_sales JOIN customer_demographics ON cs_bill_cdemo_sk = cd_demo_sk JOIN date_dim ON cs_sold_date_sk = d_date_sk JOIN item ON cs_item_sk = i_item_sk JOIN promotion ON cs_promo_sk = ...
tpcds
Select Min(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 ml.mo...
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 t.id = mi_idx.movie_id AND ct.id = m...
job
SELECT MIN(t.title) AS western_violent_movie, MIN(cn.name) AS movie_company, MIN(mi_idx.info) AS rating 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 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 k.keyword ='character-name-in-title' AND mc.movie_id = mk.movie_id AND t.id = mk.movie_id AND cn.country_code ='[nl]' AND mc.movie_id = t.id AND mk.keyword_id ...
job
SELECT MIN(t.title) AS movie_title FROM company_name AS cn, keyword AS k, movie_companies AS mc, movie_keyword AS mk, title AS t WHERE mk.keyword_id = k.id AND mc.movie_id = mk.movie_id AND cn.id = mc.company_id AND t.id = mk.movie_id AND k.keyword ='character-name-in-title' AND mc.movie_id = t.id AND cn.country_code =...
job
SELECT COUNT(*) FROM comments AS c, posts AS p, votes AS v, users AS u WHERE p.ViewCount >= 0 AND c.Score = 0 AND u.Id = p.OwnerUserId AND u.Id = c.UserId AND u.Id = v.UserId AND p.Score >= 0 LIMIT 10;
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 ps_suppkey = l_suppkey AND ps_partk...
tpch
SELECT o_orderdate, SUM(l_extendedprice * (1 - l_discount)) AS revenue, o_shippriority, l_orderkey FROM customer, orders, lineitem WHERE c_mktsegment = 1 AND l_shipdate > DATE 1 AND c_custkey = o_custkey AND o_orderdate < DATE 1 AND l_orderkey = o_orderkey GROUP BY l_orderkey, o_orderdate, o_shippriority ORDER BY reven...
tpch
SELECT COUNT(*) AS count_order, AVG(l_extendedprice) AS avg_price, SUM(l_extendedprice) AS sum_base_price, AVG(l_discount) AS avg_disc, l_returnflag, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, SUM(l_quantity) AS sum_qty, l_linestatus, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, ...
tpch
select count(*) 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 p.Id = pl.PostId AND p.Id = v.PostId AND p.Id = ph.PostId AND p.FavoriteCount >= 0 AND c.Score = 0
stats
select s_store_id, i_item_desc, s_store_name, max(cs_net_profit) as catalog_sales_profit, max(ss_net_profit) as store_sales_profit, max(sr_net_loss) as store_returns_loss, i_item_id 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 s_name, s_address From supplier, nation Where s_suppkey In ( Select ps_suppkey From partsupp Where ps_partkey In ( Select p_partkey From part Where p_name Like 1 ) And ps_availqty > ( Select 0.5 * Sum(l_quantity) From lineitem Where l_partkey = ps_partkey And l_suppkey = ps_suppkey And l_shipdate >= DATE 1 And l...
tpch
select i_brand_id as brand_id, i_brand as brand, i_manufact_id, i_manufact, 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 join customer on ss_customer_sk = c_customer_sk join customer_address on c_current_addr_sk = ca_address_sk jo...
tpcds
With year_total As ( Select c_last_name As customer_last_name, c_birth_country As customer_birth_country, c_login As customer_login, c_first_name As customer_first_name, 's' As sale_type, c_preferred_cust_flag As customer_preferred_cust_flag, Sum(((ss_ext_list_price - ss_ext_wholesale_cost - ss_ext_discount_amt) + ss_e...
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 mc.note LIKE '%(USA)%' AND n.id = ci.person_id AND cn.country_code = '[us...
job
SELECT COUNT(1) FROM postHistory AS ph, posts AS p, votes AS v, badges AS b, users AS u, comments AS c WHERE p.Id = v.PostId AND u.Id = p.OwnerUserId AND p.ViewCount >= 0 AND p.Id = c.PostId AND p.Id = ph.PostId AND p.Score <= 192 AND u.Id = b.UserId
stats
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 = mc.movie_id AND ci.role_id = rt.id AND mc.note ...
job
SELECT MIN(an1.name) AS actress_pseudonym, MIN(t.title) AS japanese_movie_dubbed FROM aka_name AS an1, cast_info AS ci, company_name AS cn, movie_companies AS mc, name AS n1, role_type AS rt, title AS t WHERE n1.id = ci.person_id AND ci.movie_id = mc.movie_id AND rt.role = 'actress' AND mc.note NOT LIKE '%(USA)%' AND c...
job
SELECT COUNT(1) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v, badges AS b, users AS u WHERE pl.LinkTypeId = 1 AND p.Id = ph.PostId AND p.Id = v.PostId AND p.Id = pl.RelatedPostId AND c.UserId = u.Id AND p.Score <= 40 AND b.UserId = u.Id AND p.Id = c.PostId
stats
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 count(*) from votes as v, posts as p, users as u where u.Reputation >= 1 AND p.PostTypeId = 1 AND v.UserId = u.Id AND v.PostId = p.Id LIMIT 1000;
stats
SELECT MIN(an1.name) AS actress_pseudonym, MIN(t.title) AS japanese_movie_dubbed FROM aka_name AS an1, cast_info AS ci, company_name AS cn, movie_companies AS mc, name AS n1, role_type AS rt, title AS t WHERE an1.person_id = ci.person_id AND mc.company_id = cn.id AND ci.role_id = rt.id AND mc.note LIKE '%(Japan)%' AND ...
job
select min(t.title) as movie_title from keyword as k, movie_info as mi, movie_keyword as mk, title as t where t.id = mi.movie_id and t.production_year > 2000 and mi.info in ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Danish', 'Norwegian', 'German') and t.id = mk.movie_id and mk.movie_id = mi.movie_id and k.i...
job
WITH _q AS ( 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 =...
tpcds
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(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 rt.role = 'actress' AND ci.movie_id = mc.movie_id AND ci.note = '(voice: English version)' AND n1.name LIKE '%Y...
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 t.id = mc.movie_id AND it.info = 'bottom 10 rank' AND t.id = mi.movie_id AND ct.kind = 'production companies' AND ct.id = mc.company_type_id AND mc.note NOT LIKE '%(as Metro-Goldwyn-...
job
SELECT MIN(an.name) AS cool_actor_pseudonym, MIN(t.title) AS series_named_after_char FROM aka_name AS an, cast_info AS ci, company_name AS cn, keyword AS k, movie_companies AS mc, movie_keyword AS mk, name AS n, title AS t WHERE t.id = mk.movie_id AND an.person_id = ci.person_id AND mc.movie_id = mk.movie_id AND t.epis...
job
SELECT l_returnflag, SUM(l_extendedprice) AS sum_base_price, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, l_linestatus, AVG(l_discount) AS avg_disc, COUNT(*) AS count_order, SUM(l_quantity) AS sum_qty, AVG(l_extendedprice) AS avg_price, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, ...
tpch
Select i_brand As brand, i_manufact_id, i_manufact, Sum(ss_ext_sales_price) As ext_price, i_brand_id As brand_id From date_dim Join store_sales On d_date_sk = ss_sold_date_sk Join item On ss_item_sk = i_item_sk Join customer On ss_customer_sk = c_customer_sk Join customer_address On c_current_addr_sk = ca_address_sk Jo...
tpcds
select sum(l_extendedprice * l_discount) as revenue from lineitem where l_quantity < 1 AND l_shipdate >= DATE 1 AND l_shipdate < DATE 1 + INTERVAL '1' YEAR AND l_discount BETWEEN 1 - 0.01 AND 1 + 0.01 LIMIT 50;
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 n.name LIKE '%Hemsworth%Chris%' AND t.id = ci.movie_id AND ci.m...
job
SELECT MIN(mc.note) AS production_note, MIN(t.production_year) AS movie_year, MIN(t.title) AS movie_title FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info_idx AS mi_idx, title AS t WHERE mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND ct.kind = 'production companies' AND it.info = ...
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 t.id = mi_idx.movie_id AND t.id = mi.movie_id AND it2.id = mi.info_typ...
job
SELECT AVG(ss_quantity), AVG(ss_ext_sales_price), AVG(ss_ext_wholesale_cost), SUM(ss_ext_wholesale_cost) FROM store_sales INNER JOIN store ON s_store_sk = ss_store_sk INNER JOIN customer_demographics ON cd_demo_sk = ss_cdemo_sk INNER JOIN household_demographics ON hd_demo_sk = ss_hdemo_sk INNER JOIN customer_address ON...
tpcds
SELECT MIN(t.title) AS movie_title FROM keyword AS k, movie_info AS mi, movie_keyword AS mk, title AS t WHERE t.id = mk.movie_id AND k.id = mk.keyword_id AND t.production_year > 2005 AND t.id = mi.movie_id AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Denish', 'Norwegian', 'German') AND mk.movie...
job
SELECT MIN(n.name) AS actor_name, MIN(k.keyword) AS movie_keyword, MIN(t.title) AS marvel_movie FROM cast_info AS ci, keyword AS k, movie_keyword AS mk, name AS n, title AS t WHERE k.id = mk.keyword_id AND t.id = mk.movie_id AND k.keyword = 'marvel-cinematic-universe' AND n.name LIKE '%Hemsworth%Chris%' AND t.id = ci.m...
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.note = 'Volker Boehm' and it.info = 'mini biography' and n.name_pcode_cf between 'A' and 'F' and n.id = pi.person_i...
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 = ph.PostId AND pl.LinkTypeId = 1 AND p.Id = v.PostId AND p.Id = c.PostId AND p.Id = pl.RelatedPostId AND b.UserId = c.UserId AND c.Score = 0
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 mi_idx.info < '3.5' AND t.id = mi_idx.movie_id AND it1.info = 'rating'...
job
SELECT MIN(an1.name) AS actress_pseudonym, MIN(t.title) AS japanese_movie_dubbed FROM aka_name AS an1, cast_info AS ci, company_name AS cn, movie_companies AS mc, name AS n1, role_type AS rt, title AS t WHERE n1.id = ci.person_id AND ci.role_id = rt.id AND rt.role = 'actress' AND mc.note LIKE '%(Japan)%' AND t.id = mc....
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 miidx.movie_id = mc.movie_id AND it.id = miidx....
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 ci.movie_id = mk.movie_id AND n.id = ci.person_id AND an.person_id...
job
SELECT MIN(t.title) AS movie_title FROM keyword AS k, movie_info AS mi, movie_keyword AS mk, title AS t WHERE mi.info IN ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Danish', 'Norwegian', 'German') AND t.production_year > 2000 AND k.keyword LIKE '%sequel%' AND mk.movie_id = mi.movie_id AND t.id = mk.movie_id ...
job
Select COUNT(1) From comments As c, posts As p, votes As v Where p.Id = v.PostId And c.PostId = p.Id And c.Score = 0 And v.VoteTypeId = 2
stats