text
stringlengths
84
1.49k
benchmark
stringclasses
4 values
SELECT MIN(mc.note) AS production_note, MIN(t.title) AS movie_title, MIN(t.production_year) AS movie_year FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info_idx AS mi_idx, title AS t WHERE t.id = mi_idx.movie_id AND it.id = mi_idx.info_type_id AND t.id = mc.movie_id AND mc.note NOT LIKE '%(as M...
job
SELECT s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE s_nationkey = n_nationkey AND s_suppkey = l1.l_suppkey 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 o_orderstatus = 'F' A...
tpch
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.id = pi.person_id AND t.id = ci.movie_id AND it.info = 'mini biography' AND t.produc...
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 k.keyword LIKE '%sequel%' AND k.id = mk.keyword_id AND t.id = mi.movie_id AND t.production_year > 2005 AND mi.info = ANY(ARRAY['Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Denish...
job
SELECT COUNT(*) FROM postHistory AS ph, posts AS p, votes AS v, badges AS b, users AS u, comments AS c WHERE p.ViewCount >= 0 AND p.Id = ph.PostId AND p.Score <= 192 AND p.Id = v.PostId AND u.Id = p.OwnerUserId AND u.Id = b.UserId AND p.Id = c.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 ct.id = mc.company_type_id AND it.id = mi_idx.info_type_id AND (mc.note LIKE '%(co-production)%' OR mc.not...
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 count(1) from comments as c, posts as p, users as u where p.CommentCount >= 0 and c.UserId = u.Id and c.CreationDate >= '2010-08-05 00:36:02'::timestamp and p.ViewCount >= 0 and u.Id = p.OwnerUserId and p.FavoriteCount >= 0
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.production_year > 2005 And k.keyword Like '%sequel%' And t.id = mi.movie_id And k.id = mk.keyword_id And t.id = mk.movie_id And mi.info In ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Denish', 'Norw...
job
SELECT l_orderkey, o_orderdate, SUM(l_extendedprice * (1 - l_discount)) AS revenue, o_shippriority FROM customer, orders, lineitem WHERE l_orderkey = o_orderkey AND l_shipdate > DATE 1 AND c_mktsegment = 1 AND o_orderdate < DATE 1 AND c_custkey = o_custkey GROUP BY l_orderkey, o_orderdate, o_shippriority ORDER BY reven...
tpch
Select Count(1) From comments As c, postHistory As ph, votes As v, users As u Where u.UpVotes <= 123 AND ph.UserId = c.UserId AND u.Id = v.UserId AND u.Views >= 0 AND v.UserId = ph.UserId AND u.DownVotes >= 0
stats
SELECT o_orderpriority, COUNT(*) AS order_count FROM orders WHERE EXISTS ( SELECT * FROM lineitem WHERE l_orderkey = o_orderkey AND l_commitdate < l_receiptdate ) AND o_orderdate >= DATE 1 AND o_orderdate < DATE 1 + INTERVAL '3' MONTH GROUP BY o_orderpriority ORDER BY o_orderpriority LIMIT 200;
tpch
WITH _q AS ( select s_suppkey, s_name, s_address, s_phone, total_revenue 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 p_brand, p_size, COUNT(DISTINCT ps_suppkey) AS supplier_cnt, p_type 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_size = ANY(ARRAY[1, 1, 1, 1, 1, 1, 1, 1]) AND p_partkey = ps_partkey AND p_brand <> 1 GROUP B...
tpch
SELECT n_name, c_custkey, c_phone, SUM(l_extendedprice * (1 - l_discount)) AS revenue, c_address, c_comment, 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(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 mi_idx.info > '7.0' And t.production_year BETWEEN 2000 AND 2010 And t.id = mi_idx.movie_id And it.info ='rating' And it.id = mi_idx.info_type_id
job
SELECT COUNT(*) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v, users AS u WHERE u.Id = p.OwnerUserId AND p.PostTypeId = 1 AND p.Id = v.PostId AND p.Id = ph.PostId AND p.AnswerCount >= 0 AND p.Id = c.PostId AND p.Id = pl.PostId
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 l_orderkey = o_orderk...
tpch
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 lt.id = ml.link_type_id AND t.id = ci.movie_id AND n.id = an.person_id AND an.person_id = ci.p...
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 mc.note LIKE '%(Japan)%' AND ci.movie_id = mc.movie_id AND n1.id = ci.person_id AND ci.movie_id = t.id AND n1.n...
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_supp...
tpch
SELECT n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, supplier, nation, region WHERE o_orderdate < DATE 1 + INTERVAL '1' YEAR AND l_orderkey = o_orderkey AND o_orderdate >= DATE 1 AND s_nationkey = n_nationkey AND c_nationkey = s_nationkey AND n_regionkey = r_regionkey AND c...
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 mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND mc.movie_i...
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 t.id = mk.movie_id and mk.keyword_id = k.id and mc.movie_id = mk.movie_id and mc.movie_id = t.id and k.keyword ='character-name-in-title' and cn.id = mc.company_id and cn.country_code =...
job
SELECT o_year, SUM( CASE WHEN nation = 1 THEN volume ELSE 0 END ) / SUM(volume) AS mkt_share FROM ( SELECT EXTRACT(YEAR FROM o_orderdate) AS o_year, l_extendedprice * (1 - l_discount) AS volume, n2.n_name AS nation FROM part, supplier, lineitem, orders, customer, nation n1, nation n2, region WHERE c_nationkey = n1.n_na...
tpch
SELECT 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_shipdate ...
tpch
SELECT l_linestatus, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, AVG(l_discount) AS avg_disc, SUM(l_quantity) AS sum_qty, COUNT(*) AS count_order, l_returnflag, AVG(l_quantity) AS avg_qty, AVG(l_extendedprice) AS avg_price, SUM(l_extend...
tpch
select l_orderkey, sum(l_extendedprice * (1 - l_discount)) as revenue, o_orderdate, o_shippriority from customer, orders, lineitem where c_custkey = o_custkey AND c_mktsegment = 1 AND l_shipdate > DATE 1 AND l_orderkey = o_orderkey AND o_orderdate < DATE 1 group by l_orderkey, o_orderdate, o_shippriority order by reven...
tpch
Select i_item_id, i_item_desc, i_current_price From item Join inventory On i_item_sk = inv_item_sk Join date_dim On d_date_sk = inv_date_sk Join catalog_sales On cs_item_sk = i_item_sk Where d_date BETWEEN CAST('2000-05-01' As DATE) AND (CAST('2000-05-01' As DATE) + INTERVAL '60 days') AND i_manufact_id In (195, 412, 3...
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 miidx.movie_id = t.id AND kt.id = t.kind_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 pi.person_id = an.person_id AND it.info = 'mini biography' AND n.id = pi.person_id AND n.name_pcode_cf BETWEEN 'A' AND...
job
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_shipdate < DATE 1 + INTERVAL '1' YEAR AND l_quantity < 1 LIMIT 500;
tpch
SELECT MIN(t.title) AS movie_title FROM company_name AS cn, keyword AS k, movie_companies AS mc, movie_keyword AS mk, title AS t WHERE mc.movie_id = t.id AND k.keyword ='character-name-IN-title' AND t.id = mk.movie_id AND cn.id = mc.company_id AND cn.country_code ='[de]' AND mk.keyword_id = k.id AND mc.movie_id = mk.mo...
job
SELECT total_revenue, s_suppkey, s_name, s_address, s_phone FROM supplier, revenue0 WHERE s_suppkey = supplier_no AND total_revenue = ( SELECT MAX(total_revenue) FROM revenue0 ) ORDER BY s_suppkey LIMIT 50;
tpch
select avg(ss_quantity), avg(ss_ext_sales_price), avg(ss_ext_wholesale_cost), sum(ss_ext_wholesale_cost) from store_sales join store on s_store_sk = ss_store_sk join customer_demographics on cd_demo_sk = ss_cdemo_sk join household_demographics on hd_demo_sk = ss_hdemo_sk join customer_address on ca_address_sk = ss_addr...
tpcds
SELECT i_item_desc, SUM(cs_quantity) AS catalog_sales_quantity, s_store_name, SUM(sr_return_quantity) AS store_returns_quantity, SUM(ss_quantity) AS store_sales_quantity, s_store_id, 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(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 ci.movie_id = mc.movie_id AND rt.id = ci.role_id AND cn.country_code = '[r...
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 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_shipmode ...
tpch
SELECT MIN(cn.name) AS from_company, MIN(lt.link) AS link_type, MIN(t.title) AS western_sequel FROM company_name AS cn, company_type AS ct, info_type AS it, keyword AS k, link_type AS lt, movie_companies AS mc, movie_info AS mi, movie_keyword AS mk, movie_link AS ml, title AS t WHERE cn.country_code = '[us]' AND k.keyw...
job
WITH _q AS ( 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 77 AND 77 + 10 OR ss_coupon_amt BETWEEN 1614 AND 1614 + 1000 OR ss_wholesale_cost BETWEEN 88 AND 88 + 20) ) AS b3 AND (ss_list_price BET...
tpcds
SELECT MIN(n.name) AS voicing_actress, MIN(t.title) AS voiced_movie FROM aka_name AS an, char_name AS chn, cast_info AS ci, company_name AS cn, info_type AS it, movie_companies AS mc, movie_info AS mi, name AS n, role_type AS rt, title AS t WHERE it.info = 'release dates' AND ci.role_id = rt.id AND t.id = mi.movie_id A...
job
Select i_item_id, Sum(sr_return_quantity) As store_returns_quantity, s_store_name, Sum(ss_quantity) As store_sales_quantity, i_item_desc, Sum(cs_quantity) As catalog_sales_quantity, s_store_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 l_orderkey, SUM(l_extendedprice * (1 - l_discount)) AS revenue, o_orderdate, o_shippriority FROM customer, orders, lineitem WHERE c_custkey = o_custkey AND l_shipdate > DATE 1 AND c_mktsegment = 1 AND o_orderdate < DATE 1 AND l_orderkey = o_orderkey GROUP BY l_orderkey, o_orderdate, o_shippriority ORDER BY reven...
tpch
WITH _q AS ( SELECT MIN(an.name) AS acress_pseudonym, MIN(t.title) AS japanese_anime_movie FROM aka_name AS an, cast_info AS ci, company_name AS cn, company_type AS ct, keyword AS k, movie_companies AS mc, movie_keyword AS mk, name AS n, role_type AS rt, title AS t WHERE ci.note LIKE '%(voice: English version)%' AND n....
job
SELECT l_year, SUM(volume) AS revenue, supp_nation, cust_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 ( (n1.n_name = 1 AND n2.n_name = 1...
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(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 pi.person_id = an.person_id AND lt.link = 'features' AND ml.linked_movie_id = t.id AND pi.person_id = ci.person_id AND...
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 ct.id = mc.company_type_id AND t.id = mi.movie_id AND it.info = 'bottom 10 rank' AND it.id = mi.info_type_id AND...
job
with _q as ( 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 custome...
tpcds
SELECT s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE s_suppkey = l1.l_suppkey 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_o...
tpch
SELECT l_returnflag, SUM(l_extendedprice) AS sum_base_price, l_linestatus, AVG(l_discount) AS avg_disc, AVG(l_extendedprice) AS avg_price, COUNT(1) AS count_order, AVG(l_quantity) AS avg_qty, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, ...
tpch
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 l_orderkey = o_orderkey AND c_nationkey = n_nationkey AND o_orderdate >= DATE 1 AND c_custkey = o_custkey AND o_orderdate < DATE 1 + INTERVAL '3' M...
tpch
Select c_custkey, c_name, Sum(l_extendedprice * (1 - l_discount)) As revenue, c_acctbal, n_name, c_address, c_phone, c_comment From customer, orders, lineitem, nation Where o_orderdate < DATE 1 + INTERVAL '3' MONTH AND c_custkey = o_custkey AND l_returnflag = 'R' AND o_orderdate >= DATE 1 AND l_orderkey = o_orderkey AN...
tpch
SELECT AVG(cs_coupon_amt) AS agg3, i_item_id, AVG(cs_quantity) AS agg1, AVG(cs_list_price) AS agg2, 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 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 mi_idx.info > '7.0' AND t.id = mi_idx.movie_id AND t.production_year BETWEEN 2000 AND 2010 AND it.id = mi_idx.info_type_id AND it.info ='rating'
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 ct.id = mc.company_type_id AND t.id = ci.movie_id AND cn.country_code...
job
SELECT l_orderkey, SUM(l_extendedprice * (1 - l_discount)) AS revenue, o_orderdate, o_shippriority FROM customer, orders, lineitem WHERE l_shipdate > DATE 1 AND l_orderkey = o_orderkey AND o_orderdate < DATE 1 AND c_custkey = o_custkey AND c_mktsegment = 1 GROUP BY l_orderkey, o_orderdate, o_shippriority ORDER BY reven...
tpch
Select s_name, Count(*) As numwait From supplier, lineitem l1, orders, nation Where n_name = 1 AND s_nationkey = n_nationkey AND l1.l_receiptdate > l1.l_commitdate AND Not Exists ( Select * From lineitem l3 Where l3.l_orderkey = l1.l_orderkey And l3.l_suppkey <> l1.l_suppkey And l3.l_receiptdate > l3.l_commitdate ) AND...
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_shipmode = ANY(ARRAY[1, 1]) AND o_orderkey...
tpch
SELECT cnt, c_first_name, ss_ticket_number, c_salutation, c_last_name, c_preferred_cust_flag FROM ( SELECT ss_ticket_number, ss_customer_sk, COUNT(1) 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 n_name, s_phone, s_address, s_name, s_acctbal, s_comment, p_partkey, p_mfgr 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 MIN(mc.note) AS production_note, MIN(t.title) AS movie_title, MIN(t.production_year) AS movie_year FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info_idx AS mi_idx, title AS t WHERE it.info = 'top 250 rank' AND ct.kind = 'production companies' AND t.id = mc.movie_id AND ct.id = mc.compan...
job
SELECT MAX(an.name) AS acress_pseudonym, MAX(t.title) AS japanese_anime_movie FROM aka_name AS an, cast_info AS ci, company_name AS cn, company_type AS ct, keyword AS k, movie_companies AS mc, movie_keyword AS mk, name AS n, role_type AS rt, title AS t WHERE ct.id = mc.company_type_id AND ci.role_id = rt.id AND t.id = ...
job
SELECT n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, supplier, nation, region WHERE c_custkey = o_custkey AND c_nationkey = s_nationkey AND s_nationkey = n_nationkey AND l_suppkey = s_suppkey AND l_orderkey = o_orderkey AND o_orderdate < DATE 1 + INTERVAL '1' YEAR AND r_nam...
tpch
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.note LIKE '%(uncredited)%' AND ci.note LIKE '%(voice)%' AND cn.country_code = '[ru]' AND t.id = c...
job
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 ci.role_id = rt.id AND mc.note like '%(USA)%' AND cn.country_code = '[us]...
job
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 hd_dep_count = 4 AND t_hour = 14 AND t_minute >= 30 AND s_store_name = 'pri' ORDER BY COUNT(*) ASC LIMIT 100;
tpcds
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 k.keyword LIKE '%sequel%' AND t.id = mk.movie_id AND t.id = mi.movie_id AND t.production_year > 2010 AND k.id = mk.keyword_id AND mi.info = ANY(ARRAY['Sweden', 'Norway', 'Germany',...
job
Select Count(1) 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 t_hour = 10 And hd_dep_count = 2 And t_minute >= 35 And s_store_name = 'ation' Order By Count(1) Desc Limit 100;
tpcds
SELECT i_item_id, i_item_desc, s_store_id, s_store_name, SUM(ss_quantity) AS store_sales_quantity, SUM(sr_return_quantity) AS store_returns_quantity, SUM(cs_quantity) AS catalog_sales_quantity FROM store_sales INNER JOIN store_returns ON ss_customer_sk = sr_customer_sk AND ss_item_sk = sr_item_sk AND ss_ticket_number =...
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 = an.person_id AND t.production_year BETWEEN 1980 AND 1995 AND pi.person_id = ci.person_id...
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.movie_id = mi.movie_id AND ct.kind = 'production companies' AND (mc.note LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%') AND ct.id = mc.company_type_id AND it.info = 'bot...
job
select i_item_desc, i_current_price, 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_current_price between 75 and 75 + 30 and d_date between CAST('2000-05-01' as DATE) and (CAST('2000-05-01' as DATE) + INTERVAL '...
tpcds
SELECT extended_tax, bought_city, list_price, c_last_name, ss_ticket_number, c_first_name, ca_city, extended_price FROM ( SELECT ss_ticket_number, ss_customer_sk, ca_city AS bought_city, SUM(ss_ext_sales_price) AS extended_price, SUM(ss_ext_list_price) AS list_price, SUM(ss_ext_tax) AS extended_tax FROM store_sales JOI...
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 mi.movie_id = mc.movie_id AND miidx.movie_id = ...
job
select c_name, c_custkey, c_comment, n_name, c_address, c_acctbal, c_phone, sum(l_extendedprice * (1 - l_discount)) as revenue from customer, orders, lineitem, nation where c_nationkey = n_nationkey AND o_orderdate >= DATE 1 AND l_returnflag = 'R' AND c_custkey = o_custkey AND o_orderdate < DATE 1 + INTERVAL '3' MONTH ...
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.Id = c.PostId AND p.Id = ph.PostId AND p.Id = v.PostId AND b.UserId = u.Id AND c.UserId = u.Id AND p.Score <= 40 AND p.Id = pl.RelatedPostId AND pl.LinkTypeId = 1
stats
Select Count(1) From comments As c, posts As p, postLinks As pl, votes As v Where pl.PostId = v.PostId And p.Score >= -3 And c.CreationDate >= '2010-08-02 23:52:10'::timestamp And p.Id = c.PostId And c.PostId = pl.PostId And v.VoteTypeId = 2
stats
WITH year_total AS ( SELECT c_login AS customer_login, 's' AS sale_type, c_customer_id AS customer_id, d_year AS dyear, c_birth_country AS customer_birth_country, SUM(((ss_ext_list_price - ss_ext_wholesale_cost - ss_ext_discount_amt) + ss_ext_sales_price) / 2) AS year_total, c_preferred_cust_flag AS customer_preferred_...
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_receiptdate >= DATE 1 AND o_orderkey = l_o...
tpch
SELECT MIN(t.title) AS japanese_anime_movie, MIN(an.name) AS acress_pseudonym FROM aka_name AS an, cast_info AS ci, company_name AS cn, company_type AS ct, keyword AS k, movie_companies AS mc, movie_keyword AS mk, name AS n, role_type AS rt, title AS t WHERE t.production_year > 1990 AND rt.role = 'actress' AND ct.id = ...
job
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 l1.l_receiptdate > l1.l_commitdate and o_orderkey = l1.l_orderkey and n_name = 1 an...
tpch
SELECT MIN(an1.name) AS actress_pseudonym, MIN(t.title) AS japanese_movie_dubbed FROM aka_name AS an1, cast_info AS ci, company_name AS cn, movie_companies AS mc, name AS n1, role_type AS rt, title AS t WHERE cn.country_code = '[jp]' AND mc.note NOT LIKE '%(USA)%' AND mc.company_id = cn.id AND an1.person_id = n1.id AND...
job
select count(*) from comments as c, posts as p, votes as v, users as u where u.Id = v.UserId AND u.Id = p.OwnerUserId AND p.ViewCount >= 0 AND p.Score >= 0 AND c.Score = 0 AND u.Id = c.UserId
stats
SELECT MIN(k.keyword) AS movie_keyword, MIN(n.name) AS actor_name, MIN(t.title) AS marvel_movie FROM cast_info AS ci, keyword AS k, movie_keyword AS mk, name AS n, title AS t WHERE ci.movie_id = mk.movie_id AND t.production_year > 2010 AND n.name LIKE '%Downey%Robert%' AND k.id = mk.keyword_id AND t.id = ci.movie_id AN...
job
Select Min(t.title) As movie_title, Min(mi_idx.info) As rating From info_type As it, movie_info_idx As mi_idx, title As t Where mi_idx.info > '7.0' AND it.info ='rating' AND it.id = mi_idx.info_type_id AND t.id = mi_idx.movie_id AND t.production_year BETWEEN 2000 AND 2010
job
Select w_state, i_item_id, Sum(Case When (CAST(d_date As DATE) < CAST('1998-01-01' As DATE)) Then cs_sales_price - COALESCE(cr_refunded_cash, 0) Else 0 End) As sales_before, Sum(Case When (CAST(d_date As DATE) >= CAST('1998-01-01' As DATE)) Then cs_sales_price - COALESCE(cr_refunded_cash, 0) Else 0 End) As sales_after ...
tpcds
SELECT CAST(promotions AS DECIMAL(15, 4)) / CAST(total AS DECIMAL(15, 4)) * 100, promotions, total 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(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 lt.id = ml.link_type_id AND t.id = ...
job
SELECT promotions, CAST(promotions AS DECIMAL(15, 4)) / CAST(total AS DECIMAL(15, 4)) * 100, total 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 o_orderkey, c_name, c_custkey, o_orderdate, SUM(l_quantity), 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 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 = mc.movie_id AND cn.country_code = '[ru]' AND ci.note LIKE '%(voice)%' AND t.id = ci.movie_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 ci.movie_id = t.id And n1.name Not Like '%Yu%' And mc.note Not Like '%(USA)%' And t.id = mc.movie_id And ci.mov...
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 it.info = 'mini biography' AND it.id = pi.info_type_id AND (n.gender = 'm' OR (n.gender = 'f' AND n.name LIKE 'B%')) A...
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 s_suppkey = l_suppkey AND ps_partkey = l_partkey AND ps_suppk...
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.production_year > 1990 AND mc.note NOT LIKE '%(USA)%' AND c...
job
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 t.id = mk.movie_id AND k.keyword = 'marvel-cinematic-universe' AND n.id = ci.person_id AND t.production_year > 2010 AND n.name LIKE '%Hemsw...
job
WITH ss AS ( SELECT i_manufact_id, SUM(ss_ext_sales_price) AS total_sales FROM store_sales JOIN date_dim ON ss_sold_date_sk = d_date_sk JOIN customer_address ON ss_addr_sk = ca_address_sk JOIN item ON ss_item_sk = i_item_sk WHERE d_year = 2000 AND i_category = ANY(ARRAY['Electronics']) AND ca_gmt_offset = -5 AND d_moy ...
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 pi.note = 'Volker Boehm' AND n.name_pcode_cf BETWEEN 'A' AND 'F' AND (n.gender = 'm' OR (n.gender = 'f' AND n.name LIK...
job