text
stringlengths
84
1.49k
benchmark
stringclasses
4 values
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 LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%') AND it.info = 'bottom 10 rank' AND mc.movie_id = mi.movie_id AND t.id = mc.movie_id AND ct.id...
job
SELECT MIN(mc.note) AS production_note, MIN(t.title) AS movie_title, MIN(t.production_year) AS movie_year FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info_idx AS mi_idx, title AS t WHERE it.id = mi_idx.info_type_id AND ct.id = mc.company_type_id AND t.id = mi_idx.movie_id AND mc.note NOT LIKE...
job
SELECT c_acctbal, SUM(l_extendedprice * (1 - l_discount)) AS revenue, c_phone, c_address, c_comment, c_name, n_name, 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 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 s_phone, s_suppkey, s_name, total_revenue, 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 MIN(t.title) AS biography_movie, MIN(n.name) AS of_person 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 = an.person_id AND pi.person_id = ci.person_id AND lt.id = ml.link_type_id AND ci.movie_id = ml.linked_movie_id A...
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 ci.movie_id = mk.movie_id AND t.id = ci.movie_id AND k.id = 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 n1.id = ci.person_id AND ci.movie_id = t.id AND n1.name like '%Yo%' AND ci.movie_id = mc.movie_id AND ci.role_i...
job
SELECT p_type, p_size, COUNT(DISTINCT ps_suppkey) AS supplier_cnt, p_brand FROM partsupp, part WHERE 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 AND p_size IN (1, 1, 1, 1, 1, 1, 1, 1) AND p_brand <> 1 GROUP BY p_brand...
tpch
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 t.id = mi.movie_id AND mc.note NOT LIKE '%(AS Metro-Goldwyn-Mayer Pictures)%' AND it.id = mi.info_type_id AND ct.id = mc.company_type_id AND (mc.note L...
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.title Like '%Champion%' And it2.info = 'release dates' And mi_idx.m...
job
Select i_brand_id As brand_id, i_brand As brand, Sum(ss_ext_sales_price) As ext_price 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 Where i_manager_id = 97 And d_moy = 11 And d_year = 2000 Group By i_brand, i_brand_id Order By ext_price Asc, brand_id Limit...
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 cn.id = mc.company_id AND ct.id = mc.company_ty...
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_nationkey = n2.n_na...
tpch
Select i_item_id, i_item_desc, s_store_id, s_store_name, Max(ss_net_profit) As store_sales_profit, Max(sr_net_loss) As store_returns_loss, Max(cs_net_profit) As catalog_sales_profit From store_sales Join store_returns On store_sales.ss_customer_sk = store_returns.sr_customer_sk And store_sales.ss_item_sk = store_return...
tpcds
SELECT MIN(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.name LIKE '%a%' AND n.id = pi.person_id AND pi.person_id = an.person_id AND lt.id = ml.link_type_id AND ci.movie_id...
job
WITH _q AS ( SELECT MIN(n.name) AS of_person, MIN(t.title) AS biography_movie FROM aka_name AS an, cast_info AS ci, info_type AS it, link_type AS lt, movie_link AS ml, name AS n, person_info AS pi, title AS t WHERE it.id = pi.info_type_id AND t.production_year BETWEEN 1980 AND 1995 AND pi.person_id = ci.person_id AND t...
job
SELECT MIN(chn.name) AS uncredited_voiced_character, MIN(t.title) AS russian_movie FROM char_name AS chn, cast_info AS ci, company_name AS cn, company_type AS ct, movie_companies AS mc, role_type AS rt, title AS t WHERE rt.id = ci.role_id AND ci.note LIKE '%(uncredited)%' AND cn.country_code = '[ru]' AND chn.id = ci.pe...
job
SELECT MAX(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 ct.id = mc.company_type_id AND mc.movie_id = mi.movie_id AND t.id = mc.movie_id AND ct.kind = 'production companies' AND (mc.note LIKE '%(co-production...
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 k.keyword ='character-name-In-title' AND t.id = mk.movie_id AND mk.keyword_id = k.id AND mc.movie_id = t.id AND mc.movie_id = mk.movie_id AND cn.id = mc.company_id AND cn.country_code =...
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.id = mk.keyword_id AND t.id = mk.movie_id AND ci.movie_id = mk.movie_id AND t.id = ci.movie_id AND n.id = ci.person_id AND k.keyword = 'm...
job
SELECT MIN(an.name) AS cool_actor_pseudonym, MIN(t.title) AS series_named_after_char FROM aka_name AS an, cast_info AS ci, company_name AS cn, keyword AS k, movie_companies AS mc, movie_keyword AS mk, name AS n, title AS t WHERE mk.keyword_id = k.id AND ci.movie_id = t.id AND ci.movie_id = mk.movie_id AND cn.country_co...
job
SELECT i_item_id, AVG(cs_quantity) AS agg1, AVG(cs_list_price) AS agg2, AVG(cs_coupon_amt) AS agg3, AVG(cs_sales_price) AS agg4 FROM catalog_sales JOIN customer_demographics ON cs_bill_cdemo_sk = cd_demo_sk JOIN date_dim ON cs_sold_date_sk = d_date_sk JOIN item ON cs_item_sk = i_item_sk JOIN promotion ON cs_promo_sk = ...
tpcds
SELECT 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 LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%') AND ct.id = mc.company_type_id AND it.info = 'bottom 10 rank' AND mc.movie_id = mi.movie_id A...
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.name LIKE '%Downey%Robert%' AND t.id = ci.movie_id AND n.id = ci.person_id AND t.id = mk.movie_id AND k.key...
job
SELECT SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, AVG(l_quantity) AS avg_qty, COUNT(*) AS count_order, SUM(l_quantity) AS sum_qty, l_linestatus, SUM(l_extendedprice) AS sum_base_price, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, l_returnflag, AVG(l_discount) AS avg_disc, AVG(l_e...
tpch
WITH _q AS ( select item.i_brand as brand, dt.d_year, sum(ss_ext_sales_price) as ext_price, 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 = 69 and dt.d_moy = 11 and dt.d_year = 2...
tpcds
select count(*) from comments as c, posts as p, postLinks as pl, votes as v where c.CreationDate >= '2010-08-02 23:52:10'::timestamp AND pl.PostId = v.PostId AND p.Score >= -3 AND p.Id = c.PostId AND c.PostId = pl.PostId AND v.VoteTypeId = 2 LIMIT 50;
stats
SELECT MIN(t.title) AS movie_title FROM keyword AS k, movie_info AS mi, movie_keyword AS mk, title AS t WHERE t.id = mi.movie_id AND mk.movie_id = mi.movie_id AND t.id = mk.movie_id AND mi.info = ANY(ARRAY['Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Denish', 'Norwegian', 'German']) AND t.production_year > 200...
job
SELECT c_name, SUM(l_quantity), o_orderkey, c_custkey, o_orderdate, o_totalprice 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 s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE l1.l_receiptdate > l1.l_commitdate AND s_suppkey = l1.l_suppkey AND 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_co...
tpch
SELECT MIN(an.name) AS cool_actor_pseudonym, MIN(t.title) AS series_named_after_char FROM aka_name AS an, cast_info AS ci, company_name AS cn, keyword AS k, movie_companies AS mc, movie_keyword AS mk, name AS n, title AS t WHERE ci.movie_id = mc.movie_id AND mc.movie_id = mk.movie_id AND k.keyword = 'character-name-IN-...
job
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 o_orderkey = l_orderkey AND s_nati...
tpch
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_partkey = ps_partkey AND s_nationkey = n_nationkey AND ps_supplycost = ( SELECT MIN(ps_supplycost) FROM partsupp, supplier, na...
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(chn.name) AS uncredited_voiced_character, MIN(t.title) AS russian_movie FROM char_name AS chn, cast_info AS ci, company_name AS cn, company_type AS ct, movie_companies AS mc, role_type AS rt, title AS t WHERE ci.movie_id = mc.movie_id AND rt.id = ci.role_id AND ci.note LIKE '%(voice)%' AND chn.id = ci.person...
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.info LIKE 'USA:%200%' AND it1.id = mi_idx.info_type_id AND it2.info...
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 t.id = ci.movie_id AND chn.id = ci.person_role_id AND ci.note LIKE '%(voice)%' AND rt.id = ci.role_i...
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 c.Score = 0 AND b.UserId = c.UserId AND p.Id = c.PostId AND p.Id = pl.RelatedPostId AND p.Id = v.PostId AND p.Id = ph.PostId
stats
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.production_year > 2010 AND t.id = ci.movie_id AND k.id = mk.keyword_id AND n.name LIKE '%Downey%Robert%' AND t.id = mk.movie_id AND k.key...
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 an.person_id = ci.person_id AND n.name_pcode_cf BETWEEN 'A' AND 'F' AND ml.linked_movie_id...
job
SELECT c_comment, SUM(l_extendedprice * (1 - l_discount)) AS revenue, c_address, c_acctbal, n_name, c_custkey, c_phone, c_name FROM customer, orders, lineitem, nation WHERE l_returnflag = 'R' AND c_nationkey = n_nationkey AND o_orderdate >= DATE 1 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 = mk.movie_id AND n.name LIKE '%Downey%Robert%' AND k.id = mk.keyword_id AND ci.movie_id = mk.movie_id AND n.id = ci.person_id AND t.i...
job
SELECT AVG(l_extendedprice) AS avg_price, SUM(l_extendedprice) AS sum_base_price, l_returnflag, AVG(l_quantity) AS avg_qty, SUM(l_quantity) AS sum_qty, l_linestatus, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, COUNT(1) AS count_order, A...
tpch
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 cn.country_code = '[us]' AND t.id = mk.movie_id AND an.person_id = n.id AND t.episode_nr < ...
job
WITH _q AS ( SELECT SUM(l_extendedprice * l_discount) AS revenue FROM lineitem WHERE l_discount BETWEEN 1 - 0.01 AND 1 + 0.01 AND l_shipdate >= DATE 1 AND l_quantity < 1 AND l_shipdate < DATE 1 + INTERVAL '1' YEAR LIMIT 100 ) SELECT * FROM _q;
tpch
select c_custkey, n_name, c_phone, c_comment, c_acctbal, c_name, c_address, 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 p_brand, COUNT(DISTINCT ps_suppkey) AS supplier_cnt, p_size, p_type FROM partsupp, part WHERE p_brand <> 1 AND 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 GROUP BY p_brand...
tpch
SELECT COUNT(*) FROM postHistory AS ph, posts AS p, votes AS v, badges AS b, users AS u, comments AS c WHERE u.Id = p.OwnerUserId AND u.Id = b.UserId AND p.Id = c.PostId AND p.Id = v.PostId AND p.Id = ph.PostId AND p.Score <= 192 AND p.ViewCount >= 0
stats
Select o_orderdate, o_totalprice, c_custkey, Sum(l_quantity), o_orderkey, c_name 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(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 n.gender = 'f' AND n.id = ci.person_id AND ci.person_id = an....
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.kind = 'production companies' AND t.id = mc.movie_id AND ct.id = mc.company_type_id AND it.info = 'top ...
job
SELECT MIN(mi_idx.info) AS rating, MIN(t.title) AS northamerican_movie FROM aka_title AS at, company_name AS cn, info_type AS it1, info_type AS it2, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS mi_idx, title AS t WHERE t.id = at.movie_id AND at.movie_id = mi_idx.movie_id AND mi_idx.info <...
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 k.id = mk.keyword_id AND mi.note LI...
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 kt.kind = 'movie' AND t.production_year > 2000 AND at.title LIKE '%Cha...
job
select i_brand as brand, i_brand_id as brand_id, sum(ss_ext_sales_price) as ext_price, i_manufact, i_manufact_id from date_dim join store_sales on d_date_sk = ss_sold_date_sk join item on ss_item_sk = i_item_sk join customer on ss_customer_sk = c_customer_sk join customer_address on c_current_addr_sk = ca_address_sk jo...
tpcds
SELECT COUNT(*) FROM comments AS c, posts AS p, users AS u WHERE u.Id = p.OwnerUserId AND c.UserId = u.Id AND c.CreationDate >= '2010-08-05 00:36:02'::timestamp AND p.ViewCount >= 0 AND p.FavoriteCount >= 0 AND p.CommentCount >= 0 LIMIT 20;
stats
Select c_custkey, n_name, c_address, Sum(l_extendedprice * (1 - l_discount)) As revenue, c_acctbal, c_phone, c_comment, c_name From customer, orders, lineitem, nation Where o_orderdate >= DATE 1 And l_returnflag = 'R' And o_orderdate < DATE 1 + INTERVAL '3' MONTH And l_orderkey = o_orderkey And c_nationkey = n_nationke...
tpch
SELECT COUNT(*) FROM comments AS c, posts AS p, votes AS v, users AS u WHERE u.Id = p.OwnerUserId AND p.Score >= 0 AND p.ViewCount >= 0 AND c.Score = 0 AND u.Id = c.UserId AND u.Id = v.UserId LIMIT 200;
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 AND l_shipdate < l_c...
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 i_item_id, SUM(sr_return_quantity) AS store_returns_quantity, s_store_id, SUM(ss_quantity) AS store_sales_quantity, SUM(cs_quantity) AS catalog_sales_quantity, i_item_desc, s_store_name FROM store_sales JOIN store_returns ON ss_customer_sk = sr_customer_sk AND ss_item_sk = sr_item_sk AND ss_ticket_number = sr_ti...
tpcds
WITH year_total AS ( SELECT c_preferred_cust_flag AS customer_preferred_cust_flag, c_customer_id AS customer_id, c_email_address AS customer_email_address, 's' AS sale_type, c_login AS customer_login, d_year AS dyear, SUM(((ss_ext_list_price - ss_ext_wholesale_cost - ss_ext_discount_amt) + ss_ext_sales_price) / 2) AS y...
tpcds
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_commitdate < l_re...
tpch
SELECT MAX(mi_idx.info) AS rating, MAX(t.title) AS movie_title FROM info_type AS it, movie_info_idx AS mi_idx, title AS t WHERE t.id = mi_idx.movie_id AND t.production_year BETWEEN 2000 AND 2005 AND it.id = mi_idx.info_type_id AND it.info ='rating' AND mi_idx.info > '8.0'
job
select sum(volume) as revenue, l_year, cust_nation, supp_nation from ( select n1.n_name as supp_nation, n2.n_name as cust_nation, EXTRACT(YEAR from l_shipdate) as l_year, l_extendedprice * (1 - l_discount) as volume from supplier, lineitem, orders, customer, nation n1, nation n2 where s_suppkey = l_suppkey and o_orderk...
tpch
SELECT 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 k.keyword = 'marvel-cinematic-universe' AND t.id = ci.movie_id AND t.id = mk.movie_id AND n.id = ci.person_id AND ...
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_nationkey = n_nationkey AND p...
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 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 n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, supplier, nation, region WHERE c_custkey = o_custkey AND l_orderkey = o_orderkey AND l_suppkey = s_suppkey AND s_nationkey = n_nationkey AND n_regionkey = r_regionkey AND r_name = 1 AND c_nationkey = s_nationkey AND o_ord...
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_partkey = l_partkey AND ps_s...
tpch
SELECT AVG(cs_sales_price) AS agg4, AVG(cs_list_price) AS agg2, AVG(cs_coupon_amt) AS agg3, AVG(cs_quantity) AS agg1, i_item_id FROM catalog_sales JOIN customer_demographics ON cs_bill_cdemo_sk = cd_demo_sk JOIN date_dim ON cs_sold_date_sk = d_date_sk JOIN item ON cs_item_sk = i_item_sk JOIN promotion ON cs_promo_sk = ...
tpcds
select i_current_price, i_item_desc, i_item_id 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 (195, 412, 338, 267) and inv_quantity_on_hand between 100 and 500 and i_current_price between 100 and 100 + 30 a...
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 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 s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE NOT EXISTS ( SELECT * FROM lineitem l3 WHERE l3.l_orderkey = l1.l_orderkey AND l3.l_suppkey != l1.l_suppkey AND l3.l_receiptdate > l3.l_commitdate ) AND n_name = 1 AND o_orderkey = l1.l_orderkey AND l1.l_receiptdate > l1.l_commitdate 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 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 ps_suppkey NOT IN ( SELECT s_suppkey FROM supplier WHERE s_comment LIKE '%Customer%Complaints%' ) AND p_size = ANY(ARRAY[1, 1, 1, 1, 1, 1, 1, 1]) AND p_type NOT LIKE 1 GROUP B...
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.id = mi.movie_id AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Denish', 'Norwegian', 'German') AND t.id = mk.movie_id AND t.production_year > 2005 AND mk.movie_id = mi.movie_id AND k.i...
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 10 And 10 + 10 Or ss_coupon_amt Between 984 And 984 + 1000 Or ss_wholesale_cost Between 72 And 72 + 20) ) As b1, ( Select Avg(ss_list_price) As b2_lp...
tpcds
WITH _q AS ( SELECT COUNT(*) FROM store_sales JOIN household_demographics ON ss_hdemo_sk = hd_demo_sk JOIN time_dim ON ss_sold_time_sk = t_time_sk JOIN store ON ss_store_sk = s_store_sk WHERE s_store_name = 'pri' AND hd_dep_count = 2 AND t_hour = 19 AND t_minute >= 37 ORDER BY COUNT(*) ASC LIMIT 100 ) SELECT * FROM _q;
tpcds
SELECT MIN(an.name) AS cool_actor_pseudonym, MIN(t.title) AS series_named_after_char FROM aka_name AS an, cast_info AS ci, company_name AS cn, keyword AS k, movie_companies AS mc, movie_keyword AS mk, name AS n, title AS t WHERE mk.keyword_id = k.id AND t.id = mk.movie_id AND n.id = ci.person_id AND ci.movie_id = mc.mo...
job
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 c_custkey = o_custkey AND s_suppke...
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 o_orderkey = l_orderkey AND ps_...
tpch
SELECT s_store_id, s_store_name, SUM(sr_return_quantity) AS store_returns_quantity, SUM(cs_quantity) AS catalog_sales_quantity, i_item_desc, SUM(ss_quantity) AS store_sales_quantity, i_item_id FROM store_sales JOIN store_returns ON ss_customer_sk = sr_customer_sk AND ss_item_sk = sr_item_sk AND ss_ticket_number = sr_ti...
tpcds
SELECT MIN(an.name) AS cool_actor_pseudonym, MIN(t.title) AS series_named_after_char FROM aka_name AS an, cast_info AS ci, company_name AS cn, keyword AS k, movie_companies AS mc, movie_keyword AS mk, name AS n, title AS t WHERE t.id = mc.movie_id AND t.episode_nr < 100 AND t.episode_nr >= 50 AND n.id = ci.person_id AN...
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 > 2005 AND t.id = mk.movie_id AND mk.movie_id = mi.movie_id AND k.id = mk.keyword_id AND mi.info = ANY(ARRAY['Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', ...
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 count(*) from badges as b, posts as p where b.UserId = p.OwnerUserId and p.AnswerCount >= 0 and p.AnswerCount <= 4 and b.Date <= '2014-09-11 08:55:52'::timestamp limit 20;
stats
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 it.info = 'top 250 rank' AND mc.movie_id = mi_idx.movie_id AND it.id = mi_idx.info_type_id AND (mc.note LI...
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 p_partkey = l_partkey...
tpch
SELECT MIN(t.title) AS american_movie FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info AS mi, title AS t WHERE t.id = mc.movie_id AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND it.id = mi.info_type_id AND t.id = mi.movie_id AND ct.kind = 'production companies' AND it.info = 'b...
job
Select s_address, total_revenue, s_suppkey, s_name, s_phone From supplier, revenue0 Where total_revenue = ( Select Max(total_revenue) From revenue0 ) And s_suppkey = supplier_no Order By s_suppkey
tpch
SELECT AVG(ss_coupon_amt) AS agg3, AVG(ss_quantity) AS agg1, AVG(ss_list_price) AS agg2, i_item_id, 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 cnt, c_first_name, c_last_name, c_salutation, ss_ticket_number, 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(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 = mk.movie_id AND mc.note NOT LIKE '%(USA)%' AND rt.role...
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 COUNT(1) FROM postHistory AS ph, posts AS p, votes AS v, badges AS b, users AS u, comments AS c WHERE p.Id = c.PostId AND p.Score <= 192 AND u.Id = p.OwnerUserId AND p.Id = v.PostId AND u.Id = b.UserId AND p.Id = ph.PostId AND p.ViewCount >= 0
stats
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 c_nationkey = n2.n_nationkey AND c...
tpch
SELECT c_last_name, c_first_name, c_salutation, c_preferred_cust_flag, ss_ticket_number, cnt FROM ( SELECT ss_ticket_number, ss_customer_sk, COUNT(*) AS cnt FROM store_sales 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 c_phone, c_name, n_name, c_address, c_acctbal, SUM(l_extendedprice * (1 - l_discount)) AS revenue, c_custkey, c_comment 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