text
stringlengths
84
1.49k
benchmark
stringclasses
4 values
SELECT c_phone, c_comment, n_name, c_address, SUM(l_extendedprice * (1 - l_discount)) AS revenue, c_name, c_custkey, c_acctbal 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 s_address, s_name, total_revenue, s_phone, s_suppkey From supplier, revenue0 Where s_suppkey = supplier_no And total_revenue = ( Select Max(total_revenue) From revenue0 ) Order By s_suppkey
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 s_nationkey = n_nationkey and ps_partkey = l_partkey and o_or...
tpch
SELECT supp_nation, cust_nation, l_year, SUM(volume) AS revenue FROM ( SELECT n1.n_name AS supp_nation, n2.n_name AS cust_nation, EXTRACT(YEAR FROM l_shipdate) AS l_year, l_extendedprice * (1 - l_discount) AS volume FROM supplier, lineitem, orders, customer, nation n1, nation n2 WHERE l_shipdate BETWEEN DATE '1995-01-0...
tpch
SELECT 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_custkey = o_custkey AND l_returnflag = 'R' AND o_orderdate >= DATE 1 AND c_nationkey = n_nationkey AND o_orderdate < ...
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 o_shippriority, l_orderkey, sum(l_extendedprice * (1 - l_discount)) as revenue, o_orderdate 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 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(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.id = mk.keyword_id AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Denish', 'Norwegian', 'German') AND t.id = mi.movie_id AND mk.movie_id = mi.movie_id AND t.produ...
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 mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND it.info = 'top ...
job
SELECT l_shipmode, SUM( CASE WHEN o_orderpriority = '1-URGENT' OR o_orderpriority = '2-HIGH' THEN 1 ELSE 0 END ) AS high_line_count, SUM( CASE WHEN o_orderpriority <> '1-URGENT' AND o_orderpriority <> '2-HIGH' THEN 1 ELSE 0 END ) AS low_line_count FROM orders, lineitem WHERE l_receiptdate >= DATE 1 AND l_commitdate < l...
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.name LIKE '%a%' AND an.person_id = ci.person_id AND ci.person_id = n.id AND n.name_pcode_cf BETWEEN 'A' AND 'F' AND...
job
select s_name, s_address from supplier, nation where s_suppkey in ( select ps_suppkey from partsupp where ps_partkey in ( select p_partkey from part where p_name like 1 ) and ps_availqty > ( select 0.5 * sum(l_quantity) from lineitem where l_partkey = ps_partkey and l_suppkey = ps_suppkey and l_shipdate >= DATE 1 and l...
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 mc.movie_id = mi_idx.movie_id AND it.id = mi_idx.info_type_id AND ct.id = mc.company_type_id AND mc.note N...
job
WITH year_total AS ( SELECT d_year AS dyear, 's' AS sale_type, SUM(((ss_ext_list_price - ss_ext_wholesale_cost - ss_ext_discount_amt) + ss_ext_sales_price) / 2) AS year_total, c_login AS customer_login, c_last_name AS customer_last_name, c_preferred_cust_flag AS customer_preferred_cust_flag, c_first_name AS customer_fi...
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 mi.movie_id = ci.movie_id AND an.person_id = n.id AND ci.person_id = an.p...
job
select count(*) from comments as c, posts as p, postHistory as ph, votes as v, users as u where c.UserId = p.OwnerUserId and p.OwnerUserId = ph.UserId and p.Score <= 13 and p.AnswerCount >= 0 and u.Id = c.UserId and ph.UserId = v.UserId
stats
Select COUNT(1) From postHistory As ph, posts As p, users As u, badges As b Where p.Score >= -7 AND u.Reputation >= 1 AND ph.PostHistoryTypeId = 3 AND ph.UserId = u.Id AND p.OwnerUserId = u.Id AND u.Id = b.UserId
stats
SELECT COUNT(1) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v, badges AS b, users AS u WHERE c.UserId = u.Id AND b.UserId = u.Id AND p.Id = v.PostId AND p.Id = c.PostId AND p.Id = ph.PostId AND pl.LinkTypeId = 1 AND p.Score <= 40 AND p.Id = pl.RelatedPostId
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 it.id = mi_idx.info_type_id AND it.info = 'top 250 rank' AND ct.id = mc.company_type_id AND (mc.note LIKE ...
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 t.id = mc.movie_id AND mi.movie_id = ci.movie_id AND t.production_year > ...
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 t.id = mc.movie_id AND rt.role = 'actor' AND ct.id = mc.company_type_id AND c...
job
SELECT MIN(t.title) AS movie_title FROM keyword AS k, movie_info AS mi, movie_keyword AS mk, title AS t WHERE mk.movie_id = mi.movie_id AND k.id = mk.keyword_id AND t.id = mi.movie_id AND t.id = mk.movie_id AND t.production_year > 2005 AND k.keyword LIKE '%sequel%' AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Denmar...
job
Select c_custkey, o_totalprice, o_orderdate, c_name, Sum(l_quantity), o_orderkey From customer, orders, lineitem Where o_orderkey In ( Select l_orderkey From lineitem Group By l_orderkey Having Sum(l_quantity) > 1 ) And c_custkey = o_custkey And o_orderkey = l_orderkey Group By c_name, c_custkey, o_orderkey, o_orderdat...
tpch
SELECT 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, l_shipmode FROM orders, lineitem WHERE l_receiptdate < DATE 1 + INTERVAL '1' YEAR A...
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 mc.movie_id = mi_idx.movie_id AND t.id = mi_idx.movie_id AND (mc.note LIKE '%...
job
SELECT c_last_name, c_first_name, c_salutation, cnt, 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 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 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 l_shipda...
tpch
SELECT MIN(k.keyword) AS movie_keyword, MIN(t.title) AS marvel_movie, 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 k.id = mk.keyword_id AND t.id = ci.movie_id AND t.production_year > 2010 AND k.keyword = 'marvel-cinematic-universe' AND n.id = ci.person_i...
job
SELECT n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, supplier, nation, region WHERE l_orderkey = o_orderkey AND c_custkey = o_custkey AND l_suppkey = s_suppkey AND o_orderdate >= DATE 1 AND o_orderdate < DATE 1 + INTERVAL '1' YEAR AND r_name = 1 AND n_regionkey = r_regionke...
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 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 k.keyword ='character-name-in-...
job
WITH _q AS ( SELECT COUNT(*) FROM comments AS c, postHistory AS ph, votes AS v, users AS u WHERE u.DownVotes >= 0 AND u.Views >= 0 AND ph.UserId = c.UserId AND u.UpVotes <= 123 AND u.Id = v.UserId AND v.UserId = ph.UserId ) SELECT * FROM _q;
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 > 2010 And t.id = mi.movie_id And mi.info In ('Sweden', 'Norway', 'Germany', 'Danish', 'Swedish', 'Danish', 'Norwegian', 'German') And k.keyword Like '%sequel%' And k.id = mk.keyword_id And t....
job
SELECT MIN(t.title) AS movie_title FROM keyword AS k, movie_info AS mi, movie_keyword AS mk, title AS t WHERE mk.movie_id = mi.movie_id AND t.id = mi.movie_id AND k.keyword LIKE '%sequel%' AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Danish', 'Swedish', 'Danish', 'Norwegian', 'German') AND t.production_year > 2010 A...
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 an.person_id = n.id AND ci.movie_id = mc.movie_id AND t.id = mc.mo...
job
SELECT ss_ticket_number, c_first_name, cnt, c_last_name, c_salutation, c_preferred_cust_flag FROM ( SELECT ss_ticket_number, ss_customer_sk, COUNT(*) AS cnt FROM store_sales JOIN date_dim ON ss_sold_date_sk = d_date_sk JOIN store ON ss_store_sk = s_store_sk JOIN household_demographics ON ss_hdemo_sk = hd_demo_sk WHERE ...
tpcds
SELECT MIN(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 t.id = mc.movie_id AND lt.link LIKE...
job
SELECT n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, supplier, nation, region WHERE r_name = 1 AND o_orderdate >= DATE 1 AND o_orderdate < DATE 1 + INTERVAL '1' YEAR AND l_orderkey = o_orderkey AND l_suppkey = s_suppkey AND c_nationkey = s_nationkey AND s_nationkey = n_nati...
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 mk.keyword_id = k.id AND k.keyword = 'character-name-In-title' AND an.person_id = n.id AND ...
job
SELECT c_name, c_phone, c_comment, SUM(l_extendedprice * (1 - l_discount)) AS revenue, c_acctbal, n_name, c_address, c_custkey FROM customer, orders, lineitem, nation WHERE c_custkey = o_custkey AND l_orderkey = o_orderkey AND o_orderdate >= DATE 1 AND o_orderdate < DATE 1 + INTERVAL '3' MONTH AND l_returnflag = 'R' AN...
tpch
SELECT SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM lineitem, part WHERE ( p_partkey = l_partkey AND p_brand = 1 AND p_container = ANY(ARRAY['SM CASE', 'SM BOX', 'SM PACK', 'SM PKG']) AND l_quantity BETWEEN 1 AND 1 + 10 AND p_size BETWEEN 1 AND 5 AND l_shipmode IN ('AIR', 'AIR REG') AND l_shipinstruct = 'DEL...
tpch
Select Count(*) From comments As c, posts As p, votes As v Where c.PostId = p.Id And c.Score = 0 And p.Id = v.PostId And v.VoteTypeId = 2 Limit 500;
stats
SELECT c_first_name, cnt, c_salutation, c_last_name, c_preferred_cust_flag, ss_ticket_number FROM ( SELECT ss_ticket_number, ss_customer_sk, COUNT(*) AS cnt FROM store_sales INNER JOIN date_dim ON ss_sold_date_sk = d_date_sk INNER JOIN store ON ss_store_sk = s_store_sk INNER JOIN household_demographics ON ss_hdemo_sk =...
tpcds
SELECT 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 k.keyword LIKE '%sequel%' AND t.production_year > 2000 AND t.id = mk.movie_id AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Danish', 'Norwegian', 'German') AND m...
job
SELECT MIN(k.keyword) AS movie_keyword, MIN(n.name) AS actor_name, MIN(t.title) AS marvel_movie FROM cast_info AS ci, keyword AS k, movie_keyword AS mk, name AS n, title AS t WHERE k.keyword = 'marvel-cinematic-universe' AND n.id = ci.person_id AND ci.movie_id = mk.movie_id AND t.id = ci.movie_id AND t.production_year ...
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.production_year > 1990 AND mk.movie_id = ci.movie_id AND t....
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 chn.id = ci.person_role_id AND it.id = mi.info_type_id AND ci.role_id = r...
job
with _q as ( select ca_zip, sum(cs_sales_price) from catalog_sales join customer on cs_bill_customer_sk = c_customer_sk join customer_address on c_current_addr_sk = ca_address_sk join date_dim on cs_sold_date_sk = d_date_sk where (SUBSTR(ca_zip, 1, 5) in ( '85669', '86197', '88274', '83405', '86475', '85392', '85460', ...
tpcds
SELECT MAX(n.name) AS of_person, MAX(t.title) AS biography_movie FROM aka_name AS an, cast_info AS ci, info_type AS it, link_type AS lt, movie_link AS ml, name AS n, person_info AS pi, title AS t WHERE (n.gender = 'm' OR (n.gender = 'f' AND n.name LIKE 'B%')) AND t.production_year BETWEEN 1980 AND 1995 AND lt.link = 'f...
job
SELECT MIN(mi.info) AS release_date, MIN(miidx.info) AS rating, MIN(t.title) AS german_movie FROM company_name AS cn, company_type AS ct, info_type AS it, info_type AS it2, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS miidx, title AS t WHERE it2.info = 'release dates' AND kt.kind = 'movie...
job
Select s_phone, s_suppkey, total_revenue, s_address, s_name From supplier, revenue0 Where s_suppkey = supplier_no And total_revenue = ( Select Max(total_revenue) From revenue0 ) Order By s_suppkey Limit 200;
tpch
SELECT bought_city, c_first_name, ca_city, ss_ticket_number, c_last_name, extended_price, extended_tax, list_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(t.title) as movie_title from keyword as k, movie_info as mi, movie_keyword as mk, title as t where mi.info in ('Sweden', 'Norway', 'Germany', 'Danish', 'Swedish', 'Danish', 'Norwegian', 'German') and k.id = mk.keyword_id and mk.movie_id = mi.movie_id and t.id = mk.movie_id and k.keyword like '%sequel%' and t...
job
select count(*) from comments as c, posts as p, postLinks as pl, postHistory as ph, votes as v where c.Score = 0 AND p.Id = ph.PostId AND p.Id = c.PostId AND p.Id = pl.PostId AND p.FavoriteCount >= 0 AND p.Id = v.PostId AND pl.LinkTypeId = 1
stats
SELECT SUM(ss_ext_sales_price) AS ext_price, i_brand AS brand, i_manufact_id, i_manufact, 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 JOIN customer ON ss_customer_sk = c_customer_sk JOIN customer_address ON c_current_addr_sk = ca_address_sk JO...
tpcds
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 t.id = mk.movie_id AND ci.movie_id = mk.movie_id AND t.production_year > 2010 AND k.keywor...
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 t.id = mc.movie_id and mk.keyword_id = k.id and k.keyword = 'character-name-in-title' and n...
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 t.id = mi.movie_id AND it.info = 'bottom 10 rank' AND ct.id = mc.company_type_id AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND (mc.note L...
job
SELECT s_acctbal, s_name, n_name, p_partkey, p_mfgr, s_address, s_phone, s_comment FROM part, supplier, partsupp, nation, region WHERE ps_supplycost = ( SELECT MIN(ps_supplycost) FROM partsupp, supplier, nation, region WHERE p_partkey = ps_partkey AND s_suppkey = ps_suppkey AND s_nationkey = n_nationkey AND n_regionkey...
tpch
Select Min(n.name) As voicing_actress, Min(t.title) As voiced_movie From aka_name As an, char_name As chn, cast_info As ci, company_name As cn, info_type As it, movie_companies As mc, movie_info As mi, name As n, role_type As rt, title As t Where ci.note In ('(voice)', '(voice: Japanese version)', '(voice) (uncredited)...
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 o_orderdate < DATE 1 AND c_custkey = o_custkey AND c_mktsegment = 1 AND l_shipdate > DATE 1 Group By l_orderkey, o_orderdate, o_shippriority Order By reven...
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 s_nationkey = n_nationkey AND p...
tpch
WITH _q AS ( 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 u.Id = p.OwnerUserId AND p.Score <= 192 AND p.Id = ph.PostId AND p.Id = v.PostId AND p.Id = c.PostId AND u.Id = b.UserId ) SELECT * FROM _q;
stats
SELECT MIN(n.name) AS of_person, MIN(t.title) AS biography_movie FROM aka_name AS an, cast_info AS ci, info_type AS it, link_type AS lt, movie_link AS ml, name AS n, person_info AS pi, title AS t WHERE pi.note = 'Volker Boehm' AND pi.person_id = ci.person_id AND t.production_year BETWEEN 1980 AND 1995 AND t.id = ci.mov...
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 ct.id = mc.company_type_id AND it.id = mi.info_type_id AND mc.movie_id = mi.movie_id AND t.id = mi.movie_id AND it.info = 'bottom 10 rank' AND t.id = mc.movie_id AND ct.kind = 'produ...
job
WITH year_total AS ( SELECT c_birth_country AS customer_birth_country, c_first_name AS customer_first_name, c_last_name AS customer_last_name, c_email_address AS customer_email_address, c_preferred_cust_flag AS customer_preferred_cust_flag, SUM(((ss_ext_list_price - ss_ext_wholesale_cost - ss_ext_discount_amt) + ss_ext...
tpcds
SELECT s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE l1.l_receiptdate > l1.l_commitdate AND EXISTS ( SELECT * FROM lineitem l2 WHERE l2.l_orderkey = l1.l_orderkey AND l2.l_suppkey <> l1.l_suppkey ) AND o_orderstatus = 'F' AND n_name = 1 AND o_orderkey = l1.l_orderkey AND s_nationkey = n_n...
tpch
SELECT MIN(cn.name) AS movie_company, MIN(mi_idx.info) AS rating, MIN(t.title) AS western_violent_movie FROM company_name AS cn, company_type AS ct, info_type AS it1, info_type AS it2, keyword AS k, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS mi_idx, movie_keyword AS mk, title AS t WHERE...
job
SELECT AVG(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 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 c_custkey = o_custkey AND c_nationkey = s_nationkey AND r_name = 1 AND l_suppkey = s_suppkey AND s_nationkey = n_nationkey AND l_orderkey = o_ord...
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 t.id = mk.movie_id AND cn.country_code ='[sm]' AND k.keyword ='character-name-in-title' AND mc.movie_id = t.id AND mk.keyword_id = k.id AND mc.movie_id = mk.mo...
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 = ci.movie_id AND n.name LIKE '%Downey%Robert%' AND ci.movie_id = mk.movie_id AND t.production_year > 2010 AN...
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 s_suppkey = l1.l_suppkey AND s_nationkey = n_nationkey AND l1.l_receiptdate > l1.l_...
tpch
select avg(l_extendedprice) as avg_price, avg(l_quantity) as avg_qty, count(*) as count_order, sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) as sum_charge, l_linestatus, sum(l_extendedprice * (1 - l_discount)) as sum_disc_price, sum(l_quantity) as sum_qty, l_returnflag, sum(l_extendedprice) as sum_base_price, a...
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 t.id = mc.movie_id AND mc.movie_id = mi_idx.movie_id AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictur...
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 p_partkey = l_partkey AND ps_su...
tpch
SELECT n_name, c_phone, c_address, c_custkey, SUM(l_extendedprice * (1 - l_discount)) AS revenue, c_acctbal, c_name, c_comment FROM customer, orders, lineitem, nation WHERE l_orderkey = o_orderkey AND c_custkey = o_custkey AND o_orderdate < DATE 1 + INTERVAL '3' MONTH AND l_returnflag = 'R' AND o_orderdate >= DATE 1 AN...
tpch
SELECT MAX(mc.note) AS production_note, MAX(t.title) AS movie_title, MAX(t.production_year) AS movie_year FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info_idx AS mi_idx, title AS t WHERE mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND t.id = mi_idx.movie_id AND it.info = 'top 250 r...
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 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 ci.note LIKE '%(voice)%' AND ci.note LIKE '%(uncredited)%' AND cn.id = mc.com...
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 cn.id = mc.company_id And t.id = mk.movie_id And mc.movie_id = t.id And mc.movie_id = mk.movie_id And cn.country_code ='[sm]' And mk.keyword_id ...
job
Select Min(mi.info) As release_date, Min(miidx.info) As rating, Min(t.title) As german_movie From company_name As cn, company_type As ct, info_type As it, info_type As it2, kind_type As kt, movie_companies As mc, movie_info As mi, movie_info_idx As miidx, title As t Where kt.kind = 'movie' AND ct.kind = 'production com...
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.id = mk.keyword_id AND k.keyword LIKE '%sequel%' AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Danish', 'Norwegian', 'German') AND t.id = mi.movie_id AND t.id = mk.movie_id AND t.produ...
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 = v.PostId and p.Id = c.PostId and c.Score = 0 and p.Id = pl.RelatedPostId and p.Id = ph.PostId and b.UserId = c.UserId and pl.LinkTypeId = 1
stats
Select Min(t.title) As movie_title From company_name As cn, keyword As k, movie_companies As mc, movie_keyword As mk, title As t Where mc.movie_id = t.id AND cn.id = mc.company_id AND t.id = mk.movie_id AND mk.keyword_id = k.id AND cn.country_code ='[nl]' AND mc.movie_id = mk.movie_id AND k.keyword ='character-name-In-...
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.Score <= 192 AND u.Id = p.OwnerUserId AND p.Id = v.PostId AND p.Id = ph.PostId AND u.Id = b.UserId AND p.Id = c.PostId
stats
select cntrycode, count(*) as numcust, sum(c_acctbal) as totacctbal from ( select SUBSTRING(c_phone from 1 FOR 2) as cntrycode, c_acctbal from customer where not exists ( select * from orders where o_custkey = c_custkey ) ) as custsale AND c_acctbal > ( select avg(c_acctbal) from customer where c_acctbal > 0.00 AND SUB...
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 c_custkey = o_custkey AND n_regionkey = r_regionkey AND s_nationkey = n_nationkey AND o_orderdate >= DATE 1 AND l_suppkey = s_suppkey AND l_order...
tpch
Select o_year, Sum( Case When nation = 1 Then volume Else 0 End ) / Sum(volume) As mkt_share From ( Select EXTRACT(YEAR From o_orderdate) As o_year, l_extendedprice * (1 - l_discount) As volume, n2.n_name As nation From part, supplier, lineitem, orders, customer, nation n1, nation n2, region Where o_orderdate Between D...
tpch
Select Min(t.title) As movie_title From keyword As k, movie_info As mi, movie_keyword As mk, title As t Where k.id = mk.keyword_id And t.id = mk.movie_id And t.production_year > 2000 And mk.movie_id = mi.movie_id And k.keyword Like '%sequel%' And mi.info In ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Danish'...
job
WITH _q AS ( SELECT MIN(n.name) AS voicing_actress, MIN(t.title) AS voiced_movie FROM aka_name AS an, char_name AS chn, cast_info AS ci, company_name AS cn, info_type AS it, movie_companies AS mc, movie_info AS mi, name AS n, role_type AS rt, title AS t WHERE mi.movie_id = mc.movie_id AND ci.note IN ('(voice)', '(voice...
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 ct.kind = 'production companies' AND (mc.note LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%') AND it.id = mi.info_type_id AND mc.movie_id = mi.movie_id AND t.id = mc.movie_i...
job
Select Sum(cs_sales_price), ca_zip From catalog_sales Join customer On cs_bill_customer_sk = c_customer_sk Join customer_address On c_current_addr_sk = ca_address_sk Join date_dim On cs_sold_date_sk = d_date_sk Where d_year = 1999 AND (SUBSTR(ca_zip, 1, 5) In ( '85669', '86197', '88274', '83405', '86475', '85392', '854...
tpcds
SELECT MIN(t.title) AS german_movie, MIN(mi.info) AS release_date, MIN(miidx.info) AS rating FROM company_name AS cn, company_type AS ct, info_type AS it, info_type AS it2, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS miidx, title AS t WHERE ct.id = mc.company_type_id AND mc.movie_id = 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 ci.movie_id = mc.movie_id AND ct.id = mc.company_type_id AND ci.note LIKE '%(voice)%' AND rt.id = ci...
job
select count(*) from comments as c, posts as p, postLinks as pl, postHistory as ph, votes as v, users as u where p.Id = ph.PostId AND p.Id = v.PostId AND u.Id = p.OwnerUserId AND p.PostTypeId = 1 AND p.Id = pl.PostId AND p.Id = c.PostId AND p.AnswerCount >= 0 LIMIT 500;
stats
SELECT l_year, cust_nation, supp_nation, 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 o_orderk...
tpch
SELECT STDDEV_SAMP(cs_quantity) / AVG(cs_quantity) AS catalog_sales_quantitycov, AVG(ss_quantity) AS store_sales_quantityave, i_item_desc, AVG(cs_quantity) AS catalog_sales_quantityave, COUNT(cs_quantity) AS catalog_sales_quantitycount, STDDEV_SAMP(ss_quantity) AS store_sales_quantitystdev, i_item_id, STDDEV_SAMP(ss_qu...
tpcds