text
stringlengths
84
1.49k
benchmark
stringclasses
4 values
SELECT i_manufact_id, SUM(ss_ext_sales_price) AS ext_price, i_brand_id AS brand_id, i_manufact, i_brand AS brand 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 mi.movie_id = miidx.movie_id AND cn.id = mc.com...
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 cn.id = mc.company_id AND ci.movie_id = mc.movie_id AND mi.movie_id = mc....
job
select sum(l_extendedprice * l_discount) as revenue from lineitem where l_shipdate >= DATE 1 and l_shipdate < DATE 1 + INTERVAL '1' YEAR and l_discount between 1 - 0.01 and 1 + 0.01 and l_quantity < 1 LIMIT 100;
tpch
select count(*) from votes as v, posts as p, badges as b, users as u where p.Score <= 22 AND u.Id = b.UserId AND u.Reputation >= 1 AND p.Id = v.PostId AND u.Id = p.OwnerUserId
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 COUNT(*) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v, badges AS b, users AS u WHERE b.UserId = u.Id AND p.Id = pl.RelatedPostId AND p.Id = ph.PostId AND p.Id = c.PostId AND c.UserId = u.Id AND p.Id = v.PostId AND pl.LinkTypeId = 1 AND p.Score <= 40
stats
Select l_orderkey, Sum(l_extendedprice * (1 - l_discount)) As revenue, o_orderdate, o_shippriority From customer, orders, lineitem Where l_orderkey = o_orderkey And o_orderdate < DATE 1 And l_shipdate > DATE 1 And c_custkey = o_custkey And c_mktsegment = 1 Group By l_orderkey, o_orderdate, o_shippriority Order By reven...
tpch
SELECT MIN(k.keyword) AS movie_keyword, MIN(n.name) AS actor_name, MIN(t.title) AS marvel_movie FROM cast_info AS ci, keyword AS k, movie_keyword AS mk, name AS n, title AS t WHERE t.id = mk.movie_id AND n.id = ci.person_id AND ci.movie_id = mk.movie_id AND k.id = mk.keyword_id AND t.id = ci.movie_id AND n.name LIKE '%...
job
SELECT MIN(t.title) AS movie_title FROM company_name AS cn, keyword AS k, movie_companies AS mc, movie_keyword AS mk, title AS t WHERE cn.id = mc.company_id AND mk.keyword_id = k.id AND cn.country_code ='[de]' AND t.id = mk.movie_id AND mc.movie_id = mk.movie_id AND mc.movie_id = t.id AND k.keyword ='character-name-in-...
job
select l_returnflag, 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, avg(l_quantity) as avg_qty, avg(l_extendedprice) as avg_price, l_linestatus, count(*) as count_order, sum(l_quantity) as sum_qty, sum(l_extendedprice * (1 - l_di...
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 mi.note LIKE '%internet%' AND t.id ...
job
Select Count(1) From comments As c, posts As p, votes As v, users As u Where u.Id = p.OwnerUserId And u.Id = v.UserId And p.ViewCount >= 0 And p.Score >= 0 And c.Score = 0 And u.Id = c.UserId
stats
SELECT c_comment, SUM(l_extendedprice * (1 - l_discount)) AS revenue, c_address, c_name, c_phone, n_name, c_acctbal, c_custkey FROM customer, orders, lineitem, nation WHERE c_custkey = o_custkey AND o_orderdate >= DATE 1 AND l_returnflag = 'R' AND c_nationkey = n_nationkey AND l_orderkey = o_orderkey AND o_orderdate < ...
tpch
select sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) as sum_charge, avg(l_quantity) as avg_qty, l_linestatus, sum(l_quantity) as sum_qty, sum(l_extendedprice * (1 - l_discount)) as sum_disc_price, l_returnflag, sum(l_extendedprice) as sum_base_price, count(*) as count_order, avg(l_discount) as avg_disc, avg(l_e...
tpch
Select Count(*) From comments As c, postHistory As ph, votes As v, users As u Where u.Id = v.UserId AND ph.UserId = c.UserId AND u.UpVotes <= 123 AND u.Views >= 0 AND v.UserId = ph.UserId AND u.DownVotes >= 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 s...
tpch
SELECT SUM(l_quantity) AS sum_qty, COUNT(*) 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, SUM(l_extendedprice) AS sum_base_price, l_linestatus, l_returnflag, AVG(l_extendedprice) AS avg_price, A...
tpch
SELECT MIN(t.title) AS russian_movie, MIN(chn.name) AS uncredited_voiced_character FROM char_name AS chn, cast_info AS ci, company_name AS cn, company_type AS ct, movie_companies AS mc, role_type AS rt, title AS t WHERE cn.country_code = '[ru]' AND rt.id = ci.role_id AND ct.id = mc.company_type_id AND t.id = mc.movie_i...
job
Select Count(*) From comments As c, postHistory As ph, badges As b, votes As v, users As u Where b.UserId = ph.UserId And u.UpVotes = 0 And v.UserId = c.UserId And ph.PostHistoryTypeId = 12 And u.Id = b.UserId And ph.UserId = v.UserId
stats
SELECT COUNT(*) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v, badges AS b WHERE p.Id = c.PostId AND p.Id = ph.PostId AND pl.LinkTypeId = 1 AND p.Id = v.PostId AND b.UserId = c.UserId AND c.Score = 0 AND p.Id = pl.RelatedPostId
stats
select sum(l_quantity), o_totalprice, o_orderkey, c_custkey, o_orderdate, 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 c_first_name, extended_tax, list_price, ss_ticket_number, bought_city, c_last_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 INN...
tpcds
SELECT p_brand, p_type, p_size, COUNT(DISTINCT ps_suppkey) AS supplier_cnt FROM partsupp, part WHERE p_type NOT LIKE 1 AND p_brand != 1 AND p_partkey = ps_partkey AND p_size IN (1, 1, 1, 1, 1, 1, 1, 1) AND ps_suppkey NOT IN ( SELECT s_suppkey FROM supplier WHERE s_comment LIKE '%Customer%Complaints%' ) GROUP BY p_brand...
tpch
select min(t.title) as movie_title from keyword as k, movie_info as mi, movie_keyword as mk, title as t where mk.movie_id = mi.movie_id and t.production_year > 2010 and mi.info in ('Sweden', 'Norway', 'Germany', 'Danish', 'Swedish', 'Danish', 'Norwegian', 'German') and t.id = mi.movie_id and k.id = mk.keyword_id and k....
job
WITH _q AS ( 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_suppkey = l_suppkey...
tpch
SELECT SUM(amount) AS sum_profit, o_year, nation 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 s...
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 store_sales On ss_item_sk = i_item_sk Where i_manufact_id In (116, 70, 371, 438) And d_date Between CAST('1998-01-15' As DATE) And (CAST('1998-01-15' As DATE) + INTERVAL '60 d...
tpcds
SELECT MIN(t.title) AS movie_title FROM company_name AS cn, keyword AS k, movie_companies AS mc, movie_keyword AS mk, title AS t WHERE cn.id = mc.company_id AND t.id = mk.movie_id AND cn.country_code ='[de]' 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-...
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 an.name LIKE '%a%' AND ci.movie_id = ml.linked_movie_id AND ml.linked_movie_id = t.id AND t.production_year BETWEEN 19...
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 = ci.person_id AND it.info = 'mini biography' AND n.name_pcode_cf BETWEEN 'A' AND 'F' AND it.id = pi.info...
job
SELECT MIN(miidx.info) AS rating, MIN(t.title) AS german_movie, MIN(mi.info) AS release_date 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.country_code = '[de]' AND kt.kind = 'movie' ...
job
SELECT l_shipmode, SUM( CASE WHEN o_orderpriority = '1-URGENT' OR o_orderpriority = '2-HIGH' THEN 1 ELSE 0 END ) AS high_line_count, SUM( CASE WHEN o_orderpriority <> '1-URGENT' AND o_orderpriority <> '2-HIGH' THEN 1 ELSE 0 END ) AS low_line_count FROM orders, lineitem WHERE l_shipdate < l_commitdate AND l_receiptdate ...
tpch
SELECT c_first_name, ss_ticket_number, c_salutation, c_last_name, cnt, 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
WITH _q AS ( SELECT COUNT(1) FROM posts AS p, tags AS t WHERE p.Id = t.ExcerptPostId AND p.CommentCount >= 0 ) SELECT * FROM _q
stats
Select Count(1) From comments As c, postHistory As ph, badges As b, votes As v, users As u Where ph.PostHistoryTypeId = 12 AND u.UpVotes = 0 AND b.UserId = ph.UserId AND ph.UserId = v.UserId AND v.UserId = c.UserId AND u.Id = b.UserId
stats
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_nationkey = n_nationkey AND ps_suppkey = l_suppkey AND o_or...
tpch
select count(*) from badges as b, posts as p where p.AnswerCount <= 4 AND b.Date <= '2014-09-11 08:55:52'::timestamp AND b.UserId = p.OwnerUserId AND p.AnswerCount >= 0 LIMIT 50;
stats
WITH _q AS ( 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 > 2000 AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Danish', 'Norwegian', 'German') AND k.keyword LIK...
job
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 o_orderdate < DATE 1 AND c_mktsegment = 1 AND l_orderkey = o_orderkey AND l_shipdate > DATE 1 GROUP BY l_orderkey, o_orderdate, o_shippriority ORDER BY reven...
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 = mk.movie_id and k.keyword like '%sequel%' and k.id = mk.keyword_id and mi.info in ('Sweden', 'Norway', 'Germany', 'Danish', 'Swedish', 'Danish', 'Norwegian', 'German') and t.id = mi.movie_id and t.produc...
job
SELECT s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE s_nationkey = n_nationkey AND EXISTS ( SELECT * FROM lineitem l2 WHERE l2.l_orderkey = l1.l_orderkey AND l2.l_suppkey <> l1.l_suppkey ) AND n_name = 1 AND o_orderkey = l1.l_orderkey AND NOT EXISTS ( SELECT * FROM lineitem l3 WHERE l3.l_...
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.country_code ='[nl]' AND mk.keyword_id = k.id AND mc.movie_id = t.id AND k.keyword ='character-name-IN-title' AND t.id = mk.movie_id AND mc.movie_id = mk.movie_id AND cn.id = mc.comp...
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_receiptdate >= DA...
tpch
SELECT n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, supplier, nation, region WHERE c_nationkey = s_nationkey AND n_regionkey = r_regionkey AND o_orderdate >= DATE 1 AND r_name = 1 AND c_custkey = o_custkey AND l_orderkey = o_orderkey AND o_orderdate < DATE 1 + INTERVAL '1'...
tpch
Select p_brand, p_type, p_size, Count(Distinct ps_suppkey) As supplier_cnt From partsupp, part Where ps_suppkey Not In ( Select s_suppkey From supplier Where s_comment Like '%Customer%Complaints%' ) And p_type Not Like 1 And p_partkey = ps_partkey And p_brand <> 1 And p_size In (1, 1, 1, 1, 1, 1, 1, 1) Group By p_brand...
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 = ci.movie_id AND rt.id = ci.role_id AND cn.id = mc.company_id AND ct.id = mc.company_type_id A...
job
SELECT SUM(l_extendedprice * (1 - l_discount)) AS revenue, n_name FROM customer, orders, lineitem, supplier, nation, region WHERE o_orderdate >= DATE 1 AND l_suppkey = s_suppkey AND s_nationkey = n_nationkey AND r_name = 1 AND l_orderkey = o_orderkey AND c_nationkey = s_nationkey AND o_orderdate < DATE 1 + INTERVAL '1'...
tpch
SELECT promotions, total, CAST(promotions AS DECIMAL(15, 4)) / CAST(total AS DECIMAL(15, 4)) * 100 FROM ( SELECT SUM(ss_ext_sales_price) AS promotions FROM store_sales JOIN store ON ss_store_sk = s_store_sk JOIN promotion ON ss_promo_sk = p_promo_sk JOIN date_dim ON ss_sold_date_sk = d_date_sk JOIN customer ON ss_custo...
tpcds
SELECT s_store_id, MAX(sr_net_loss) AS store_returns_loss, MAX(ss_net_profit) AS store_sales_profit, s_store_name, i_item_desc, MAX(cs_net_profit) AS catalog_sales_profit, i_item_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 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 mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND ct.id = mc.company...
job
SELECT ss_ticket_number, ca_city, extended_tax, bought_city, c_first_name, list_price, c_last_name, 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 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 c_custkey, c_name, Sum(l_extendedprice * (1 - l_discount)) As revenue, c_acctbal, n_name, c_address, c_phone, c_comment From customer, orders, lineitem, nation Where o_orderdate >= DATE 1 AND l_returnflag = 'R' AND l_orderkey = o_orderkey AND o_orderdate < DATE 1 + INTERVAL '3' MONTH AND c_nationkey = n_nationke...
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 c_nationkey = n_nationkey and l_returnflag = 'R' and o_orderdate < DATE 1 + INTERVAL '3' MONTH and c_custkey = o_custkey and l_orderkey = o_orderke...
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 an.person_id = ci.person_id And t.id = mc.movie_id And t.id = mk.movie_id And n.id = ci.per...
job
Select Sum(volume) As revenue, l_year, 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 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 n.name LIKE '%Hemsworth%Chris%' AND n.id = ci.person_id AND ci.movie_id = mk.movie_id AND k.keyword = 'marvel-cinematic-universe' AND t.id ...
job
select count(1) from comments as c, votes as v, badges as b, users as u where u.Id = b.UserId and c.Score = 1 and u.CreationDate >= '2010-07-20 01:27:29'::timestamp and u.Id = c.UserId and u.Id = v.UserId
stats
SELECT promotions, total, CAST(promotions AS DECIMAL(15, 4)) / CAST(total AS DECIMAL(15, 4)) * 100 FROM ( SELECT SUM(ss_ext_sales_price) AS promotions FROM store_sales JOIN store ON ss_store_sk = s_store_sk JOIN promotion ON ss_promo_sk = p_promo_sk JOIN date_dim ON ss_sold_date_sk = d_date_sk JOIN customer ON ss_custo...
tpcds
SELECT MIN(t.title) AS movie_title FROM keyword AS k, movie_info AS mi, movie_keyword AS mk, title AS t WHERE k.id = mk.keyword_id AND t.id = mk.movie_id AND mk.movie_id = mi.movie_id AND t.production_year > 2000 AND t.id = mi.movie_id AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Danish', 'Norw...
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 an.person_id = ci.person_id AND t.episode_nr >= 50 AND mc.company_id = cn.id AND mc.movie_i...
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(*) FROM comments AS c, postHistory AS ph, badges AS b, votes AS v, users AS u WHERE ph.PostHistoryTypeId = 12 AND u.Id = b.UserId AND u.UpVotes = 0 AND v.UserId = c.UserId AND b.UserId = ph.UserId AND ph.UserId = v.UserId LIMIT 200;
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 LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%') AND mc.movie_id = mi_idx.movie_id AND t....
job
SELECT l_orderkey, SUM(l_extendedprice * (1 - l_discount)) AS revenue, o_orderdate, o_shippriority FROM customer, orders, lineitem WHERE c_mktsegment = 1 AND o_orderdate < DATE 1 AND l_shipdate > DATE 1 AND l_orderkey = o_orderkey AND c_custkey = o_custkey GROUP BY l_orderkey, o_orderdate, o_shippriority ORDER BY reven...
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 mk.keyword_id = k.id AND mc.movie_id = t.id AND mc.movie_id = mk.movie_id AND t.id = mk.movie_id AND k.keyword ='character-name-in-title' AND cn.country_code =...
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 cn.country_code = '[us]' AND it.info = 'release dates' AND n.gender = 'f'...
job
SELECT COUNT(DISTINCT ps_suppkey) AS supplier_cnt, p_size, p_brand, p_type FROM partsupp, part WHERE p_partkey = ps_partkey AND p_size IN (1, 1, 1, 1, 1, 1, 1, 1) AND ps_suppkey NOT IN ( SELECT s_suppkey FROM supplier WHERE s_comment LIKE '%Customer%Complaints%' ) AND p_type NOT LIKE 1 AND p_brand <> 1 GROUP BY p_brand...
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 c.UserId = u.Id AND p.Id = ph.PostId AND p.Score <= 40 AND p.Id = v.PostId AND pl.LinkTypeId = 1 AND b.UserId = u.Id AND p.Id = pl.RelatedPostId
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 ct.kind = 'production companies' AND it.info = 'top 250 rank' AND mc.note NOT LIKE '%(as Metro-Goldwyn-May...
job
SELECT MIN(t.title) AS american_movie FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info AS mi, title AS t WHERE it.id = mi.info_type_id AND mc.movie_id = mi.movie_id AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND it.info = 'bottom 10 rank' AND t.id = mi.movie_id AND ct.id = mc....
job
select min(t.title) as movie_title from company_name as cn, keyword as k, movie_companies as mc, movie_keyword as mk, title as t where cn.country_code ='[nl]' AND cn.id = mc.company_id AND mk.keyword_id = k.id AND mc.movie_id = mk.movie_id AND t.id = mk.movie_id AND mc.movie_id = t.id AND k.keyword ='character-name-in-...
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 = ci.movie_id AND t.production_year > 2010 AND k.id = mk.keyword_id AND n.name LIKE '%Hemsworth%Chris%' AND t.id = mk.movie_id AND n.i...
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 ( (n1.n_name = 1 AND n2.n_name = 1...
tpch
WITH _q AS ( SELECT COUNT(*) FROM comments AS c, postHistory AS ph, votes AS v, users AS u WHERE u.UpVotes <= 123 ) SELECT * FROM _q AND u.DownVotes >= 0 AND u.Id = v.UserId AND v.UserId = ph.UserId AND ph.UserId = c.UserId AND u.Views >= 0
stats
Select Sum(ss_ext_sales_price) As ext_price, i_brand As brand, i_brand_id As brand_id From date_dim JOIN store_sales On d_date_sk = ss_sold_date_sk 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 Desc, brand_id Limit 100;
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 l_shipdate < l_c...
tpch
SELECT n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, supplier, nation, region WHERE n_regionkey = r_regionkey AND c_custkey = o_custkey AND o_orderdate < DATE 1 + INTERVAL '1' YEAR AND l_orderkey = o_orderkey AND c_nationkey = s_nationkey AND l_suppkey = s_suppkey AND s_nat...
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 ct.id = mc.company_type_id AND (mc.note LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%') AND t.id = mc.movie_id AND mc.movie_id = mi.movie_id AND ct.kind = 'production compan...
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 = mc.movie_id AND rt.role = 'actor' AND ci.note LIKE '%(uncredited)%' AND cn.id = mc.company_id...
job
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 an.person_id = n.id AND n.id = ci.person_id AND ci.movie_id = mc.movie_id...
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 = ci.movie_id AND k.keyword = 'marvel-cinematic-universe' AND ci.movie_id = mk.movie_id AND n.name LIKE '%Downey%Robert%' AND n.id = c...
job
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 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 it2.info =...
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 t.id = ci.movie_id AND ci.person_id = an.person_id AND t.prod...
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 = mi.movie_id AND t.id = mk.movie_id AND t.production_year > 2010 AND mk.movie_id = mi.movie_id AND k.keyword LIKE '%sequel%' AND k.id = mk.keyword_id AND mi.info = ANY(ARRAY['Sweden', 'Norway', 'Germany',...
job
select w_state, i_item_id, sum(case when (CAST(d_date as DATE) < CAST('2000-03-11' 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('2000-03-11' as DATE)) then cs_sales_price - COALESCE(cr_refunded_cash, 0) else 0 end) as sales_after ...
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 = ci.movie_id AND ci.note LIKE '%(voice: English version...
job
SELECT l_orderkey, SUM(l_extendedprice * (1 - l_discount)) AS revenue, o_orderdate, o_shippriority FROM customer, orders, lineitem WHERE l_orderkey = o_orderkey AND c_mktsegment = 1 AND l_shipdate > DATE 1 AND c_custkey = o_custkey AND o_orderdate < DATE 1 GROUP BY l_orderkey, o_orderdate, o_shippriority ORDER BY reven...
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 t.id = mc.movie_id AND mc.movie_id = mi_idx.movie_id AND t.id = mi_idx.movie_...
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 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 NOT LIKE '%(AS Metro-Goldwyn-Mayer ...
job
SELECT COUNT(*) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v, badges AS b WHERE p.Id = c.PostId AND c.Score = 0 AND p.Id = v.PostId AND p.Id = ph.PostId AND pl.LinkTypeId = 1 AND p.Id = pl.RelatedPostId AND b.UserId = 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 n.id = ci.person_id AND k.id = mk.keyword_id AND ci.movie_id = mk.movie_id AND k.keyword = 'marvel-cinematic-universe' AND t.id = mk.movie_...
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 = mc.movie_id And it.info = 'bottom 10 rank' And (mc.note Like '%(co-production)%' Or mc.note Like '%(presents)%') And ct.kind = 'production companies' And mc.note Not Like '%(A...
job
Select i_item_id, i_item_desc, s_store_id, s_store_name, Sum(ss_quantity) As store_sales_quantity, Sum(sr_return_quantity) As store_returns_quantity, Sum(cs_quantity) As catalog_sales_quantity From store_sales 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(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 nation, o_year, sum(amount) as sum_profit from ( select n_name as nation, EXTRACT(YEAR from o_orderdate) as o_year, l_extendedprice * (1 - l_discount) - ps_supplycost * l_quantity as amount from part, supplier, lineitem, partsupp, orders, nation where ps_partkey = l_partkey and p_partkey = l_partkey and s_nation...
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_partkey = l_partkey AND s_nationkey = n_nationkey AND s_sup...
tpch