text
stringlengths
84
1.49k
benchmark
stringclasses
4 values
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 AND l_returnflag = 'R' AND c_nationkey = n_nationkey AND c_custkey = o_custkey AND l_orderkey = o_orderkey AND o_orderdate < ...
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 n.name LIKE '%Downey%Robert%' AND ci.movie_id = mk.movie_id AND t.id = mk.movie_id AND t.production_year > 2010 AND ...
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 l_receiptdate >= DATE 1 AND l_shipdate < l_c...
tpch
SELECT COUNT(1) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v, users AS u WHERE p.Id = c.PostId AND u.Id = p.OwnerUserId AND p.PostTypeId = 1 AND p.Id = v.PostId AND p.AnswerCount >= 0 AND p.Id = ph.PostId AND p.Id = pl.PostId
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 = n1.id AND ci.movie_id = t.id AND n1.name NOT LIKE '%Yu%' AND n1.name LIKE '%Yo%' AND mc.company...
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 t.id = mk.movie_id AND mc.movie_id = t.id AND cn.country_code ='[nl]' AND k.keyword ='character-name-in-title' AND mc.movie_id = mk.movie_id AND mk.keyword_id ...
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 an1.person_id = ci.person_id and mc.company_id = cn.id and n1.id = ci.person_id and n1.name like '%Yo%' and cn....
job
SELECT n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, supplier, nation, region WHERE r_name = 1 AND l_suppkey = s_suppkey AND l_orderkey = o_orderkey AND s_nationkey = n_nationkey AND o_orderdate < DATE 1 + INTERVAL '1' YEAR AND c_custkey = o_custkey AND n_regionkey = r_regi...
tpch
SELECT MAX(n.name) AS of_person, MAX(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 lt.id = ml.link_type_id AND n.id = an.person_id AND (n.gender = 'm' OR (n.gend...
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 ci.movie_id = t.id AND ci.note = '(voice: English version)' AND an1.person_id = n1.id AND mc.company_id = cn.id...
job
SELECT COUNT(1) 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.Id = v.PostId AND p.Id = ph.PostId AND p.Id = c.PostId AND p.ViewCount >= 0 AND p.Score <= 192 AND u.Id = b.UserId
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 = ph.PostId AND p.Id = v.PostId AND u.Id = p.OwnerUserId AND p.ViewCount >= 0 AND u.Id = b.UserId AND p.Score <= 192 AND p.Id = c.PostId LIMIT 200;
stats
SELECT MIN(t.title) AS movie_title FROM company_name AS cn, keyword AS k, movie_companies AS mc, movie_keyword AS mk, title AS t WHERE cn.id = mc.company_id AND cn.country_code ='[de]' AND mc.movie_id = mk.movie_id AND mc.movie_id = t.id AND t.id = mk.movie_id AND k.keyword ='character-name-in-title' AND mk.keyword_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 o_custkey = c_custkey...
tpch
SELECT c_acctbal, n_name, c_name, c_comment, c_phone, c_address, c_custkey, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, nation WHERE c_custkey = o_custkey AND l_orderkey = o_orderkey AND o_orderdate >= DATE 1 AND o_orderdate < DATE 1 + INTERVAL '3' MONTH AND l_returnflag = 'R' AN...
tpch
SELECT MIN(mc.note) AS production_note, MIN(t.title) AS movie_title, MIN(t.production_year) AS movie_year FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info_idx AS mi_idx, title AS t WHERE ct.kind = 'production companies' AND t.id = mi_idx.movie_id AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer...
job
SELECT MIN(mc.note) AS production_note, MIN(t.title) AS movie_title, MIN(t.production_year) AS movie_year FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info_idx AS mi_idx, title AS t WHERE ct.id = mc.company_type_id AND mc.movie_id = mi_idx.movie_id AND t.id = mc.movie_id AND mc.note NOT LIKE '...
job
SELECT ss_ticket_number, c_first_name, c_last_name, cnt, c_salutation, c_preferred_cust_flag FROM ( SELECT ss_ticket_number, ss_customer_sk, COUNT(*) AS cnt FROM store_sales JOIN date_dim ON ss_sold_date_sk = d_date_sk JOIN store ON ss_store_sk = s_store_sk JOIN household_demographics ON ss_hdemo_sk = hd_demo_sk WHERE ...
tpcds
SELECT MIN(mc.note) AS production_note, MIN(t.title) AS movie_title, MIN(t.production_year) AS movie_year FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info_idx AS mi_idx, title AS t WHERE ct.kind = 'production companies' AND t.id = mi_idx.movie_id AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer...
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 it.id = mi.info_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 (mc.note LIKE '%(co-producti...
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 a.ca_state AS state, COUNT(1) AS cnt FROM customer_address AS a JOIN customer AS c ON a.ca_address_sk = c.c_current_addr_sk JOIN store_sales AS s ON c.c_customer_sk = s.ss_customer_sk JOIN date_dim AS d ON s.ss_sold_date_sk = d.d_date_sk JOIN item AS i ON s.ss_item_sk = i.i_item_sk WHERE d.d_month_seq = ( SELECT...
tpcds
SELECT SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, AVG(l_discount) AS avg_disc, COUNT(*) AS count_order, l_returnflag, l_linestatus, SUM(l_quantity) AS sum_qty, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, AVG(l_quantity) AS avg_qty, AVG(l_extendedprice) AS avg_price, SUM(l_extend...
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 t.id = mc.movie_id AND n1.id = ci.person_id AND rt.role = 'actress' AND mc.note NOT LIKE '%(USA)%' AND ci.movie...
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 l_shipdate < l_commitdate And o_orderkey = l...
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 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 k.keyword ='character-name-in-title' AND mk.keyword_id = k.id AND cn.id = mc.company_id AND mc.movie_id = t.id AND cn.country_code ='[de]' AND t.id = mk.mo...
job
SELECT c_preferred_cust_flag, ss_ticket_number, c_salutation, c_last_name, c_first_name, 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
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 = pl.RelatedPostId AND p.Id = ph.PostId AND p.Id = v.PostId AND c.UserId = u.Id AND b.UserId = u.Id AND pl.LinkTypeId = 1 AND p.Id = c.PostId AND p.Score <= 40
stats
select count(*) from comments as c, posts as p, postLinks as pl where p.CreationDate <= '2014-09-09 01:43:00'::timestamp and p.Id = pl.PostId and c.UserId = p.OwnerUserId and p.CreationDate >= '2010-07-23 07:27:31'::timestamp and p.CommentCount <= 18 limit 200;
stats
SELECT SUM(ss_quantity) AS store_sales_quantity, s_store_id, i_item_id, s_store_name, SUM(cs_quantity) AS catalog_sales_quantity, SUM(sr_return_quantity) AS store_returns_quantity, 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 s_acctbal, s_name, n_name, p_partkey, p_mfgr, s_address, s_phone, s_comment FROM part, supplier, partsupp, nation, region WHERE s_suppkey = ps_suppkey AND n_regionkey = r_regionkey AND p_size = 1 AND ps_supplycost = ( SELECT MIN(ps_supplycost) FROM partsupp, supplier, nation, region WHERE p_partkey = ps_partkey ...
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 t.id = mi.movie_id AND t.id = at.movie_id AND at.title LIKE '%Champion...
job
SELECT COUNT(*) FROM postHistory AS ph, posts AS p, votes AS v, badges AS b, users AS u, comments AS c WHERE p.Id = c.PostId AND u.Id = p.OwnerUserId AND p.ViewCount >= 0 AND p.Id = v.PostId AND u.Id = b.UserId AND p.Id = ph.PostId AND p.Score <= 192
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.id = mk.keyword_id AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Danish', 'Norwegian', 'German') AND k.keyword LIKE '%sequel%' AND mk.movie_id = mi.movie_id AND t.id = mk.movie_id 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 = mk.movie_id AND mi.info = ANY(ARRAY['Sweden', 'Norway', 'Germany', 'Danish', 'Swedish', 'Danish', 'Norwegian', 'German']) AND k.keyword LIKE '%sequel%' AND k.id = mk.keyword_id AND mk.movie_id = mi.movie...
job
SELECT COUNT(*) FROM comments AS c, posts AS p, votes AS v, users AS u WHERE u.Id = c.UserId AND c.Score = 0 AND p.ViewCount >= 0 AND u.Id = p.OwnerUserId AND u.Id = v.UserId AND p.Score >= 0 LIMIT 100;
stats
SELECT MIN(n.name) AS of_person, MIN(t.title) AS biography_movie FROM aka_name AS an, cast_info AS ci, info_type AS it, link_type AS lt, movie_link AS ml, name AS n, person_info AS pi, title AS t WHERE n.name_pcode_cf BETWEEN 'A' AND 'F' AND ci.movie_id = ml.linked_movie_id AND (n.gender = 'm' OR (n.gender = 'f' AND n....
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 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
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 (mc.note LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%') AND t.id = mi.movie_id AND mc.movie_id = mi.movie_id AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND ...
job
SELECT COUNT(DISTINCT ps_suppkey) AS supplier_cnt, p_brand, p_type, p_size FROM partsupp, part WHERE p_type NOT LIKE 1 AND ps_suppkey NOT IN ( SELECT s_suppkey FROM supplier WHERE s_comment LIKE '%Customer%Complaints%' ) AND p_brand <> 1 AND p_partkey = ps_partkey AND p_size IN (1, 1, 1, 1, 1, 1, 1, 1) GROUP BY p_brand...
tpch
select min(t.title) as movie_title from keyword as k, movie_info as mi, movie_keyword as mk, title as t where k.keyword like '%sequel%' AND t.id = mk.movie_id AND t.production_year > 2000 AND k.id = mk.keyword_id AND mk.movie_id = mi.movie_id AND mi.info in ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Danish'...
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 ct.id = mc.company_type_id AND it.info = 'ratin...
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 k.keyword = 'character-name-in-title' AND ci.movie_id = mc.movie_id AND n.id = ci.person_id...
job
SELECT MIN(an.name) AS acress_pseudonym, MIN(t.title) AS japanese_anime_movie FROM aka_name AS an, cast_info AS ci, company_name AS cn, company_type AS ct, keyword AS k, movie_companies AS mc, movie_keyword AS mk, name AS n, role_type AS rt, title AS t WHERE ci.movie_id = mc.movie_id AND k.keyword = 'anime' AND mc.note...
job
SELECT s_store_name, s_store_id, SUM(cs_quantity) AS catalog_sales_quantity, SUM(ss_quantity) AS store_sales_quantity, i_item_id, i_item_desc, SUM(sr_return_quantity) AS store_returns_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 ps_partkey, Sum(ps_supplycost * ps_availqty) As VALUE From partsupp, supplier, nation Where ps_suppkey = s_suppkey And n_name = 1 And s_nationkey = n_nationkey Group By ps_partkey Having Sum(ps_supplycost * ps_availqty) > ( Select Sum(ps_supplycost * ps_availqty) * 1 From partsupp, supplier, nation Where ps_supp...
tpch
Select COUNT(1) From postHistory As ph, users As u Where ph.PostHistoryTypeId = 2 And ph.UserId = u.Id
stats
SELECT AVG(ss_coupon_amt) AS agg3, AVG(ss_sales_price) AS agg4, AVG(ss_list_price) AS agg2, AVG(ss_quantity) AS agg1, i_item_id FROM store_sales INNER JOIN customer_demographics ON ss_cdemo_sk = cd_demo_sk INNER JOIN date_dim ON ss_sold_date_sk = d_date_sk INNER JOIN item ON ss_item_sk = i_item_sk INNER JOIN promotion ...
tpcds
SELECT SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, SUM(l_quantity) AS sum_qty, SUM(l_extendedprice) AS sum_base_price, AVG(l_discount) AS avg_disc, COUNT(*) AS count_order, AVG(l_quantity) AS avg_qty, l_linestatus, l_returnflag, AVG(l_e...
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 = ci.movie_id AND an.person_id = n.id AND mk.movie_id = ...
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 chn.id = ci.person_role_id AND t.id = ci.movie_id AND t.production_year > 2005 AND cn.id = mc.compan...
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 ci.person_id = n.id AND n.id = an.person_id AND t.production_year BETWEEN 1980 AND 1995 AND an.person_id = ci.person_i...
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 (mc.note like '%(co-production)%' or mc.note like '%(presents)%') and mc.movie_id = mi.movie_id and it.info = 'bottom 10 rank' and mc.note not like '%(as Metro-Goldwyn-Mayer Pictures...
job
SELECT MIN(k.keyword) AS movie_keyword, MIN(n.name) AS actor_name, MIN(t.title) AS marvel_movie FROM cast_info AS ci, keyword AS k, movie_keyword AS mk, name AS n, title AS t WHERE n.name LIKE '%Hemsworth%Chris%' AND t.id = ci.movie_id AND k.id = mk.keyword_id AND k.keyword = 'marvel-cinematic-universe' AND t.productio...
job
select total_revenue, s_suppkey, s_phone, s_name, s_address from supplier, revenue0 where s_suppkey = supplier_no and total_revenue = ( select max(total_revenue) from revenue0 ) order by s_suppkey
tpch
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 s_nationkey = n2.n_na...
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 it2.info = 'release dates' AND miidx.movie_id =...
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.id = ml.link_type_id AND (n.gender = 'm' OR (n.gender = 'f' AND n.name LIKE 'B%')) AND it.info = 'mini biography' A...
job
SELECT p_size, COUNT(DISTINCT ps_suppkey) AS supplier_cnt, p_type, p_brand FROM partsupp, part WHERE p_type NOT LIKE 1 AND p_brand <> 1 AND p_size IN (1, 1, 1, 1, 1, 1, 1, 1) AND p_partkey = ps_partkey AND ps_suppkey NOT IN ( SELECT s_suppkey FROM supplier WHERE s_comment LIKE '%Customer%Complaints%' ) GROUP BY p_brand...
tpch
Select Count(*) From comments As c, posts As p, postLinks As pl, votes As v Where v.VoteTypeId = 2 And pl.PostId = v.PostId And p.Score >= -3 And p.Id = c.PostId And c.CreationDate >= '2010-08-02 23:52:10'::timestamp And c.PostId = pl.PostId
stats
SELECT s_phone, s_suppkey, s_name, 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 n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, supplier, nation, region WHERE l_suppkey = s_suppkey AND o_orderdate < DATE 1 + INTERVAL '1' YEAR AND c_custkey = o_custkey AND l_orderkey = o_orderkey AND c_nationkey = s_nationkey AND n_regionkey = r_regionkey AND s_nat...
tpch
SELECT MIN(mi.info) AS release_date, MIN(miidx.info) AS rating, MIN(t.title) AS german_movie FROM company_name AS cn, company_type AS ct, info_type AS it, info_type AS it2, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS miidx, title AS t WHERE miidx.movie_id = t.id AND mi.movie_id = miidx.m...
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.id = mc.company_id AND rt.id = ci.role_id AND t.production_year > 2005 AND ci.note LIKE '%(uncred...
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.id = mk.movie_id AND mi.info in ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Danish', 'Norwegian', 'German') AND t.production_year > 2000 AND k.keyword like '%sequel%' ...
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 SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, SUM(l_quantity) AS sum_qty, COUNT(*) AS count_order, l_returnflag, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, SUM(l_extendedprice) AS sum_base_price, AVG(l_quantity) AS avg_qty, l_linestatus, AVG(l_extendedprice) AS avg_price, A...
tpch
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 s_nationkey = n_nationkey AND p_partkey = l_partkey AND s_sup...
tpch
SELECT nation, o_year, SUM(amount) AS sum_profit FROM ( SELECT n_name AS nation, EXTRACT(YEAR FROM o_orderdate) AS o_year, l_extendedprice * (1 - l_discount) - ps_supplycost * l_quantity AS amount FROM part, supplier, lineitem, partsupp, orders, nation WHERE p_name LIKE 1 ) AS profit AND ps_suppkey = l_suppkey AND o_or...
tpch
SELECT SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, AVG(l_discount) AS avg_disc, l_returnflag, SUM(l_quantity) AS sum_qty, AVG(l_extendedprice) AS avg_price, AVG(l_quantity) AS avg_qty, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, COUNT(*) AS count_order, SUM(l_extendedprice) AS su...
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 it.id = miidx.info_type_id AND miidx.movie_id =...
job
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 MIN(mc.note) AS production_note, MIN(t.title) AS movie_title, MIN(t.production_year) AS movie_year FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info_idx AS mi_idx, title AS t WHERE t.id = mc.movie_id AND it.id = mi_idx.info_type_id AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures...
job
SELECT i_item_id, AVG(cs_quantity) AS agg1, AVG(cs_sales_price) AS agg4, 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 p_type, p_size, COUNT(DISTINCT ps_suppkey) AS supplier_cnt, p_brand FROM partsupp, part WHERE p_partkey = ps_partkey AND p_brand <> 1 AND p_size = ANY(ARRAY[1, 1, 1, 1, 1, 1, 1, 1]) AND p_type NOT LIKE 1 AND ps_suppkey NOT IN ( SELECT s_suppkey FROM supplier WHERE s_comment LIKE '%Customer%Complaints%' ) GROUP B...
tpch
SELECT p_brand, p_type, p_size, COUNT(DISTINCT ps_suppkey) AS supplier_cnt FROM partsupp, part WHERE p_size IN (1, 1, 1, 1, 1, 1, 1, 1) AND ps_suppkey NOT IN ( SELECT s_suppkey FROM supplier WHERE s_comment LIKE '%Customer%Complaints%' ) AND p_type NOT LIKE 1 AND p_brand <> 1 AND p_partkey = ps_partkey GROUP BY p_brand...
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 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 p_brand, p_type, p_size, Count(Distinct ps_suppkey) As supplier_cnt From partsupp, part Where p_size In (1, 1, 1, 1, 1, 1, 1, 1) And p_type Not Like 1 And ps_suppkey Not In ( Select s_suppkey From supplier Where s_comment Like '%Customer%Complaints%' ) And p_partkey = ps_partkey And p_brand <> 1 Group By p_brand...
tpch
SELECT i_item_id, i_item_desc, i_current_price FROM item INNER JOIN inventory ON i_item_sk = inv_item_sk INNER JOIN date_dim ON d_date_sk = inv_date_sk INNER JOIN catalog_sales ON cs_item_sk = i_item_sk WHERE d_date BETWEEN CAST('2002-01-23' AS DATE) AND (CAST('2002-01-23' AS DATE) + INTERVAL '60 days') AND i_current_p...
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.keyword LIKE '%sequel%' AND k.id = mk.keyword_id AND t.production_year > 2005 AND t.id = mi.movie_id AND mk.movie_id = mi.movie_id AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Denmar...
job
SELECT MIN(mc.note) AS production_note, MIN(t.title) AS movie_title, MIN(t.production_year) AS movie_year FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info_idx AS mi_idx, title AS t WHERE ct.id = mc.company_type_id AND it.id = mi_idx.info_type_id AND mc.movie_id = mi_idx.movie_id AND it.info =...
job
select COUNT(1) from comments as c, postHistory as ph, users as u where u.UpVotes <= 27 AND u.Id = c.UserId AND u.Reputation >= 1 AND c.UserId = ph.UserId LIMIT 20;
stats
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 mi.info in ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Danish', 'Norwegian', 'German') and k.keyword like '%sequel%' and k.id = mk.keyword_id and t.id = mk.movie_id and ...
job
SELECT COUNT(*) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v, users AS u WHERE p.PostTypeId = 1 AND p.Id = v.PostId AND p.Id = pl.PostId AND u.Id = p.OwnerUserId AND p.AnswerCount >= 0 AND p.Id = c.PostId AND p.Id = ph.PostId
stats
SELECT MAX(cn.name) AS from_company, MAX(lt.link) AS link_type, MAX(t.title) AS western_sequel FROM company_name AS cn, company_type AS ct, info_type AS it, keyword AS k, link_type AS lt, movie_companies AS mc, movie_info AS mi, movie_keyword AS mk, movie_link AS ml, title AS t WHERE t.id = mk.movie_id AND cn.country_c...
job
SELECT COUNT(*) FROM comments AS c, posts AS p, postLinks AS pl, votes AS v WHERE pl.PostId = v.PostId AND v.VoteTypeId = 2 AND c.CreationDate >= '2010-08-02 23:52:10'::timestamp AND p.Id = c.PostId AND p.Score >= -3 AND c.PostId = pl.PostId
stats
SELECT MIN(n.name) AS of_person, MIN(t.title) AS biography_movie FROM aka_name AS an, cast_info AS ci, info_type AS it, link_type AS lt, movie_link AS ml, name AS n, person_info AS pi, title AS t WHERE an.person_id = ci.person_id AND n.name_pcode_cf BETWEEN 'A' AND 'F' AND it.info = 'mini biography' AND it.id = pi.info...
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 k.keyword = 'marvel-cinematic-universe' AND t.id = mk.movie_id AND ci.movie_id = mk.movie_id AND t.production_year > 2010 AND n.id = ci.per...
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(n.name) AS actor_name, MIN(t.title) AS marvel_movie, MIN(k.keyword) AS movie_keyword FROM cast_info AS ci, keyword AS k, movie_keyword AS mk, name AS n, title AS t WHERE ci.movie_id = mk.movie_id AND n.name LIKE '%Downey%Robert%' AND t.production_year > 2010 AND t.id = ci.movie_id AND k.id = mk.keyword_id AN...
job
SELECT i_item_id, s_store_name, SUM(cs_quantity) AS catalog_sales_quantity, SUM(sr_return_quantity) AS store_returns_quantity, SUM(ss_quantity) AS store_sales_quantity, 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 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 lt.link = 'features' AND n.i...
job
SELECT n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, supplier, nation, region WHERE r_name = 1 AND c_nationkey = s_nationkey AND l_orderkey = o_orderkey AND c_custkey = o_custkey AND o_orderdate >= DATE 1 AND s_nationkey = n_nationkey AND o_orderdate < DATE 1 + INTERVAL '1'...
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 ml.movie_id = mk.movie_id AND cn.co...
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 = ph.PostId AND p.Id = c.PostId AND p.AnswerCount >= 0 AND p.Id = pl.PostId AND p.Id = v.PostId AND p.PostTypeId = 1 AND u.Id = p.OwnerUserId LIMIT 10;
stats
SELECT AVG(ss_coupon_amt) AS agg3, AVG(ss_quantity) AS agg1, AVG(ss_sales_price) AS agg4, i_item_id, AVG(ss_list_price) AS agg2 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 COUNT(cs_quantity) AS catalog_sales_quantitycount, COUNT(ss_quantity) AS store_sales_quantitycount, STDDEV_SAMP(cs_quantity) / AVG(cs_quantity) AS catalog_sales_quantitycov, STDDEV_SAMP(ss_quantity) AS store_sales_quantitystdev, AVG(ss_quantity) AS store_sales_quantityave, STDDEV_SAMP(sr_return_quantity) / AVG(s...
tpcds