text
stringlengths
84
1.49k
benchmark
stringclasses
4 values
SELECT COUNT(*) FROM comments AS c, posts AS p, users AS u WHERE u.Id = p.OwnerUserId AND c.CreationDate >= '2010-08-05 00:36:02'::timestamp AND p.ViewCount >= 0 AND p.CommentCount >= 0 AND c.UserId = u.Id AND p.FavoriteCount >= 0 LIMIT 100;
stats
SELECT MIN(mi_idx.info) AS rating, MIN(t.title) AS movie_title FROM info_type AS it, movie_info_idx AS mi_idx, title AS t WHERE it.info ='rating' AND t.id = mi_idx.movie_id AND mi_idx.info > '8.0' AND t.production_year >= 2000 AND t.production_year <= 2005 AND it.id = mi_idx.info_type_id
job
SELECT MIN(t.title) AS series_named_after_char, MIN(an.name) AS cool_actor_pseudonym FROM aka_name AS an, cast_info AS ci, company_name AS cn, keyword AS k, movie_companies AS mc, movie_keyword AS mk, name AS n, title AS t WHERE t.episode_nr < 100 AND t.id = mk.movie_id AND t.id = mc.movie_id AND ci.movie_id = mk.movie...
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 = mk.movie_id AND mc.movie_id = mk.movie_id AND n.id = ci.person_id AND t.episode_nr <...
job
Select s_name, Count(*) As numwait From supplier, lineitem l1, orders, nation Where o_orderstatus = 'F' And o_orderkey = l1.l_orderkey And l1.l_receiptdate > l1.l_commitdate And 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 s_...
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 n.name_pcode_cf BETWEEN 'A' AND 'F' AND pi.note = 'Volker Boehm' AND it.info = 'mini biography' AND t.id = ci.movie_id...
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 mc.movie_id = mk.movie_id And mc.movie_id = t.id And cn.country_code ='[sm]' And k.keyword ='character-name-In-title' And t.id = mk.movie_id And mk.keyword_id = k.id And cn.id = mc.comp...
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 28 and 28 + 10 or ss_coupon_amt between 614 and 614 + 1000 or ss_wholesale_cost between 87 and 87 + 20) ) as b1, ( select avg(ss_list_pr...
tpcds
SELECT s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE s_suppkey = l1.l_suppkey AND o_orderstatus = 'F' AND o_orderkey = l1.l_orderkey 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 s_acctbal, s_name, n_name, p_partkey, p_mfgr, s_address, s_phone, s_comment FROM part, supplier, partsupp, nation, region WHERE n_regionkey = r_regionkey AND ps_supplycost = ( SELECT MIN(ps_supplycost) FROM partsupp, supplier, nation, region WHERE p_partkey = ps_partkey AND s_suppkey = ps_suppkey AND s_nationkey...
tpch
WITH _q AS ( SELECT COUNT(*) FROM comments AS c, votes AS v, badges AS b, users AS u WHERE u.Id = c.UserId AND u.Id = v.UserId AND u.Id = b.UserId AND c.Score = 1 AND u.CreationDate >= '2010-07-20 01:27:29'::timestamp LIMIT 20 ) SELECT * FROM _q;
stats
SELECT COUNT(1) FROM comments AS c, posts AS p, users AS u WHERE u.Id = p.OwnerUserId AND p.ViewCount >= 0 AND c.UserId = u.Id AND p.CommentCount >= 0 AND p.FavoriteCount >= 0 AND c.CreationDate >= '2010-08-05 00:36:02'::timestamp
stats
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.info like 'USA:% 199%' AND lt.li...
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.Id = pl.PostId AND p.Id = c.PostId AND p.PostTypeId = 1 AND p.AnswerCount >= 0 AND p.Id = ph.PostId AND p.Id = v.PostId
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 n.id = an.person_id AND t.id = ci.movie_id AND it.info = 'mini biography' AND pi.person_id = ci.person_id AND lt.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 n.id = ci.person_id AND t.id = ci.movie_id AND n.name LIKE '%Hemsworth%Chris%' AND k.id = mk.keyword_id AND k.keyword = 'marvel-cinematic-u...
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 mc.movie_id = mk.movie_id AND an.person_id = n.id AND n.id = ci.person_id AND cn.country_co...
job
SELECT MIN(mi_idx.info) AS rating, MIN(t.title) AS northamerican_movie FROM aka_title AS at, company_name AS cn, info_type AS it1, info_type AS it2, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS mi_idx, title AS t WHERE t.id = at.movie_id AND it1.info = 'rating' AND kt.id = t.kind_id AND i...
job
SELECT MIN(k.keyword) AS movie_keyword, MIN(n.name) AS actor_name, MIN(t.title) AS marvel_movie FROM cast_info AS ci, keyword AS k, movie_keyword AS mk, name AS n, title AS t WHERE n.name LIKE '%Hemsworth%Chris%' AND n.id = ci.person_id AND k.keyword = 'marvel-cinematic-universe' AND k.id = mk.keyword_id AND t.id = ci....
job
SELECT COUNT(*) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v, badges AS b, users AS u WHERE p.Score <= 40 AND p.Id = ph.PostId AND pl.LinkTypeId = 1 AND p.Id = v.PostId AND p.Id = pl.RelatedPostId AND p.Id = c.PostId AND b.UserId = u.Id AND c.UserId = u.Id
stats
SELECT c_address, c_name, c_comment, c_phone, c_acctbal, c_custkey, SUM(l_extendedprice * (1 - l_discount)) AS revenue, n_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(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 t.id = mk.movie_id and cn.country_code ='[sm]' and mk.keyword_id = k.id and k.keyword ='character-name-in-title' and mc.movie_id = mk.movie_id and cn.id = mc.comp...
job
SELECT AVG(l_quantity) AS avg_qty, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, AVG(l_discount) AS avg_disc, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, COUNT(*) AS count_order, l_returnflag, SUM(l_quantity) AS sum_qty, l_linestatus, SUM(l_extendedprice) AS sum_base_price, AVG(l_e...
tpch
SELECT MIN(mi_idx.info) AS rating, MIN(t.title) AS northamerican_movie FROM aka_title AS at, company_name AS cn, info_type AS it1, info_type AS it2, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS mi_idx, title AS t WHERE mi_idx.movie_id = mc.movie_id AND it1.info = 'rating' AND at.movie_id ...
job
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 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 mk.keyword_id = k.id AND cn.country_code ='[sm]' AND mc.movie_id = t.id AND k.keyword ='character-name-in-title' AND mc.movie_id = mk.mo...
job
SELECT COUNT(*) FROM postHistory AS ph, posts AS p, votes AS v, badges AS b, users AS u, comments AS c WHERE p.Id = v.PostId AND p.Score <= 192 AND p.Id = ph.PostId AND p.ViewCount >= 0 AND u.Id = b.UserId AND p.Id = c.PostId AND u.Id = p.OwnerUserId LIMIT 200;
stats
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 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 SUM(ss_ext_sales_price) AS ext_price, item.i_brand AS brand, item.i_brand_id AS brand_id, dt.d_year FROM date_dim AS dt JOIN store_sales ON dt.d_date_sk = store_sales.ss_sold_date_sk JOIN item ON store_sales.ss_item_sk = item.i_item_sk WHERE dt.d_year = 1999 AND item.i_manager_id = 67 AND dt.d_moy = 11 GROUP BY ...
tpcds
SELECT supp_nation, cust_nation, l_year, SUM(volume) AS revenue FROM ( SELECT n1.n_name AS supp_nation, n2.n_name AS cust_nation, EXTRACT(YEAR FROM l_shipdate) AS l_year, l_extendedprice * (1 - l_discount) AS volume FROM supplier, lineitem, orders, customer, nation n1, nation n2 WHERE c_custkey = o_custkey AND s_suppke...
tpch
select count(*) from comments as c, postHistory as ph, badges as b, votes as v, users as u where v.UserId = c.UserId AND b.UserId = ph.UserId AND ph.PostHistoryTypeId = 12 AND ph.UserId = v.UserId AND u.Id = b.UserId AND u.UpVotes = 0 LIMIT 50;
stats
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.movie_id = mi.movie_id AND it.id = mi.info_type_id AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND (mc.note LI...
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 ct.kind = 'production companies' AND ct.id = mc...
job
SELECT * FROM ( SELECT AVG(ss_list_price) AS b1_lp, COUNT(ss_list_price) AS b1_cnt, COUNT(DISTINCT ss_list_price) AS b1_cntd FROM store_sales WHERE ss_quantity BETWEEN 0 AND 5 AND (ss_list_price BETWEEN 98 AND 98 + 10 OR ss_coupon_amt BETWEEN 2733 AND 2733 + 1000 OR ss_wholesale_cost BETWEEN 77 AND 77 + 20) ) AS b2, ( ...
tpcds
SELECT c_first_name, bought_city, c_last_name, ss_ticket_number, extended_tax, ca_city, extended_price, 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 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 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 ='[nl]' and mc.movie_id = t.id and k.keyword ='character-name-in-title' and mk.keyword_id = k.id and mc.movie_id = mk.mo...
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 ci.note IN ('(voice)', '(voice: Japanese version)', '(voice) (uncredited)...
job
Select i_item_id, i_item_desc, i_current_price From item Inner Join inventory On i_item_sk = inv_item_sk Inner Join date_dim On d_date_sk = inv_date_sk Inner Join catalog_sales On cs_item_sk = i_item_sk Where inv_quantity_on_hand Between 100 And 500 And d_date Between CAST('2002-01-23' As DATE) And (CAST('2002-01-23' A...
tpcds
SELECT s_comment, s_address, s_phone, p_mfgr, s_acctbal, s_name, p_partkey, n_name FROM part, supplier, partsupp, nation, region WHERE p_partkey = ps_partkey AND s_suppkey = ps_suppkey AND p_size = 1 AND p_type LIKE 1 AND s_nationkey = n_nationkey AND n_regionkey = r_regionkey AND r_name = 1 AND ps_supplycost = ( SELEC...
tpch
SELECT MIN(t.title) AS northamerican_movie, MIN(mi_idx.info) AS rating FROM aka_title AS at, company_name AS cn, info_type AS it1, info_type AS it2, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS mi_idx, title AS t WHERE t.id = mc.movie_id AND cn.country_code = '[us]' AND at.title LIKE '%Ch...
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 Not Like '%(As Metro-Goldwyn-Mayer Pictures)%' AND t.id = mc.movie_id AND t.id = mi.movie_id AND mc.movie_id = mi.movie_id AND it.id = mi.info_type_id AND it.info = 'bottom 1...
job
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 mc.note NOT LIKE '%(USA)%' AND ci.role_id = rt.id AND n.gende...
job
select min(t.title) as northamerican_movie, min(mi_idx.info) as rating from aka_title as at, company_name as cn, info_type as it1, info_type as it2, kind_type as kt, movie_companies as mc, movie_info as mi, movie_info_idx as mi_idx, title as t where kt.id = t.kind_id and at.movie_id = mc.movie_id and t.id = mi_idx.movi...
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 t.production_year > 2000 AND t.id = mi.movie_id AND mi.info = ANY(ARRAY['Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Danish', 'Norwegian', 'German']) AND k.keyword LIKE '%sequel%...
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 cn.country_code = '[us]' AND t.id = mc.movie_id AND k.keyword = 'character-name-in-title' A...
job
SELECT SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, SUM(l_quantity) AS sum_qty, SUM(l_extendedprice) AS sum_base_price, AVG(l_extendedprice) AS avg_price, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, l_returnflag, AVG(l_quantity) AS avg_qty, l_linestatus, AVG(l_discount) AS avg_dis...
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 cn.id = mc.company_id AND cn.country_code ='[nl]' AND mc.movie_id = mk.movie_id AND mk.keyword_id = k.id AND t.id = mk.movie_id AND k.keyword ='character-name-In-...
job
SELECT supp_nation, cust_nation, l_year, SUM(volume) AS revenue FROM ( SELECT n1.n_name AS supp_nation, n2.n_name AS cust_nation, EXTRACT(YEAR FROM l_shipdate) AS l_year, l_extendedprice * (1 - l_discount) AS volume FROM supplier, lineitem, orders, customer, nation n1, nation n2 WHERE ( (n1.n_name = 1 AND n2.n_name = 1...
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 k.keyword like '%sequel%' AND mi.info in ('Sweden', 'Norway', 'Germany', 'Danish', 'Swedish', 'Danish', 'Norwegian', 'German') AND t.id = mi.movie_id AND t.id = mk.movie_id AND mk.movie...
job
SELECT n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, supplier, nation, region WHERE s_nationkey = n_nationkey AND r_name = 1 AND l_orderkey = o_orderkey AND o_orderdate >= DATE 1 AND o_orderdate < DATE 1 + INTERVAL '1' YEAR AND n_regionkey = r_regionkey AND c_custkey = o_cu...
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 mi.info = ANY(ARRAY['Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Danish', 'Norwegian', 'German']) AND k.id = mk.keyword_id AND t.id = mi.movie_id AND k.keyword LIKE '%sequ...
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 k.id = mk.keyword_id AND n.id = ci.person_id AND t.id = mk.movie_id AND n.name LIKE '%Hemsworth...
job
select c_last_name, c_first_name, ca_city, bought_city, ss_ticket_number, 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 MAX(mi.info) AS release_date, MAX(miidx.info) AS rating, MAX(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(mi_idx.info) AS rating, MIN(t.title) AS northamerican_movie FROM aka_title AS at, company_name AS cn, info_type AS it1, info_type AS it2, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS mi_idx, title AS t WHERE kt.kind = 'movie' AND mi_idx.info < '3.5' AND t.production_year > 2000...
job
SELECT MIN(mc.note) AS production_note, MIN(t.title) AS movie_title, MIN(t.production_year) AS movie_year FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info_idx AS mi_idx, title AS t WHERE ct.kind = 'production companies' AND mc.movie_id = mi_idx.movie_id AND mc.note NOT LIKE '%(as Metro-Goldwy...
job
select count(*) from postHistory as ph, posts as p, users as u, badges as b where p.OwnerUserId = u.Id and ph.UserId = u.Id and p.Score >= -7 and u.Id = b.UserId and ph.PostHistoryTypeId = 3 and u.Reputation >= 1
stats
SELECT MIN(cn.name) AS movie_company, MIN(mi_idx.info) AS rating, MIN(t.title) AS western_violent_movie FROM company_name AS cn, company_type AS ct, info_type AS it1, info_type AS it2, keyword AS k, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS mi_idx, movie_keyword AS mk, title AS t WHERE...
job
SELECT s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE o_orderkey = l1.l_orderkey 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 n_name = 1 AND o_orderstatus = 'F' AND s_nationkey =...
tpch
SELECT i_brand_id AS brand_id, i_manufact_id, SUM(ss_ext_sales_price) AS ext_price, 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 count(1) from comments as c, badges as b, users as u where c.UserId = b.UserId AND u.UpVotes >= 0 AND u.Id = c.UserId AND c.Score = 0
stats
SELECT SUM(l_extendedprice * (1 - l_discount)) AS revenue, n_name FROM customer, orders, lineitem, supplier, nation, region WHERE o_orderdate >= DATE 1 AND s_nationkey = n_nationkey AND r_name = 1 AND l_orderkey = o_orderkey AND c_custkey = o_custkey AND c_nationkey = s_nationkey AND l_suppkey = s_suppkey AND o_orderda...
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 an.person_id = n.id AND ci.movie_id = mc.movie_id AND k.keywo...
job
SELECT MIN(mi_idx.info) AS rating, MIN(t.title) AS northamerican_movie FROM aka_title AS at, company_name AS cn, info_type AS it1, info_type AS it2, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS mi_idx, title AS t WHERE mi_idx.movie_id = mc.movie_id AND mi.info LIKE 'USA:%200%' AND at.movi...
job
SELECT p_brand, p_type, p_size, COUNT(DISTINCT ps_suppkey) AS supplier_cnt FROM partsupp, part WHERE p_size IN (1, 1, 1, 1, 1, 1, 1, 1) AND p_brand <> 1 AND p_type NOT LIKE 1 AND p_partkey = ps_partkey AND ps_suppkey NOT IN ( SELECT s_suppkey FROM supplier WHERE s_comment LIKE '%Customer%Complaints%' ) GROUP BY p_brand...
tpch
Select 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, i_item_id, w_state, 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 SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, SUM(l_extendedprice) AS sum_base_price, l_linestatus, COUNT(*) AS count_order, l_returnflag, AVG(l_extendedprice) AS avg_price, AVG(l_discount) AS avg_disc, AVG(l_quantity) AS avg_qty, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, ...
tpch
SELECT c_address, c_phone, c_custkey, SUM(l_extendedprice * (1 - l_discount)) AS revenue, c_name, n_name, c_comment, 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 extended_tax, c_first_name, list_price, extended_price, ca_city, bought_city, c_last_name, ss_ticket_number 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(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 mc.movie_id = mk.movie_id AND ci.movie_id = t.id AND t.id = mk.movie_id AND ci.movie_id = m...
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.note LIKE '%(uncredited)%' AND cn.country_code = '[ru]' AND ci.movie_id = mc.movie_id AND ct.id =...
job
WITH year_total AS ( SELECT c_preferred_cust_flag AS customer_preferred_cust_flag, c_last_name AS customer_last_name, d_year AS dyear, c_customer_id AS customer_id, 's' AS sale_type, c_login AS customer_login, SUM(((ss_ext_list_price - ss_ext_wholesale_cost - ss_ext_discount_amt) + ss_ext_sales_price) / 2) AS year_tota...
tpcds
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 t.production_year > 2010 AND n.id = ci.person_id AND t.id = mk.movie_id AND t.id = ci.movie_id AND k.keyword = 'marvel-cinematic-universe' ...
job
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_custkey = o_custkey AND o_orderdate >= DATE 1 AND o_orderdate < DATE 1 + INTERVAL '3' MONTH AND l_orderkey = o_orderkey AND l_returnflag = 'R' AN...
tpch
Select Sum(l_extendedprice * l_discount) As revenue From lineitem Where l_quantity < 1 And l_shipdate >= DATE 1 And l_shipdate < DATE 1 + INTERVAL '1' YEAR And l_discount Between 1 - 0.01 And 1 + 0.01
tpch
SELECT MIN(t.title) AS marvel_movie, MIN(k.keyword) AS movie_keyword, MIN(n.name) AS actor_name FROM cast_info AS ci, keyword AS k, movie_keyword AS mk, name AS n, title AS t WHERE t.production_year > 2010 AND t.id = mk.movie_id AND k.keyword = 'marvel-cinematic-universe' AND t.id = ci.movie_id AND n.name LIKE '%Hemswo...
job
SELECT ca_city, bought_city, extended_price, ss_ticket_number, c_first_name, list_price, c_last_name, extended_tax FROM ( SELECT ss_ticket_number, ss_customer_sk, ca_city AS bought_city, SUM(ss_ext_sales_price) AS extended_price, SUM(ss_ext_list_price) AS list_price, SUM(ss_ext_tax) AS extended_tax FROM store_sales JOI...
tpcds
SELECT p_brand, p_type, p_size, COUNT(DISTINCT ps_suppkey) AS supplier_cnt FROM partsupp, part WHERE p_size IN (1, 1, 1, 1, 1, 1, 1, 1) AND p_partkey = ps_partkey AND p_type NOT LIKE 1 AND p_brand <> 1 AND ps_suppkey NOT IN ( SELECT s_suppkey FROM supplier WHERE s_comment LIKE '%Customer%Complaints%' ) GROUP BY p_brand...
tpch
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 i_item_desc, i_item_id, i_current_price FROM item JOIN inventory ON i_item_sk = inv_item_sk JOIN date_dim ON d_date_sk = inv_date_sk JOIN store_sales ON ss_item_sk = i_item_sk WHERE i_manufact_id = ANY(ARRAY[427, 128, 154, 9]) AND inv_quantity_on_hand BETWEEN 100 AND 500 AND i_current_price BETWEEN 80 AND 80 + 3...
tpcds
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 t.production_year <= 2005 and t.id = mi_idx.movie_id and t.production_year >= 2000 and mi_idx.info > '8.0' and it.info ='rating' and it.id = mi_idx.info_type_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 t.id = mc.movie_id AND an1.person_id = ci.person_id AND mc.note LIKE '%(Japan)%' AND mc.company_id = cn.id AND ...
job
Select Min(n.name) As actor_name, Min(k.keyword) As movie_keyword, 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.id = ci.movie_id AND t.production_year > 2010 AND k.keyword = 'marvel-cinematic-universe' AND t.id = mk.mov...
job
select avg(ss_ext_wholesale_cost), avg(ss_ext_sales_price), sum(ss_ext_wholesale_cost), avg(ss_quantity) 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 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_receiptdate < DATE 1 + INTERVAL '1' YEAR A...
tpch
Select p_brand, p_type, p_size, Count(Distinct ps_suppkey) As supplier_cnt From partsupp, part Where p_partkey = ps_partkey AND p_type Not Like 1 AND p_size In (1, 1, 1, 1, 1, 1, 1, 1) AND p_brand <> 1 AND NOT EXISTS (SELECT 1 FROM (Select s_suppkey From supplier Where s_comment Like '%Customer%Complaints%') AS _ne WHE...
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 k.keyword = 'anime' And ci.role_...
job
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 (mc.note LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%') AND it.id = mi_idx.info_type_id AND it.i...
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.production_year > 2000 AND ci.person_id = an.person_id AND t.id = ci.mo...
job
SELECT MIN(an1.name) AS actress_pseudonym, MIN(t.title) AS japanese_movie_dubbed FROM aka_name AS an1, cast_info AS ci, company_name AS cn, movie_companies AS mc, name AS n1, role_type AS rt, title AS t WHERE n1.name LIKE '%Yo%' AND ci.role_id = rt.id AND mc.company_id = cn.id AND n1.id = ci.person_id AND rt.role = 'ac...
job
SELECT i_item_id, MAX(cs_net_profit) AS catalog_sales_profit, MAX(sr_net_loss) AS store_returns_loss, s_store_name, i_item_desc, s_store_id, MAX(ss_net_profit) AS store_sales_profit FROM store_sales JOIN store_returns ON store_sales.ss_customer_sk = store_returns.sr_customer_sk AND store_sales.ss_item_sk = store_return...
tpcds
SELECT COUNT(cs_quantity) AS catalog_sales_quantitycount, i_item_desc, AVG(cs_quantity) AS catalog_sales_quantityave, i_item_id, AVG(ss_quantity) AS store_sales_quantityave, COUNT(ss_quantity) AS store_sales_quantitycount, STDDEV_SAMP(sr_return_quantity) / AVG(sr_return_quantity) AS store_returns_quantitycov, STDDEV_SA...
tpcds
select count(*) from comments as c, posts as p, postLinks as pl where p.CommentCount <= 18 and p.Id = pl.PostId and c.UserId = p.OwnerUserId and p.CreationDate >= '2010-07-23 07:27:31'::timestamp and p.CreationDate <= '2014-09-09 01:43:00'::timestamp
stats
SELECT AVG(l_quantity) AS avg_qty, AVG(l_extendedprice) AS avg_price, 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, l_linestatus, SUM(l_extendedprice) AS sum_base_price, SUM(l_quantity) AS sum_qty, COUNT(*) AS...
tpch
SELECT MIN(mi_idx.info) AS rating, MIN(t.title) AS northamerican_movie FROM aka_title AS at, company_name AS cn, info_type AS it1, info_type AS it2, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS mi_idx, title AS t WHERE t.id = at.movie_id AND at.movie_id = mi_idx.movie_id AND t.id = mi_idx...
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.id = t.kind_id AND mi.movie_id = miidx.movie...
job
SELECT s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE s_nationkey = n_nationkey AND o_orderstatus = 'F' 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 n_name = 1 AND o_orderkey = l...
tpch