text
stringlengths
84
1.49k
benchmark
stringclasses
4 values
SELECT s_acctbal, s_comment, s_phone, p_partkey, s_address, p_mfgr, n_name, s_name 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
SELECT o_year, SUM( CASE WHEN nation = 1 THEN volume ELSE 0 END ) / SUM(volume) AS mkt_share FROM ( SELECT EXTRACT(YEAR FROM o_orderdate) AS o_year, l_extendedprice * (1 - l_discount) AS volume, n2.n_name AS nation FROM part, supplier, lineitem, orders, customer, nation n1, nation n2, region WHERE s_nationkey = n2.n_na...
tpch
WITH _q AS ( SELECT total_revenue, s_address, s_suppkey, s_phone, s_name FROM supplier, revenue0 WHERE s_suppkey = supplier_no AND total_revenue = ( SELECT MAX(total_revenue) FROM revenue0 ) ORDER BY s_suppkey ) SELECT * FROM _q;
tpch
select min(t.production_year) as movie_year, min(t.title) as movie_title, min(mc.note) as production_note from company_type as ct, info_type as it, movie_companies as mc, movie_info_idx as mi_idx, title as t where ct.id = mc.company_type_id AND t.id = mc.movie_id AND it.id = mi_idx.info_type_id AND (mc.note like '%(co-...
job
SELECT c_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue, c_acctbal, c_phone, n_name, c_comment, c_address, c_custkey 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 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_commitdate < l_receiptdate And l_receiptda...
tpch
SELECT MIN(t.title) AS movie_title FROM company_name AS cn, keyword AS k, movie_companies AS mc, movie_keyword AS mk, title AS t WHERE cn.id = mc.company_id AND mc.movie_id = mk.movie_id AND k.keyword ='character-name-in-title' AND t.id = mk.movie_id AND cn.country_code ='[nl]' AND mc.movie_id = t.id AND mk.keyword_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 t.id = mc.movie_id AND ct.id = mc.company_type_id AND mc.movie_id = mi_idx.movie_id AND t.id = mi_idx.movi...
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 it.id = mi.info_type_id And ml.movi...
job
SELECT ca_city, bought_city, c_last_name, extended_price, c_first_name, ss_ticket_number, list_price, 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 c_preferred_cust_flag, c_first_name, c_last_name, cnt, ss_ticket_number, c_salutation FROM ( SELECT ss_ticket_number, ss_customer_sk, COUNT(*) AS cnt FROM store_sales JOIN date_dim ON ss_sold_date_sk = d_date_sk JOIN store ON ss_store_sk = s_store_sk JOIN household_demographics ON ss_hdemo_sk = hd_demo_sk WHERE ...
tpcds
SELECT COUNT(*) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v, users AS u WHERE p.AnswerCount >= 0 AND p.Id = pl.PostId AND p.PostTypeId = 1 AND u.Id = p.OwnerUserId AND p.Id = c.PostId AND p.Id = v.PostId AND p.Id = ph.PostId LIMIT 500;
stats
SELECT c_last_name, c_first_name, c_salutation, c_preferred_cust_flag, ss_ticket_number, cnt FROM ( SELECT ss_ticket_number, ss_customer_sk, COUNT(1) 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.title) AS american_movie FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info AS mi, title AS t WHERE t.id = mi.movie_id AND t.id = mc.movie_id AND ct.id = mc.company_type_id AND it.id = mi.info_type_id AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND it.info = 'bottom ...
job
SELECT s_acctbal, s_name, n_name, p_partkey, p_mfgr, s_address, s_phone, s_comment FROM part, supplier, partsupp, nation, region WHERE r_name = 1 AND s_nationkey = n_nationkey AND p_size = 1 AND ps_supplycost = ( SELECT MIN(ps_supplycost) FROM partsupp, supplier, nation, region WHERE p_partkey = ps_partkey AND s_suppke...
tpch
SELECT s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE s_nationkey = n_nationkey 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 EXISTS ( SELECT * FROM lineitem l2 WHERE l2.l_orderke...
tpch
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 ='[de]' AND k.keyword ='character-name-in-title' AND cn.id = mc.company_id AND mc.movie_id = t.id AND mk.keyword_id = k.id AND t.id = mk.movie_id AND mc.mov...
job
select count(*) from badges as b, users as u where b.UserId = u.Id AND u.UpVotes >= 0 limit 10;
stats
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 mk.keyword_id = k.id AND ci.movie_id = mc.movie_id AND an.person_id = ci.person_id AND t.id...
job
SELECT c_salutation, c_last_name, ss_ticket_number, cnt, c_first_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 COUNT(*) FROM comments AS c, posts AS p, postLinks AS pl, votes AS v WHERE p.Score >= -3 AND c.PostId = pl.PostId AND p.Id = c.PostId AND c.CreationDate >= '2010-08-02 23:52:10'::timestamp AND pl.PostId = v.PostId AND v.VoteTypeId = 2 LIMIT 10;
stats
Select total, CAST(promotions As DECIMAL(15, 4)) / CAST(total As DECIMAL(15, 4)) * 100, promotions From ( Select Sum(ss_ext_sales_price) As promotions From store_sales Inner Join store On ss_store_sk = s_store_sk Inner Join promotion On ss_promo_sk = p_promo_sk Inner Join date_dim On ss_sold_date_sk = d_date_sk Inner J...
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 = ph.PostId AND p.Id = pl.RelatedPostId AND b.UserId = u.Id AND p.Id = v.PostId AND pl.LinkTypeId = 1 AND p.Id = c.PostId AND c.UserId = u.Id AND p.Score <= 40
stats
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 it.info = 'top 250 rank' AND mc.movie_id = mi_i...
job
SELECT n_name, s_name, s_comment, s_acctbal, s_address, s_phone, p_partkey, p_mfgr FROM part, supplier, partsupp, nation, region WHERE r_name = 1 AND s_nationkey = n_nationkey AND p_type LIKE 1 AND p_partkey = ps_partkey AND n_regionkey = r_regionkey AND s_suppkey = ps_suppkey AND p_size = 1 AND ps_supplycost = ( SELEC...
tpch
Select Min(t.title) As movie_title, Min(t.production_year) As movie_year, Min(mc.note) As production_note From company_type As ct, info_type As it, movie_companies As mc, movie_info_idx As mi_idx, title As t Where it.info = 'top 250 rank' And mc.note Not Like '%(As Metro-Goldwyn-Mayer Pictures)%' And t.id = mi_idx.movi...
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 mi.movie_id = t.id AND mc.note NOT ...
job
SELECT cc_manager AS manager, cc_call_center_id AS call_center, SUM(cr_net_loss) AS returns_loss, cc_name AS call_center_name FROM call_center JOIN catalog_returns ON cr_call_center_sk = cc_call_center_sk JOIN date_dim ON cr_returned_date_sk = d_date_sk JOIN customer ON cr_returning_customer_sk = c_customer_sk JOIN cus...
tpcds
WITH _q AS ( SELECT MIN(n.name) AS voicing_actress, MIN(t.title) AS voiced_movie FROM aka_name AS an, char_name AS chn, cast_info AS ci, company_name AS cn, info_type AS it, movie_companies AS mc, movie_info AS mi, name AS n, role_type AS rt, title AS t WHERE cn.country_code = '[us]' AND n.gender = 'f' AND t.id = mi.mo...
job
SELECT n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, supplier, nation, region WHERE c_nationkey = s_nationkey AND l_suppkey = s_suppkey AND r_name = 1 AND c_custkey = o_custkey AND o_orderdate >= DATE 1 AND s_nationkey = n_nationkey AND o_orderdate < DATE 1 + INTERVAL '1' Y...
tpch
Select cc_call_center_id As call_center, cc_name As call_center_name, Sum(cr_net_loss) As returns_loss, cc_manager As manager From call_center INNER JOIN catalog_returns On cr_call_center_sk = cc_call_center_sk INNER JOIN date_dim On cr_returned_date_sk = d_date_sk INNER JOIN customer On cr_returning_customer_sk = c_cu...
tpcds
SELECT s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE s_nationkey = n_nationkey AND n_name = 1 AND o_orderkey = l1.l_orderkey AND EXISTS ( SELECT * FROM lineitem l2 WHERE l2.l_orderkey = l1.l_orderkey AND l2.l_suppkey <> l1.l_suppkey ) AND NOT EXISTS ( SELECT * FROM lineitem l3 WHERE l3.l_...
tpch
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 ct.id = mc.company_type_id AND ct.kind = 'production companies' AND it.id = mi_idx.info_type_id AND mc.mov...
job
SELECT o_orderdate, SUM(l_extendedprice * (1 - l_discount)) AS revenue, o_shippriority, l_orderkey FROM customer, orders, lineitem WHERE o_orderdate < DATE 1 AND l_shipdate > DATE 1 AND c_custkey = o_custkey AND l_orderkey = o_orderkey AND c_mktsegment = 1 GROUP BY l_orderkey, o_orderdate, o_shippriority ORDER BY reven...
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 it2.info = 'release dates' And mi_idx.info < '3.5' And t.id = at.movie...
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 n.id = pi.person_id and ml.linked_movie_id = t.id and t.id = ci.movie_id and ci.movie_id = ml.linked_movie_id and an.p...
job
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.production_year > 2000 AND t.id = mi.movie_id AND t.id = mk.movie_id AND k.id = mk.keyword_id AND mi.info In ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Danish', 'Norw...
job
SELECT MIN(t.title) AS american_movie FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info AS mi, title AS t WHERE t.id = mi.movie_id AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND t.id = mc.movie_id AND it.info = 'bottom 10 rank' AND it.id = mi.info_type_id AND (mc.note LIKE '%(c...
job
SELECT COUNT(*) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v, badges AS b WHERE pl.LinkTypeId = 1 AND p.Id = v.PostId AND p.Id = pl.RelatedPostId AND p.Id = c.PostId AND p.Id = ph.PostId AND c.Score = 0 AND b.UserId = c.UserId
stats
SELECT MIN(an.name) AS cool_actor_pseudonym, MIN(t.title) AS series_named_after_char FROM aka_name AS an, cast_info AS ci, company_name AS cn, keyword AS k, movie_companies AS mc, movie_keyword AS mk, name AS n, title AS t WHERE t.episode_nr >= 50 AND cn.country_code = '[us]' AND ci.movie_id = mc.movie_id AND t.id = mc...
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 t.production_year > 2010 AND n.name LIKE '%Downey%Robert%' AND t.id = mk.movie_id AND ci.movie_id = mk.movie_id AND t.id = ci.movie_id AND ...
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 t.production_year BETWEEN 1980 AND 1995 AND (n.gender = 'm' OR (n.gender = 'f' AND n.name LIKE 'B%')) AND pi.note = 'V...
job
SELECT COUNT(*) FROM comments AS c, postHistory AS ph, votes AS v, users AS u WHERE v.UserId = ph.UserId AND ph.UserId = c.UserId AND u.UpVotes <= 123 AND u.Id = v.UserId AND u.Views >= 0 AND u.DownVotes >= 0 LIMIT 20;
stats
SELECT o_year, SUM( CASE WHEN nation = 1 THEN volume ELSE 0 END ) / SUM(volume) AS mkt_share FROM ( SELECT EXTRACT(YEAR FROM o_orderdate) AS o_year, l_extendedprice * (1 - l_discount) AS volume, n2.n_name AS nation FROM part, supplier, lineitem, orders, customer, nation n1, nation n2, region WHERE r_name = 1 AND n1.n_r...
tpch
SELECT MIN(t.title) AS movie_title FROM keyword AS k, movie_info AS mi, movie_keyword AS mk, title AS t WHERE t.production_year > 2005 AND t.id = mk.movie_id AND k.id = mk.keyword_id AND k.keyword LIKE '%sequel%' AND t.id = mi.movie_id AND mk.movie_id = mi.movie_id AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Denmar...
job
SELECT MIN(cn.name) AS from_company, MIN(lt.link) AS link_type, MIN(t.title) AS western_sequel FROM company_name AS cn, company_type AS ct, info_type AS it, keyword AS k, link_type AS lt, movie_companies AS mc, movie_info AS mi, movie_keyword AS mk, movie_link AS ml, title AS t WHERE ml.movie_id = mc.movie_id AND cn.id...
job
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 pl.LinkTypeId = 1 AND p.Id = pl.PostId AND p.FavoriteCount >= 0 AND p.Id = c.PostId AND p.Id = v.PostId LIMIT 500;
stats
SELECT l_shipmode, SUM( CASE WHEN o_orderpriority = '1-URGENT' OR o_orderpriority = '2-HIGH' THEN 1 ELSE 0 END ) AS high_line_count, SUM( CASE WHEN o_orderpriority <> '1-URGENT' AND o_orderpriority <> '2-HIGH' THEN 1 ELSE 0 END ) AS low_line_count FROM orders, lineitem WHERE l_receiptdate < DATE 1 + INTERVAL '1' YEAR A...
tpch
SELECT COUNT(*) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v, badges AS b, users AS u WHERE p.Score <= 40 AND b.UserId = u.Id AND p.Id = c.PostId AND c.UserId = u.Id AND pl.LinkTypeId = 1 AND p.Id = pl.RelatedPostId AND p.Id = v.PostId AND p.Id = ph.PostId
stats
SELECT MIN(mi_idx.info) AS rating, MIN(t.title) AS western_violent_movie, MIN(cn.name) AS movie_company 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 t.id = mk.movie_id AND k.id = mk.keyword_id AND n.id = ci.person_id AND ci.movie_id = mk.movie_id AND t.production_year > 2010 AND t.id = c...
job
select i_item_id, avg(ss_quantity) as agg1, avg(ss_list_price) as agg2, avg(ss_coupon_amt) as agg3, 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 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 t.id = ci.movie_id AND k.keyword = 'marvel-cinematic-universe' AND n.name LIKE '%Downey%Robert%' AND n.id = ci.person_id AND t.id = mk.movi...
job
SELECT i_item_desc, i_item_id, 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 i_manufact_id IN (148, 455, 491, 85) AND i_current_price <= 95 + 30 AND d_date BETWEEN CAST('2002-01-23' AS DATE) AND (CAST('2002...
tpcds
select sum(l_extendedprice * (1 - l_discount)) as revenue, c_custkey, c_comment, n_name, c_address, c_phone, c_acctbal, c_name 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(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.production_year > 2010 AND n.id = ci.person_id AND ci.movie_id = mk.movie_id AND k.keyword = 'marvel-cinematic-u...
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_shipmode IN (1, 1) AND l_shipdate < l_comm...
tpch
select s_name, count(*) as numwait from supplier, lineitem l1, orders, nation where 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 o_orderstatus = 'F' and s_nationkey = n_nati...
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 = mc.movie_id AND k.id ...
job
SELECT MAX(t.title) AS movie_title FROM keyword AS k, movie_info AS mi, movie_keyword AS mk, title AS t WHERE mk.movie_id = mi.movie_id AND k.keyword LIKE '%sequel%' AND t.production_year > 2005 AND t.id = mk.movie_id AND t.id = mi.movie_id AND k.id = mk.keyword_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 t.id = mi_idx.movie_id AND (mc.note LIKE '%...
job
SELECT l_linestatus, SUM(l_quantity) AS sum_qty, l_returnflag, COUNT(*) AS count_order, AVG(l_quantity) AS avg_qty, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, SUM(l_extendedprice) AS sum_base_price, AVG(l_extendedprice) AS avg_price, AVG(l_discount) AS avg_disc, SUM(l_extendedprice * (1 - l_discount) * ...
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.production_year > 2010 AND n.name LIKE '%Hemsworth%Chris%' AND k.keyword = 'marvel-cinematic-universe' AND ...
job
WITH year_total AS ( SELECT SUM(((ss_ext_list_price - ss_ext_wholesale_cost - ss_ext_discount_amt) + ss_ext_sales_price) / 2) AS year_total, c_first_name AS customer_first_name, d_year AS dyear, 's' AS sale_type, c_birth_country AS customer_birth_country, c_email_address AS customer_email_address, c_login AS customer_l...
tpcds
SELECT p_brand, p_type, p_size, COUNT(DISTINCT ps_suppkey) AS supplier_cnt FROM partsupp, part WHERE p_brand <> 1 AND p_partkey = ps_partkey AND p_type NOT LIKE 1 AND p_size = ANY(ARRAY[1, 1, 1, 1, 1, 1, 1, 1]) AND ps_suppkey NOT IN ( SELECT s_suppkey FROM supplier WHERE s_comment LIKE '%Customer%Complaints%' ) GROUP B...
tpch
SELECT s_store_name, i_item_desc, MAX(ss_net_profit) AS store_sales_profit, MAX(sr_net_loss) AS store_returns_loss, i_item_id, MAX(cs_net_profit) AS catalog_sales_profit, s_store_id FROM store_sales JOIN store_returns ON store_sales.ss_customer_sk = store_returns.sr_customer_sk AND store_sales.ss_item_sk = store_return...
tpcds
select count(*) from comments as c, posts as p, postLinks as pl, postHistory as ph, votes as v where p.Id = pl.PostId AND pl.LinkTypeId = 1 AND p.Id = ph.PostId AND c.Score = 0 AND p.FavoriteCount >= 0 AND p.Id = c.PostId AND p.Id = v.PostId
stats
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.info = 'top 250 rank' AND mc.movie_id = mi_idx.movie_id AND ct.kind = 'productio...
job
SELECT SUM(ss_ext_sales_price) AS ext_price, i_manufact_id, i_brand AS brand, i_brand_id AS brand_id, i_manufact 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(mi.info) AS release_date, MIN(miidx.info) AS rating, MIN(t.title) AS german_movie FROM company_name AS cn, company_type AS ct, info_type AS it, info_type AS it2, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS miidx, title AS t WHERE ct.kind = 'production companies' AND mi.movie_i...
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 t.production_year > 2010 AND n.name LIKE '%Hemsworth%Chris%' AND n.id = ci.person_id AND t.id = ci.movie_id AND ci.movie_id = mk.movie_id A...
job
SELECT MIN(lt.link) AS link_type, MIN(cn.name) AS from_company, MIN(t.title) AS western_sequel FROM company_name AS cn, company_type AS ct, info_type AS it, keyword AS k, link_type AS lt, movie_companies AS mc, movie_info AS mi, movie_keyword AS mk, movie_link AS ml, title AS t WHERE it.id = mi.info_type_id AND cn.id =...
job
select count(*) from postHistory as ph, users as u where ph.PostHistoryTypeId = 2 and ph.UserId = u.Id LIMIT 1000;
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.Score <= 40 AND p.Id = ph.PostId AND p.Id = c.PostId AND p.Id = pl.RelatedPostId AND pl.LinkTypeId = 1 AND c.UserId = u.Id AND p.Id = v.PostId AND b.UserId = u.Id
stats
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_nationkey = s_nationkey AND o_orderdate >= DATE 1 AND c_custkey = o_custkey AND r_name = 1 AND s_nationkey = n_nation...
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.id = ci.person_id AND t.id = mk.movie_id AND ci.movie_id = mk.movie_id AND n.name LIKE '%Downey%Robert%' AND t.id = ci.movie_id AND k.key...
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 = v.PostId AND p.PostTypeId = 1 AND u.Id = p.OwnerUserId AND p.Id = pl.PostId AND p.AnswerCount >= 0 AND p.Id = c.PostId
stats
SELECT MAX(chn.name) AS uncredited_voiced_character, MAX(t.title) AS russian_movie FROM char_name AS chn, cast_info AS ci, company_name AS cn, company_type AS ct, movie_companies AS mc, role_type AS rt, title AS t WHERE ci.note LIKE '%(uncredited)%' AND rt.id = ci.role_id AND rt.role = 'actor' AND t.id = mc.movie_id AN...
job
Select p_brand, p_type, p_size, Count(Distinct ps_suppkey) As supplier_cnt From partsupp, part Where p_brand <> 1 AND p_size IN (1, 1, 1, 1, 1, 1, 1, 1) AND p_partkey = ps_partkey AND ps_suppkey Not In ( Select s_suppkey From supplier Where s_comment Like '%Customer%Complaints%' ) AND p_type Not Like 1 Group By p_brand...
tpch
Select Avg(l_discount) As avg_disc, Sum(l_extendedprice) As sum_base_price, Sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) As sum_charge, Count(*) As count_order, Avg(l_extendedprice) As avg_price, Sum(l_quantity) As sum_qty, Avg(l_quantity) As avg_qty, Sum(l_extendedprice * (1 - l_discount)) As sum_disc_price, ...
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 mi.movie_id = ci.movie_id AND n.id = ci.person_id AND rt.role = 'actress'...
job
select min(mi_idx.info) as rating, min(t.title) as movie_title from info_type as it, movie_info_idx as mi_idx, title as t where it.id = mi_idx.info_type_id and t.id = mi_idx.movie_id and it.info ='rating' and t.production_year between 2000 and 2005 and mi_idx.info > '8.0'
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 mi.movie_id = t.id AND lt.id = ml.l...
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 cntrycode, COUNT(1) as numcust, sum(c_acctbal) as totacctbal from ( select SUBSTRING(c_phone from 1 FOR 2) as cntrycode, c_acctbal from customer where SUBSTRING(c_phone from 1 FOR 2) in (1, 1, 1, 1, 1, 1, 1) and c_acctbal > ( select avg(c_acctbal) from customer where c_acctbal > 0.00 and SUBSTRING(c_phone from 1...
tpch
SELECT supp_nation, cust_nation, l_year, SUM(volume) AS revenue FROM ( SELECT n1.n_name AS supp_nation, n2.n_name AS cust_nation, EXTRACT(YEAR FROM l_shipdate) AS l_year, l_extendedprice * (1 - l_discount) AS volume FROM supplier, lineitem, orders, customer, nation n1, nation n2 WHERE l_shipdate BETWEEN DATE '1995-01-0...
tpch
SELECT supp_nation, cust_nation, l_year, SUM(volume) AS revenue FROM ( SELECT n1.n_name AS supp_nation, n2.n_name AS cust_nation, EXTRACT(YEAR FROM l_shipdate) AS l_year, l_extendedprice * (1 - l_discount) AS volume FROM supplier, lineitem, orders, customer, nation n1, nation n2 WHERE l_shipdate BETWEEN DATE '1995-01-0...
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 s_nationkey = n2.n_na...
tpch
SELECT total, promotions, 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 keyword AS k, movie_info AS mi, movie_keyword AS mk, title AS t WHERE t.id = mk.movie_id AND mk.movie_id = mi.movie_id AND t.production_year > 2005 AND k.keyword LIKE '%sequel%' AND mi.info = ANY(ARRAY['Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Denish', 'Norwegian', 'G...
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 t.id = mi_idx.movie_id AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND ct.id = mc.company_t...
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 = n1.id AND rt.role = 'actress' AND ci.movie_id = mc.movie_id AND mc.note NOT LIKE '%(USA)%' AND ...
job
SELECT MIN(mi_idx.info) AS rating, MIN(t.title) AS movie_title FROM info_type AS it, movie_info_idx AS mi_idx, title AS t WHERE it.id = mi_idx.info_type_id AND t.id = mi_idx.movie_id AND it.info ='rating' AND mi_idx.info > '8.0' AND t.production_year >= 2000 AND t.production_year <= 2005
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 ci.person_id = an.person_id AND...
job
SELECT cntrycode, COUNT(*) AS numcust, SUM(c_acctbal) AS totacctbal FROM ( SELECT SUBSTRING(c_phone FROM 1 FOR 2) AS cntrycode, c_acctbal FROM customer WHERE c_acctbal > ( SELECT AVG(c_acctbal) FROM customer WHERE c_acctbal > 0.00 AND SUBSTRING(c_phone FROM 1 FOR 2) IN (1, 1, 1, 1, 1, 1, 1) ) AND SUBSTRING(c_phone FROM...
tpch
SELECT MIN(t.title) AS voiced_movie, MIN(n.name) AS voicing_actress 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 an.person_id = n.id AND n.id = ci.person_id...
job
Select c_name, c_custkey, Sum(l_quantity), o_orderdate, o_totalprice, o_orderkey From customer, orders, lineitem Where o_orderkey In ( Select l_orderkey From lineitem Group By l_orderkey Having Sum(l_quantity) > 1 ) And c_custkey = o_custkey And o_orderkey = l_orderkey Group By c_name, c_custkey, o_orderkey, o_orderdat...
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 Avg(cs_quantity) As catalog_sales_quantityave, STDDEV_SAMP(sr_return_quantity) / Avg(sr_return_quantity) As store_returns_quantitycov, Avg(sr_return_quantity) As store_returns_quantityave, STDDEV_SAMP(ss_quantity) As store_sales_quantitystdev, Count(sr_return_quantity) As store_returns_quantitycount, i_item_desc...
tpcds
SELECT COUNT(DISTINCT ps_suppkey) AS supplier_cnt, p_type, p_brand, p_size FROM partsupp, part WHERE p_partkey = ps_partkey AND p_brand <> 1 AND p_type NOT LIKE 1 AND p_size = ANY(ARRAY[1, 1, 1, 1, 1, 1, 1, 1]) AND ps_suppkey NOT IN ( SELECT s_suppkey FROM supplier WHERE s_comment LIKE '%Customer%Complaints%' ) GROUP B...
tpch