text
stringlengths
84
1.49k
benchmark
stringclasses
4 values
WITH year_total AS ( SELECT c_birth_country AS customer_birth_country, c_email_address AS customer_email_address, c_first_name AS customer_first_name, c_preferred_cust_flag AS customer_preferred_cust_flag, c_login AS customer_login, SUM(((ss_ext_list_price - ss_ext_wholesale_cost - ss_ext_discount_amt) + ss_ext_sales_p...
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 l_orderkey = o_orderkey AND s_nationkey = n_nationkey AND c_custkey = o_custkey AND c_nationkey = s_nationkey AND l_suppkey = s_suppkey AND n_reg...
tpch
SELECT COUNT(*) FROM comments AS c, posts AS p, votes AS v, users AS u WHERE c.Score = 0 AND p.ViewCount >= 0 AND u.Id = c.UserId AND u.Id = p.OwnerUserId AND u.Id = v.UserId AND p.Score >= 0 LIMIT 500;
stats
select count(*) from comments as c, posts as p, postLinks as pl, postHistory as ph, votes as v, badges as b where b.UserId = c.UserId AND pl.LinkTypeId = 1 AND p.Id = ph.PostId AND p.Id = v.PostId AND c.Score = 0 AND p.Id = c.PostId AND p.Id = pl.RelatedPostId
stats
Select w_state, i_item_id, Sum(Case When (CAST(d_date As DATE) >= CAST('1998-01-01' As DATE)) Then cs_sales_price - COALESCE(cr_refunded_cash, 0) Else 0 End) As sales_after, Sum(Case When (CAST(d_date As DATE) < CAST('1998-01-01' As DATE)) Then cs_sales_price - COALESCE(cr_refunded_cash, 0) Else 0 End) As sales_before ...
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 cn.id = mc.company_id AND ci.note LIKE '%(voice: English vers...
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 mi.movie_id = mc.movie_id AND mi_idx.info < '3.5' AND at.movie_id = mi...
job
Select 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, l_shipmode From orders, lineitem Where l_shipdate < l_commitdate AND l_receiptdate ...
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 cn.country_code = '[jp]' AND rt.role = 'actress' AND n1.id = ci.person_id AND ci.movie_id = t.id AND an1.person...
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 cn.country_code = '[ru]' AND t.id = mc.movie_id AND rt.id = ci.role_id AND rt.role = 'actor' AND ct....
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
SELECT MIN(k.keyword) AS movie_keyword, MIN(n.name) AS actor_name, MIN(t.title) AS marvel_movie FROM cast_info AS ci, keyword AS k, movie_keyword AS mk, name AS n, title AS t WHERE ci.movie_id = mk.movie_id AND n.id = ci.person_id AND t.id = mk.movie_id AND k.keyword = 'marvel-cinematic-universe' AND k.id = mk.keyword_...
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 mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer ...
job
SELECT MAX(ss_net_profit) AS store_sales_profit, MAX(sr_net_loss) AS store_returns_loss, s_store_id, i_item_desc, i_item_id, s_store_name, 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 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 i_item_id, s_store_id, i_item_desc, MAX(cs_net_profit) AS catalog_sales_profit, MAX(sr_net_loss) AS store_returns_loss, MAX(ss_net_profit) AS store_sales_profit, s_store_name 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 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 cn.country_code = '[us]' and it1.info = 'rating' and it2.info = 'relea...
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 s_suppkey = l_suppkey...
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 n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, supplier, nation, region WHERE r_name = 1 AND s_nationkey = n_nationkey AND l_suppkey = s_suppkey AND c_nationkey = s_nationkey AND l_orderkey = o_orderkey AND c_custkey = o_custkey AND o_orderdate < DATE 1 + INTERVAL '1'...
tpch
SELECT MIN(k.keyword) AS movie_keyword, MIN(n.name) AS actor_name, MIN(t.title) AS marvel_movie FROM cast_info AS ci, keyword AS k, movie_keyword AS mk, name AS n, title AS t WHERE ci.movie_id = mk.movie_id AND t.id = ci.movie_id AND k.keyword = 'marvel-cinematic-universe' AND n.name LIKE '%Hemsworth%Chris%' AND t.id =...
job
SELECT SUM( CASE WHEN nation = 1 THEN volume ELSE 0 END ) / SUM(volume) AS mkt_share, o_year 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(mc.note) AS production_note, MIN(t.title) AS movie_title, MIN(t.production_year) AS movie_year FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info_idx AS mi_idx, title AS t WHERE it.id = mi_idx.info_type_id AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND ct.id = mc.comp...
job
Select Min(mc.note) As production_note, Min(t.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 Like '%(co-production)%' Or mc.note Like '%(presents)%') AND t.id = mi_idx.movie_id AND ct.kind =...
job
Select s_name, s_phone, total_revenue, s_suppkey, s_address From supplier, revenue0 Where total_revenue = ( Select Max(total_revenue) From revenue0 ) AND s_suppkey = supplier_no Order By s_suppkey
tpch
SELECT MAX(n.name) AS voicing_actress, MAX(t.title) AS voiced_movie FROM aka_name AS an, char_name AS chn, cast_info AS ci, company_name AS cn, info_type AS it, movie_companies AS mc, movie_info AS mi, name AS n, role_type AS rt, title AS t WHERE an.person_id = n.id AND ci.person_id = an.person_id AND mi.movie_id = ci....
job
SELECT extended_tax, list_price, bought_city, extended_price, ss_ticket_number, ca_city, c_first_name, c_last_name 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 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 c.UserId = u.Id AND b.UserId = u.Id AND p.Id = pl.RelatedPostId AND p.Score <= 40 AND p.Id = c.PostId AND p.Id = ph.PostId AND p.Id = v.PostId AND pl.LinkTypeId = 1
stats
SELECT total_revenue, s_name, s_address, s_phone, s_suppkey FROM supplier, revenue0 WHERE s_suppkey = supplier_no AND total_revenue = ( SELECT MAX(total_revenue) FROM revenue0 ) ORDER BY s_suppkey
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 n.name like '%Downey%Robert%' and ci.movie_id = mk.movie_id and t.id = mk.movie_id and k.id = mk.keyword_id and t.id = ci.movie_id and t.pr...
job
SELECT MIN(t.title) AS marvel_movie, MIN(k.keyword) AS movie_keyword, MIN(n.name) AS actor_name FROM cast_info AS ci, keyword AS k, movie_keyword AS mk, name AS n, title AS t WHERE t.id = mk.movie_id AND k.keyword = 'marvel-cinematic-universe' AND n.id = ci.person_id AND t.id = ci.movie_id AND k.id = mk.keyword_id AND ...
job
SELECT s_store_name, i_item_id, s_store_id, i_item_desc, 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 c_custkey, c_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue, c_acctbal, n_name, c_address, c_phone, c_comment FROM customer, orders, lineitem, nation WHERE o_orderdate < DATE 1 + INTERVAL '3' MONTH AND c_nationkey = n_nationkey AND l_orderkey = o_orderkey AND o_orderdate >= DATE 1 AND l_returnflag = 'R...
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.role_id = rt.id AND n.id = ci.person_id AND mc.note NOT LI...
job
Select p_brand, p_type, p_size, Count(Distinct ps_suppkey) As supplier_cnt From partsupp, part Where ps_suppkey Not In ( Select s_suppkey From supplier Where s_comment Like '%Customer%Complaints%' ) And p_partkey = ps_partkey And p_type Not Like 1 And p_size In (1, 1, 1, 1, 1, 1, 1, 1) And p_brand <> 1 Group By p_brand...
tpch
SELECT SUM(l_extendedprice * (1 - l_discount)) AS revenue, c_comment, c_custkey, c_address, c_acctbal, n_name, c_name, c_phone 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 MIN(t.title) AS japanese_movie_dubbed, MIN(an1.name) AS actress_pseudonym FROM aka_name AS an1, cast_info AS ci, company_name AS cn, movie_companies AS mc, name AS n1, role_type AS rt, title AS t WHERE an1.person_id = n1.id AND n1.id = ci.person_id AND ci.movie_id = t.id AND mc.note LIKE '%(Japan)%' AND ci.movie...
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 100 AND 100 + 10 or ss_coupon_amt BETWEEN 2901 AND 2901 + 1000 or ss_wholesale_cost BETWEEN 33 AND 33 + 20) ) as b2, ( select avg(ss_list_price) as b...
tpcds
Select Count(*) From postHistory As ph, posts As p, votes As v, badges As b, users As u, comments As c Where p.Id = ph.PostId And u.Id = b.UserId And p.Id = c.PostId And u.Id = p.OwnerUserId And p.Score <= 192 And p.ViewCount >= 0 And p.Id = v.PostId
stats
SELECT AVG(sr_return_quantity) AS store_returns_quantityave, i_item_desc, COUNT(sr_return_quantity) AS store_returns_quantitycount, AVG(cs_quantity) AS catalog_sales_quantityave, STDDEV_SAMP(cs_quantity) / AVG(cs_quantity) AS catalog_sales_quantitycov, COUNT(cs_quantity) AS catalog_sales_quantitycount, i_item_id, STDDE...
tpcds
Select Sum(amount) As sum_profit, nation, o_year From ( Select n_name As nation, EXTRACT(YEAR From o_orderdate) As o_year, l_extendedprice * (1 - l_discount) - ps_supplycost * l_quantity As amount From part, supplier, lineitem, partsupp, orders, nation Where o_orderkey = l_orderkey And p_name Like 1 ) As profit And ps_...
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 cn.id = mc.company_id AND t.id = mc.movie_id AND n.id = ci.pe...
job
Select COUNT(1) From comments As c, posts As p, postLinks As pl, postHistory As ph, votes As v Where p.FavoriteCount >= 0 AND p.Id = ph.PostId AND p.Id = c.PostId AND p.Id = v.PostId AND c.Score = 0 AND p.Id = pl.PostId AND pl.LinkTypeId = 1
stats
SELECT MIN(t.title) AS movie_title FROM keyword AS k, movie_info AS mi, movie_keyword AS mk, title AS t WHERE k.keyword LIKE '%sequel%' AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Danish', 'Norwegian', 'German') AND t.production_year > 2000 AND t.id = mk.movie_id AND mk.movie_id = mi.movie_id ...
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 kt.kind = 'movie' AND mi.movie_id = mc.movie_id AND kt.id = t.kind_id ...
job
SELECT c_name, c_address, c_acctbal, c_phone, c_custkey, n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue, c_comment FROM customer, orders, lineitem, nation WHERE o_orderdate < DATE 1 + INTERVAL '3' MONTH AND c_nationkey = n_nationkey AND l_orderkey = o_orderkey AND c_custkey = o_custkey AND l_returnflag = 'R...
tpch
Select Count(*) From comments As c, posts As p, postLinks As pl, postHistory As ph, votes As v, badges As b Where b.UserId = c.UserId And p.Id = pl.RelatedPostId And pl.LinkTypeId = 1 And p.Id = ph.PostId And p.Id = c.PostId And c.Score = 0 And p.Id = v.PostId
stats
SELECT SUM(ss_ext_sales_price) AS ext_price, i_manufact, i_brand AS brand, i_brand_id AS brand_id, i_manufact_id FROM date_dim INNER JOIN store_sales ON d_date_sk = ss_sold_date_sk INNER JOIN item ON ss_item_sk = i_item_sk INNER JOIN customer ON ss_customer_sk = c_customer_sk INNER JOIN customer_address ON c_current_ad...
tpcds
SELECT extended_price, ss_ticket_number, bought_city, c_last_name, ca_city, list_price, c_first_name, extended_tax FROM ( SELECT ss_ticket_number, ss_customer_sk, ca_city AS bought_city, SUM(ss_ext_sales_price) AS extended_price, SUM(ss_ext_list_price) AS list_price, SUM(ss_ext_tax) AS extended_tax FROM store_sales JOI...
tpcds
SELECT MIN(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.id = ci.movie_id AND n.id = ci.person_id AND k.keyword = 'marvel-cinematic-universe' AND t.id = mk.mo...
job
SELECT nation, o_year, SUM(amount) AS sum_profit FROM ( SELECT n_name AS nation, EXTRACT(YEAR FROM o_orderdate) AS o_year, l_extendedprice * (1 - l_discount) - ps_supplycost * l_quantity AS amount FROM part, supplier, lineitem, partsupp, orders, nation WHERE p_name LIKE 1 ) AS profit AND s_suppkey = l_suppkey AND ps_pa...
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 = mk.movie_id AND t.production_year > 2010 AND n.name LIKE '%Downey%Robert%' AND ci.movie_id = mk.movie_id AND k.id = mk.keyword_id AN...
job
WITH year_total AS ( SELECT c_birth_country AS customer_birth_country, c_preferred_cust_flag AS customer_preferred_cust_flag, c_customer_id AS customer_id, c_first_name AS customer_first_name, d_year AS dyear, 's' AS sale_type, c_login AS customer_login, SUM(((ss_ext_list_price - ss_ext_wholesale_cost - ss_ext_discount...
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 it1.info = 'rating' AND at.movie_id = mi.movie_id AND it2.info = 'rele...
job
SELECT dt.d_year, item.i_brand_id AS brand_id, SUM(ss_ext_sales_price) AS ext_price, item.i_brand AS brand 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 item.i_manager_id = 69 AND dt.d_year = 2000 AND dt.d_moy = ...
tpcds
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 (mc.note LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%') AND t.id = mi.movie_id AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND...
job
WITH _q AS ( SELECT COUNT(*) FROM comments AS c, posts AS p, postHistory AS ph, votes AS v, users AS u WHERE u.Id = c.UserId AND c.UserId = p.OwnerUserId AND ph.UserId = v.UserId AND p.AnswerCount >= 0 ) SELECT * FROM _q AND p.OwnerUserId = ph.UserId AND p.Score <= 13
stats
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 c.UserId = u.Id AND pl.LinkTypeId = 1 AND p.Score <= 40 AND p.Id = c.PostId AND b.UserId = u.Id AND p.Id = pl.RelatedPostId AND p.Id = ph.PostId
stats
SELECT AVG(ss_sales_price) AS agg4, i_item_id, AVG(ss_coupon_amt) AS agg3, AVG(ss_list_price) AS agg2, AVG(ss_quantity) AS agg1 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 p_size, COUNT(DISTINCT ps_suppkey) AS supplier_cnt, p_type, p_brand FROM partsupp, part WHERE p_partkey = ps_partkey AND p_brand <> 1 AND ps_suppkey NOT IN ( SELECT s_suppkey FROM supplier WHERE s_comment LIKE '%Customer%Complaints%' ) AND p_type NOT LIKE 1 AND p_size IN (1, 1, 1, 1, 1, 1, 1, 1) GROUP BY p_brand...
tpch
Select Sum(ss_ext_sales_price) As ext_price, dt.d_year, item.i_brand As brand, item.i_brand_id As brand_id From date_dim As dt Join store_sales On dt.d_date_sk = store_sales.ss_sold_date_sk Join item On store_sales.ss_item_sk = item.i_item_sk Where item.i_manager_id = 57 And dt.d_moy = 12 And dt.d_year = 2002 Group By ...
tpcds
SELECT s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE EXISTS ( SELECT * FROM lineitem l2 WHERE l2.l_orderkey = l1.l_orderkey AND l2.l_suppkey <> l1.l_suppkey ) AND l1.l_receiptdate > l1.l_commitdate AND o_orderkey = l1.l_orderkey AND s_nationkey = n_nationkey AND NOT EXISTS ( SELECT * FROM...
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 t.id = ci.movie_id AND n.gender = 'f' AND mk.movie_id = mc.mo...
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 mi.movie_id = mc.movie_id AND at.movie_id = mi_idx.movie_id AND cn.cou...
job
SELECT i_item_id, s_store_id, s_store_name, SUM(ss_quantity) AS store_sales_quantity, i_item_desc, 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 s_name, s_suppkey, s_phone, s_address, 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 sum(l_extendedprice * l_discount) as revenue from lineitem where l_shipdate >= DATE 1 AND l_quantity < 1 AND l_shipdate < DATE 1 + INTERVAL '1' YEAR AND l_discount BETWEEN 1 - 0.01 AND 1 + 0.01 LIMIT 100;
tpch
select min(mc.note) as production_note, min(t.title) as movie_title, min(t.production_year) as movie_year from company_type as ct, info_type as it, movie_companies as mc, movie_info_idx as mi_idx, title as t where (mc.note like '%(co-production)%' or mc.note like '%(presents)%') and t.id = mi_idx.movie_id and it.info =...
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', 'Denish', 'Norwegian', 'German') AND t.id = mi.movie_id AND k.id = mk.keyword_id AND t.production_year > 2005 AND mk.movie_id = mi.movie_id AND t...
job
SELECT MIN(mi_idx.info) AS rating, MIN(t.title) AS northamerican_movie FROM aka_title AS at, company_name AS cn, info_type AS it1, info_type AS it2, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS mi_idx, title AS t WHERE at.movie_id = mi_idx.movie_id AND it2.id = mi.info_type_id AND mi_idx....
job
select count(1) from votes as v, posts as p, badges as b, users as u where p.Id = v.PostId and u.Id = p.OwnerUserId and u.Id = b.UserId and u.Reputation >= 1 and p.Score <= 22
stats
SELECT COUNT(1) FROM comments AS c, postHistory AS ph, votes AS v, users AS u WHERE u.DownVotes >= 0 AND u.UpVotes <= 123 AND u.Views >= 0 AND ph.UserId = c.UserId AND v.UserId = ph.UserId AND u.Id = v.UserId
stats
Select l_linestatus, Sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) As sum_charge, Sum(l_quantity) As sum_qty, Avg(l_extendedprice) As avg_price, Avg(l_quantity) As avg_qty, Avg(l_discount) As avg_disc, COUNT(1) As count_order, Sum(l_extendedprice * (1 - l_discount)) As sum_disc_price, Sum(l_extendedprice) As su...
tpch
WITH _q AS ( SELECT COUNT(*) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v WHERE p.Id = c.PostId AND p.FavoriteCount >= 0 AND pl.LinkTypeId = 1 AND p.Id = v.PostId AND c.Score = 0 AND p.Id = ph.PostId AND p.Id = pl.PostId ) SELECT * FROM _q;
stats
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 = ci.movie_id AND t.id = mk.movie_id AND t.production_year > 2010 AND ci.movie_id = mk.movie_id AND k.keyword...
job
SELECT AVG(l_extendedprice) AS avg_price, AVG(l_discount) AS avg_disc, AVG(l_quantity) AS avg_qty, l_returnflag, COUNT(*) AS count_order, l_linestatus, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, SUM(l_extendedprice) AS sum_base_price, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, ...
tpch
SELECT SUM(l_extendedprice * (1 - l_discount)) AS revenue, o_orderdate, o_shippriority, l_orderkey FROM customer, orders, lineitem WHERE l_shipdate > DATE 1 AND l_orderkey = o_orderkey AND o_orderdate < DATE 1 AND c_custkey = o_custkey AND c_mktsegment = 1 GROUP BY l_orderkey, o_orderdate, o_shippriority ORDER BY reven...
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 k.id = mk.keyword_id AND t.id = ci.movie_id AND k.keyword = 'marvel-cinematic-universe' AND t.production_year > 2010 AND t.id = mk.movie_id...
job
SELECT MIN(mi.info) AS release_date, MIN(miidx.info) AS rating, MIN(t.title) AS german_movie FROM company_name AS cn, company_type AS ct, info_type AS it, info_type AS it2, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS miidx, title AS t WHERE it.id = miidx.info_type_id AND ct.kind = 'produ...
job
SELECT MIN(t.title) AS northamerican_movie, MIN(mi_idx.info) AS rating FROM aka_title AS at, company_name AS cn, info_type AS it1, info_type AS it2, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS mi_idx, title AS t WHERE at.movie_id = mi_idx.movie_id AND t.id = at.movie_id AND at.title LIKE...
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 = ANY(ARRAY['Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Danish', 'Norwegian', 'German']) AND t.production_year > 2000 AND mk.movie_id = mi.movie_id AND k.id = mk.keyword_id AND k.keyword LIKE ...
job
select p_brand, p_size, p_type, count(distinct ps_suppkey) as supplier_cnt 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_type not like 1 AND p_brand <> 1 AND p_partkey = ps_partkey group by p_brand...
tpch
select n_name, sum(l_extendedprice * (1 - l_discount)) as revenue from customer, orders, lineitem, supplier, nation, region where r_name = 1 and l_orderkey = o_orderkey and l_suppkey = s_suppkey and n_regionkey = r_regionkey and c_custkey = o_custkey and c_nationkey = s_nationkey and o_orderdate >= DATE 1 and o_orderda...
tpch
SELECT l_returnflag, AVG(l_quantity) AS avg_qty, COUNT(*) AS count_order, AVG(l_discount) AS avg_disc, SUM(l_quantity) AS sum_qty, SUM(l_extendedprice) AS sum_base_price, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, l_linestatus, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, AVG(l_e...
tpch
SELECT s_store_name, i_item_id, MAX(sr_net_loss) AS store_returns_loss, MAX(ss_net_profit) AS store_sales_profit, MAX(cs_net_profit) AS catalog_sales_profit, 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 MIN(mc.note) AS production_note, MIN(t.title) AS movie_title, MIN(t.production_year) AS movie_year FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info_idx AS mi_idx, title AS t WHERE mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND ct.kind = 'production companies' AND (mc.note L...
job
SELECT SUM( CASE WHEN o_orderpriority <> '1-URGENT' AND o_orderpriority <> '2-HIGH' THEN 1 ELSE 0 END ) AS low_line_count, SUM( CASE WHEN o_orderpriority = '1-URGENT' OR o_orderpriority = '2-HIGH' THEN 1 ELSE 0 END ) AS high_line_count, l_shipmode FROM orders, lineitem WHERE l_commitdate < l_receiptdate AND o_orderkey ...
tpch
Select Count(*) From comments As c, posts As p, postLinks As pl, postHistory As ph, votes As v Where p.Id = ph.PostId And c.Score = 0 And p.FavoriteCount >= 0 And p.Id = c.PostId And p.Id = pl.PostId And pl.LinkTypeId = 1 And p.Id = v.PostId
stats
SELECT n_name, c_phone, c_acctbal, c_custkey, c_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue, c_comment, 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 Min(cn.name) As movie_company, Min(mi_idx.info) As rating, Min(t.title) As western_violent_movie From company_name As cn, company_type As ct, info_type As it1, info_type As it2, keyword As k, kind_type As kt, movie_companies As mc, movie_info As mi, movie_info_idx As mi_idx, movie_keyword As mk, title As t Where...
job
SELECT MIN(t.title) AS series_named_after_char, MIN(an.name) AS cool_actor_pseudonym 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 n.id = ci.person_id AND an.person_id = ci.person_id AND mc.movie_id...
job
SELECT nation, o_year, SUM(amount) AS sum_profit FROM ( SELECT n_name AS nation, EXTRACT(YEAR FROM o_orderdate) AS o_year, l_extendedprice * (1 - l_discount) - ps_supplycost * l_quantity AS amount FROM part, supplier, lineitem, partsupp, orders, nation WHERE ps_partkey = l_partkey AND s_suppkey = l_suppkey AND s_nation...
tpch
select count(*) from comments as c, posts as p, postLinks as pl, postHistory as ph, votes as v, badges as b where p.Id = pl.RelatedPostId and p.Id = c.PostId and pl.LinkTypeId = 1 and p.Id = v.PostId and b.UserId = c.UserId and p.Id = ph.PostId and c.Score = 0
stats
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 p.Id = c.PostId AND p.Score <= 40 AND p.Id = pl.RelatedPostId AND b.UserId = u.Id AND pl.LinkTypeId = 1 AND c.UserId = u.Id AND p.Id = ph.PostId AND p.Id = v.PostId
stats
WITH year_total AS ( SELECT c_customer_id AS customer_id, c_login AS customer_login, 's' AS sale_type, c_email_address AS customer_email_address, c_first_name AS customer_first_name, c_birth_country AS customer_birth_country, c_last_name AS customer_last_name, SUM(((ss_ext_list_price - ss_ext_wholesale_cost - ss_ext_di...
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 Min(t.title) As marvel_movie, Min(n.name) As actor_name, 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 n.name Like '%Hemsworth%Chris%' And t.production_year > 2010 And k.id = mk.keyword_id And t.id = ci.movie_id And n.id = ci.person_id And ci...
job
SELECT n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, supplier, nation, region WHERE s_nationkey = n_nationkey AND l_orderkey = o_orderkey AND o_orderdate < DATE 1 + INTERVAL '1' YEAR AND c_custkey = o_custkey AND r_name = 1 AND c_nationkey = s_nationkey AND n_regionkey = r_...
tpch
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 catalog_sales ON cs_item_sk = i_item_sk WHERE d_date BETWEEN CAST('2000-05-01' AS DATE) AND (CAST('2000-05-01' AS DATE) + INTERVAL '60 days') AND i_current_price <= 75 + 30 AN...
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