text
stringlengths
84
1.49k
benchmark
stringclasses
4 values
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 ct.id = mc.company_type_id AND mc.movie_id = mi_idx.movie_id AND it.id = mi_idx...
job
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 t.production_year > 2000 AND k.id = mk.keyword_id AND t.id = mi.movie_id AND t.id = mk.movie_id AND mi.info = ANY(ARRAY['Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Danish...
job
SELECT s_store_name, s_store_id, MAX(cs_net_profit) AS catalog_sales_profit, MAX(sr_net_loss) AS store_returns_loss, i_item_desc, i_item_id, 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(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.production_year > 2010 AND t.id = mi.movie_id AND mi.info = ANY(ARRAY['Sweden', 'Norway', 'Germany', 'Danish', 'Swedish', 'Danish', 'Norwegian', 'German']) AND t.id = mk.movie_id AND ...
job
SELECT c_custkey, c_comment, c_acctbal, SUM(l_extendedprice * (1 - l_discount)) AS revenue, c_phone, n_name, c_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, votes AS v, badges AS b, users AS u WHERE u.Id = v.UserId AND u.Id = c.UserId AND u.Id = b.UserId AND c.Score = 1 AND u.CreationDate >= '2010-07-20 01:27:29'::timestamp LIMIT 1000;
stats
SELECT MIN(t.title) AS western_sequel, MIN(cn.name) AS from_company, MIN(lt.link) AS link_type 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.production_year > 1950 AND it.id ...
job
SELECT s_store_name, SUM(sr_return_quantity) AS store_returns_quantity, SUM(ss_quantity) AS store_sales_quantity, SUM(cs_quantity) AS catalog_sales_quantity, i_item_id, s_store_id, i_item_desc FROM store_sales JOIN store_returns ON ss_customer_sk = sr_customer_sk AND ss_item_sk = sr_item_sk AND ss_ticket_number = sr_ti...
tpcds
SELECT MIN(n.name) AS voicing_actress, MIN(t.title) AS voiced_movie FROM aka_name AS an, char_name AS chn, cast_info AS ci, company_name AS cn, info_type AS it, movie_companies AS mc, movie_info AS mi, name AS n, role_type AS rt, title AS t WHERE mi.movie_id = ci.movie_id AND t.id = mi.movie_id AND n.id = ci.person_id ...
job
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 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 r_name = 1 AND l_orderkey = o_orderkey AND s_nationkey = n_nationkey AND c_custkey = o_custkey AND o_orderdate >= DATE 1 AND n_regionkey = r_regi...
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 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
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 k.keyword ='character-name-IN-title' AND cn.id = mc.company_id AND mc.movie_id = t.id AND t.id = mk.movie_id AND mk.keyword_id = k.id AND mc.mov...
job
WITH _q AS ( SELECT COUNT(*) FROM comments AS c, posts AS p, postLinks AS pl, votes AS v WHERE v.VoteTypeId = 2 ) SELECT * FROM _q AND p.Id = c.PostId AND c.CreationDate >= '2010-08-02 23:52:10'::timestamp AND p.Score >= -3 AND c.PostId = pl.PostId AND pl.PostId = v.PostId
stats
WITH _q AS ( 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 ...
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 it.info = 'rating' AND kt...
job
SELECT COUNT(*) FROM postHistory AS ph, posts AS p, votes AS v, badges AS b, users AS u, comments AS c WHERE u.Id = p.OwnerUserId AND p.Score <= 192 AND p.Id = v.PostId AND u.Id = b.UserId AND p.ViewCount >= 0 AND p.Id = c.PostId AND p.Id = ph.PostId
stats
SELECT MIN(k.keyword) AS movie_keyword, MIN(n.name) AS actor_name, MIN(t.title) AS marvel_movie FROM cast_info AS ci, keyword AS k, movie_keyword AS mk, name AS n, title AS t WHERE n.id = ci.person_id AND t.production_year > 2010 AND t.id = ci.movie_id AND t.id = mk.movie_id AND k.keyword = 'marvel-cinematic-universe' ...
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 rt.role = 'actor' AND cn.country_code = '[ru]' AND t.production_year > 2005 A...
job
SELECT o_orderpriority, COUNT(1) AS order_count FROM orders WHERE EXISTS ( SELECT * FROM lineitem WHERE l_orderkey = o_orderkey AND l_commitdate < l_receiptdate ) AND o_orderdate < DATE 1 + INTERVAL '3' MONTH AND o_orderdate >= DATE 1 GROUP BY o_orderpriority ORDER BY o_orderpriority LIMIT 500;
tpch
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 cn.country_code = '[us]' AND t.id =...
job
SELECT o_year, SUM( CASE WHEN nation = 1 THEN volume ELSE 0 END ) / SUM(volume) AS mkt_share FROM ( SELECT EXTRACT(YEAR FROM o_orderdate) AS o_year, l_extendedprice * (1 - l_discount) AS volume, n2.n_name AS nation FROM part, supplier, lineitem, orders, customer, nation n1, nation n2, region WHERE n1.n_regionkey = r_re...
tpch
Select Min(an1.name) As actress_pseudonym, Min(t.title) As japanese_movie_dubbed From aka_name As an1, cast_info As ci, company_name As cn, movie_companies As mc, name As n1, role_type As rt, title As t Where mc.note Like '%(Japan)%' And ci.movie_id = t.id And an1.person_id = ci.person_id And n1.name Not Like '%Yu%' An...
job
SELECT SUM( CASE WHEN o_orderpriority <> '1-URGENT' AND o_orderpriority <> '2-HIGH' THEN 1 ELSE 0 END ) AS low_line_count, l_shipmode, SUM( CASE WHEN o_orderpriority = '1-URGENT' OR o_orderpriority = '2-HIGH' THEN 1 ELSE 0 END ) AS high_line_count FROM orders, lineitem WHERE l_receiptdate >= DATE 1 AND o_orderkey = l_o...
tpch
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
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 cn.id = mc.company_id AND t.id = mk.movie_id AND k.keyword ='character-name-IN-title' AND mc.movie_id = mk.movie_id AND mc.movie_id = t.id AND cn.country_code =...
job
SELECT MIN(t.title) AS american_movie FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info AS mi, title AS t WHERE ct.id = mc.company_type_id AND ct.kind = 'production companies' AND mc.movie_id = mi.movie_id AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND it.id = mi.info_type_id A...
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 lt.link = 'features' AND pi.note = 'Volker Boehm' AND t.production_year BETWEEN 1980 AND 1995 AND ci.movie_id = ml.lin...
job
SELECT MAX(mc.note) AS production_note, MAX(t.title) AS movie_title, MAX(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 ct.kind = 'production companies' AND...
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 t.id = mc.movie_id AND mi.note LIKE...
job
select l_shipmode, sum( case when o_orderpriority = '1-URGENT' or o_orderpriority = '2-HIGH' then 1 else 0 end ) as high_line_count, sum( case when o_orderpriority <> '1-URGENT' and o_orderpriority <> '2-HIGH' then 1 else 0 end ) as low_line_count from orders, lineitem where o_orderkey = l_orderkey AND l_shipdate < l_c...
tpch
SELECT s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE l1.l_receiptdate > l1.l_commitdate AND s_suppkey = l1.l_suppkey AND o_orderstatus = 'F' AND NOT EXISTS ( SELECT * FROM lineitem l3 WHERE l3.l_orderkey = l1.l_orderkey AND l3.l_suppkey <> l1.l_suppkey AND l3.l_receiptdate > l3.l_commitda...
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.id = mc.company_type_id AND (mc.note LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%') AND mc.no...
job
SELECT AVG(ss_quantity) AS store_sales_quantityave, COUNT(sr_return_quantity) AS store_returns_quantitycount, i_item_desc, STDDEV_SAMP(cs_quantity) / AVG(cs_quantity) AS catalog_sales_quantitycov, STDDEV_SAMP(sr_return_quantity) AS store_returns_quantitystdev, STDDEV_SAMP(ss_quantity) AS store_sales_quantitystdev, s_st...
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.gender = 'm' OR (n.gender = 'f' AND n.name LIKE 'B%')) AND it.id = pi.info_type_id AND n.id = pi.person_id AND an.p...
job
SELECT * FROM ( SELECT AVG(ss_list_price) AS b1_lp, COUNT(ss_list_price) AS b1_cnt, COUNT(DISTINCT ss_list_price) AS b1_cntd FROM store_sales WHERE (ss_list_price BETWEEN 90 AND 90 + 10 OR ss_coupon_amt BETWEEN 1530 AND 1530 + 1000 OR ss_wholesale_cost BETWEEN 89 AND 89 + 20) ) AS b3 AND (ss_list_price BETWEEN 10 AND 1...
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 = mc.movie_id AND lt.link LIKE...
job
SELECT extended_tax, bought_city, ca_city, c_first_name, extended_price, c_last_name, ss_ticket_number, list_price FROM ( SELECT ss_ticket_number, ss_customer_sk, ca_city AS bought_city, SUM(ss_ext_sales_price) AS extended_price, SUM(ss_ext_list_price) AS list_price, SUM(ss_ext_tax) AS extended_tax FROM store_sales INN...
tpcds
SELECT MIN(mi_idx.info) AS rating, MIN(t.title) AS northamerican_movie FROM aka_title AS at, company_name AS cn, info_type AS it1, info_type AS it2, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS mi_idx, title AS t WHERE cn.id = mc.company_id AND mi.info LIKE 'USA:%200%' AND t.id = mi_idx.m...
job
SELECT s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE o_orderkey = l1.l_orderkey AND l1.l_receiptdate > l1.l_commitdate AND NOT EXISTS ( SELECT * FROM lineitem l3 WHERE l3.l_orderkey = l1.l_orderkey AND l3.l_suppkey != l1.l_suppkey AND l3.l_receiptdate > l3.l_commitdate ) AND s_nationkey =...
tpch
SELECT MIN(t.title) AS movie_title FROM company_name AS cn, keyword AS k, movie_companies AS mc, movie_keyword AS mk, title AS t WHERE mc.movie_id = mk.movie_id AND cn.country_code ='[sm]' AND k.keyword ='character-name-IN-title' AND mk.keyword_id = k.id AND cn.id = mc.company_id AND t.id = mk.movie_id AND mc.movie_id ...
job
WITH year_total AS ( SELECT c_preferred_cust_flag AS customer_preferred_cust_flag, c_customer_id AS customer_id, SUM(((ss_ext_list_price - ss_ext_wholesale_cost - ss_ext_discount_amt) + ss_ext_sales_price) / 2) AS year_total, 's' AS sale_type, d_year AS dyear, c_last_name AS customer_last_name, c_email_address AS custo...
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 s_nationkey = n1.n_nationkey AND c...
tpch
SELECT MIN(t.title) AS movie_title FROM company_name AS cn, keyword AS k, movie_companies AS mc, movie_keyword AS mk, title AS t WHERE mc.movie_id = t.id AND mk.keyword_id = k.id AND t.id = mk.movie_id AND mc.movie_id = mk.movie_id AND cn.id = mc.company_id AND cn.country_code ='[nl]' AND k.keyword ='character-name-IN-...
job
Select Min(t.title) As movie_title From keyword As k, movie_info As mi, movie_keyword As mk, title As t Where t.production_year > 2005 AND mi.info In ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Denish', 'Norwegian', 'German') AND mk.movie_id = mi.movie_id AND k.keyword Like '%sequel%' AND k.id = mk.keyword_i...
job
SELECT i_item_id, AVG(cs_coupon_amt) AS agg3, AVG(cs_sales_price) AS agg4, AVG(cs_list_price) AS agg2, AVG(cs_quantity) AS agg1 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 s_acctbal, s_name, n_name, p_partkey, p_mfgr, s_address, s_phone, s_comment FROM part, supplier, partsupp, nation, region WHERE ps_supplycost = ( SELECT MIN(ps_supplycost) FROM partsupp, supplier, nation, region WHERE p_partkey = ps_partkey AND s_suppkey = ps_suppkey AND s_nationkey = n_nationkey AND n_regionkey...
tpch
select sum(l_extendedprice) / 7.0 as avg_yearly from lineitem, part where p_partkey = l_partkey and p_brand = 1 and p_container = 1 and l_quantity < ( select 0.2 * avg(l_quantity) from lineitem where l_partkey = p_partkey ) limit 20;
tpch
SELECT s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE NOT EXISTS ( SELECT * FROM lineitem l3 WHERE l3.l_orderkey = l1.l_orderkey AND l3.l_suppkey <> l1.l_suppkey AND l3.l_receiptdate > l3.l_commitdate ) AND o_orderkey = l1.l_orderkey AND l1.l_receiptdate > l1.l_commitdate AND o_orderstatus...
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 mi.movie_id = mc.movie_id AND cn.id = mc.company_i...
job
SELECT SUM(sr_return_quantity) AS store_returns_quantity, SUM(cs_quantity) AS catalog_sales_quantity, s_store_name, i_item_desc, s_store_id, SUM(ss_quantity) AS store_sales_quantity, i_item_id FROM store_sales JOIN store_returns ON ss_customer_sk = sr_customer_sk AND ss_item_sk = sr_item_sk AND ss_ticket_number = sr_ti...
tpcds
SELECT MIN(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.movie_id = mc.movie_id AND it2.id = mi.info_type_id AND kt.kind...
job
WITH _q AS ( 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 cn.id = mc.company_id AND miidx.mo...
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 mk.movie_id = mc.movie_id AND t.id ...
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 cn.id = ...
job
SELECT item.i_brand AS brand, dt.d_year, item.i_brand_id AS brand_id, SUM(ss_ext_sales_price) AS ext_price FROM date_dim AS dt INNER JOIN store_sales ON dt.d_date_sk = store_sales.ss_sold_date_sk INNER JOIN item ON store_sales.ss_item_sk = item.i_item_sk WHERE dt.d_moy = 11 AND item.i_manager_id = 67 AND dt.d_year = 19...
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 n_regionkey = r_regionkey AND p_size = 1 AND s_nationkey = n_nationkey AND s_suppkey = ps_suppkey AND r_name = 1 AND p_partkey = ps_partkey AND p_type LIKE 1 AND ps_supplycost = ( SELEC...
tpch
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 t.id = mc.movie_id AND mc.note NOT LIKE '%(USA)%' AND rt.role...
job
SELECT AVG(sr_return_quantity) AS store_returns_quantityave, AVG(cs_quantity) AS catalog_sales_quantityave, COUNT(ss_quantity) AS store_sales_quantitycount, i_item_id, STDDEV_SAMP(ss_quantity) AS store_sales_quantitystdev, STDDEV_SAMP(sr_return_quantity) AS store_returns_quantitystdev, AVG(ss_quantity) AS store_sales_q...
tpcds
select l_orderkey, sum(l_extendedprice * (1 - l_discount)) as revenue, o_orderdate, o_shippriority from customer, orders, lineitem where l_shipdate > DATE 1 AND c_mktsegment = 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 c_first_name, c_salutation, cnt, ss_ticket_number, c_last_name, 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 Min(t.production_year) As movie_year, Min(mc.note) As production_note, Min(t.title) As movie_title From company_type As ct, info_type As it, movie_companies As mc, movie_info_idx As mi_idx, title As t Where t.id = mc.movie_id AND it.id = mi_idx.info_type_id AND ct.kind = 'production companies' AND mc.movie_id = ...
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 t.id = mc.movie_id AND k.keyword = ...
job
SELECT p_mfgr, p_partkey, s_comment, s_name, s_acctbal, s_phone, n_name, s_address FROM part, supplier, partsupp, nation, region WHERE p_partkey = ps_partkey AND s_suppkey = ps_suppkey AND p_size = 1 AND p_type LIKE 1 AND s_nationkey = n_nationkey AND n_regionkey = r_regionkey AND r_name = 1 AND ps_supplycost = ( SELEC...
tpch
WITH year_total AS ( SELECT c_first_name AS customer_first_name, d_year AS dyear, c_customer_id AS customer_id, SUM(((ss_ext_list_price - ss_ext_wholesale_cost - ss_ext_discount_amt) + ss_ext_sales_price) / 2) AS year_total, c_birth_country AS customer_birth_country, 's' AS sale_type, c_preferred_cust_flag AS customer_...
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.info = 'top 250 rank' AND (mc.note LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%') AND ct.id =...
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 p.Id = ph.PostId AND p.Id = v.PostId AND p.FavoriteCount >= 0 AND p.Id = pl.PostId AND c.Score = 0
stats
Select Count(*) From postHistory As ph, posts As p, votes As v, badges As b, users As u, comments As c Where p.Id = c.PostId And p.Id = v.PostId And u.Id = p.OwnerUserId And p.ViewCount >= 0 And p.Score <= 192 And p.Id = ph.PostId And u.Id = b.UserId
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 cn.country_code = '[jp]' AND rt.role = 'actress' AND n1.name LIKE '%Yo%' AND mc.company_id = cn.id AND ci.movie...
job
SELECT MAX(t.title) AS movie_title FROM keyword AS k, movie_info AS mi, movie_keyword AS mk, title AS t WHERE t.id = mi.movie_id AND k.id = mk.keyword_id AND t.id = mk.movie_id AND k.keyword LIKE '%sequel%' AND t.production_year > 2005 AND mk.movie_id = mi.movie_id AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Denmar...
job
select sum(volume) as revenue, l_year, cust_nation, supp_nation from ( select n1.n_name as supp_nation, n2.n_name as cust_nation, EXTRACT(YEAR from l_shipdate) as l_year, l_extendedprice * (1 - l_discount) as volume from supplier, lineitem, orders, customer, nation n1, nation n2 where s_suppkey = l_suppkey and o_orderk...
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 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.id = mc.company_type_id AND miidx.movie_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 it.info = 'top 250 rank' AND it.id = mi_idx.info_type_id AND t.id = mc.movie_id AND t.id = mi_idx.movie_id...
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 c_nationkey = n1.n_na...
tpch
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.info Like 'USA:%200%' AND cn.country_code = '[us]' AND kt.id = t.ki...
job
SELECT AVG(cs_quantity) AS catalog_sales_quantityave, STDDEV_SAMP(cs_quantity) / AVG(cs_quantity) AS catalog_sales_quantitycov, COUNT(sr_return_quantity) AS store_returns_quantitycount, AVG(sr_return_quantity) AS store_returns_quantityave, s_state, COUNT(ss_quantity) AS store_sales_quantitycount, STDDEV_SAMP(sr_return_...
tpcds
Select COUNT(1) From comments As c, postHistory As ph, badges As b, votes As v, users As u Where v.UserId = c.UserId AND u.Id = b.UserId AND u.UpVotes = 0 AND b.UserId = ph.UserId AND ph.PostHistoryTypeId = 12 AND ph.UserId = v.UserId
stats
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 mi.info = ANY(ARRAY['Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Denish', 'Norwegian', 'German']) And t.production_year > 2005 And k.keyword Like '%sequel%' And k.id = mk.keyword...
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_custkey = c_custkey...
tpch
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 ct.id = mc.company_type_id AND k.id = mk.keyword_id AND mc.no...
job
WITH _q AS ( Select Sum(l_extendedprice) / 7.0 As avg_yearly From lineitem, part Where p_partkey = l_partkey AND p_container = 1 AND p_brand = 1 AND l_quantity < ( Select 0.2 * Avg(l_quantity) From lineitem Where l_partkey = p_partkey ) ) SELECT * FROM _q
tpch
SELECT AVG(cs_quantity) AS agg1, AVG(cs_sales_price) AS agg4, i_item_id, AVG(cs_list_price) AS agg2, AVG(cs_coupon_amt) AS agg3 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 MIN(an1.name) AS actress_pseudonym, MIN(t.title) AS japanese_movie_dubbed FROM aka_name AS an1, cast_info AS ci, company_name AS cn, movie_companies AS mc, name AS n1, role_type AS rt, title AS t WHERE ci.movie_id = mc.movie_id AND cn.country_code = '[jp]' AND mc.note NOT LIKE '%(USA)%' AND ci.note = '(voice: En...
job
SELECT COUNT(*) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v, users AS u WHERE p.Id = v.PostId AND p.PostTypeId = 1 AND u.Id = p.OwnerUserId AND p.AnswerCount >= 0 AND p.Id = pl.PostId AND p.Id = c.PostId AND p.Id = ph.PostId
stats
SELECT s_acctbal, s_name, n_name, p_partkey, p_mfgr, s_address, s_phone, s_comment FROM part, supplier, partsupp, nation, region WHERE ps_supplycost = ( SELECT MIN(ps_supplycost) FROM partsupp, supplier, nation, region WHERE p_partkey = ps_partkey AND s_suppkey = ps_suppkey AND s_nationkey = n_nationkey AND n_regionkey...
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.id = mk.keyword_id AND n.id = ci.person_id AND n.name LIKE '%Downey%Robert%' AND t.production_year > 2010 AND t.id...
job
select count(1) from comments as c, postHistory as ph, votes as v, users as u where u.Id = v.UserId AND u.UpVotes <= 123 AND u.DownVotes >= 0 AND v.UserId = ph.UserId AND ph.UserId = c.UserId AND u.Views >= 0
stats
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_custkey = o_custkey and s_nationkey = n_nationkey and n_regionkey = r_regionkey and c_nationkey = s_nationkey and l_suppkey = s_suppkey and o_o...
tpch
SELECT STDDEV_SAMP(ss_quantity) / AVG(ss_quantity) AS store_sales_quantitycov, AVG(cs_quantity) AS catalog_sales_quantityave, STDDEV_SAMP(sr_return_quantity) AS store_returns_quantitystdev, i_item_id, STDDEV_SAMP(sr_return_quantity) / AVG(sr_return_quantity) AS store_returns_quantitycov, COUNT(ss_quantity) AS store_sal...
tpcds
SELECT promotions, total, CAST(promotions AS DECIMAL(15, 4)) / CAST(total AS DECIMAL(15, 4)) * 100 FROM ( SELECT SUM(ss_ext_sales_price) AS promotions FROM store_sales 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
WITH _q AS ( SELECT COUNT(*) FROM comments AS c, votes AS v, badges AS b, users AS u WHERE u.Id = v.UserId AND c.Score = 1 AND u.Id = c.UserId AND u.Id = b.UserId AND u.CreationDate >= '2010-07-20 01:27:29'::timestamp ) SELECT * FROM _q LIMIT 20;
stats
Select Avg(ss_quantity) As agg1, i_item_id, Avg(ss_coupon_amt) As agg3, Avg(ss_list_price) As agg2, 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 MAX(cs_net_profit) AS catalog_sales_profit, MAX(ss_net_profit) AS store_sales_profit, s_store_name, MAX(sr_net_loss) AS store_returns_loss, i_item_id, s_store_id, i_item_desc 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 AVG(ss_sales_price) AS agg4, AVG(ss_coupon_amt) AS agg3, AVG(ss_list_price) AS agg2, 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 w_state, i_item_id, Sum(Case When (CAST(d_date As DATE) < CAST('2000-03-11' As DATE)) Then cs_sales_price - COALESCE(cr_refunded_cash, 0) Else 0 End) As sales_before, Sum(Case When (CAST(d_date As DATE) >= CAST('2000-03-11' As DATE)) Then cs_sales_price - COALESCE(cr_refunded_cash, 0) Else 0 End) As sales_after ...
tpcds
Select extended_price, list_price, c_last_name, ca_city, extended_tax, c_first_name, bought_city, 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 i_current_price, i_item_id, i_item_desc from item join inventory on i_item_sk = inv_item_sk join date_dim on d_date_sk = inv_date_sk join store_sales on ss_item_sk = i_item_sk where i_current_price >= 91 AND i_current_price <= 91 + 30 and d_date between CAST('2002-01-23' as DATE) and (CAST('2002-01-23' as DATE) ...
tpcds