text
stringlengths
84
1.49k
benchmark
stringclasses
4 values
SELECT MIN(n.name) AS of_person, MIN(t.title) AS biography_movie FROM aka_name AS an, cast_info AS ci, info_type AS it, link_type AS lt, movie_link AS ml, name AS n, person_info AS pi, title AS t WHERE it.info = 'mini biography' AND pi.note = 'Volker Boehm' AND pi.person_id = an.person_id AND ci.movie_id = ml.linked_mo...
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 mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND ct.kind = 'production companies' AND it.info = 'bottom 10 rank' AND mc.movie_id = mi.movie_id 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.FavoriteCount >= 0 AND p.Id = ph.PostId AND p.Id = v.PostId AND p.Id = c.PostId AND pl.LinkTypeId = 1 AND p.Id = pl.PostId
stats
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 ci.movie_id = t.id AND ci.movie_id = mc.movie_id AND cn.cou...
job
SELECT list_price, ca_city, ss_ticket_number, c_last_name, extended_tax, c_first_name, extended_price, bought_city 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 SUM(l_extendedprice * (1 - l_discount)) AS revenue, c_custkey, c_phone, n_name, c_acctbal, c_name, c_address, c_comment FROM customer, orders, lineitem, nation WHERE c_custkey = o_custkey AND l_orderkey = o_orderkey AND o_orderdate >= DATE 1 AND o_orderdate < DATE 1 + INTERVAL '3' MONTH AND l_returnflag = 'R' AN...
tpch
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 ct.id = mc.company_type_id AND t.id =...
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 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(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 n.id = ci.person_id AND t.production_year > 2010 AND k.id = mk.keyword_id AND t.id = mk.movie_id AND k.keyword = 'marvel-cinematic-universe...
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 kt.kind = 'movie' AND it.info = 'rating' AND it...
job
SELECT c_salutation, c_preferred_cust_flag, c_first_name, cnt, ss_ticket_number, c_last_name FROM ( SELECT ss_ticket_number, ss_customer_sk, COUNT(1) 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_shippriority, l_orderkey, SUM(l_extendedprice * (1 - l_discount)) AS revenue, o_orderdate FROM customer, orders, lineitem WHERE o_orderdate < DATE 1 AND c_mktsegment = 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 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 c_custkey, SUM(l_quantity), o_totalprice, o_orderdate, c_name, 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
With ss As ( Select i_manufact_id, Sum(ss_ext_sales_price) As total_sales From store_sales Join date_dim On ss_sold_date_sk = d_date_sk Join customer_address On ss_addr_sk = ca_address_sk Join item On ss_item_sk = i_item_sk Where d_moy = 1 And ca_gmt_offset = -6 And i_category = ANY(ARRAY['Sports']) And d_year = 2002 G...
tpcds
SELECT MIN(n.name) AS of_person, MIN(t.title) AS biography_movie FROM aka_name AS an, cast_info AS ci, info_type AS it, link_type AS lt, movie_link AS ml, name AS n, person_info AS pi, title AS t WHERE lt.link = 'features' AND pi.person_id = ci.person_id AND pi.person_id = an.person_id AND n.name_pcode_cf BETWEEN 'A' A...
job
SELECT o_year, SUM( CASE WHEN nation = 1 THEN volume ELSE 0 END ) / SUM(volume) AS mkt_share FROM ( SELECT EXTRACT(YEAR FROM o_orderdate) AS o_year, l_extendedprice * (1 - l_discount) AS volume, n2.n_name AS nation FROM part, supplier, lineitem, orders, customer, nation n1, nation n2, region WHERE o_custkey = c_custkey...
tpch
SELECT SUM(ss_quantity) AS store_sales_quantity, s_store_id, i_item_id, SUM(sr_return_quantity) AS store_returns_quantity, i_item_desc, s_store_name, SUM(cs_quantity) AS catalog_sales_quantity FROM store_sales JOIN store_returns ON ss_customer_sk = sr_customer_sk AND ss_item_sk = sr_item_sk AND ss_ticket_number = sr_ti...
tpcds
select 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_current_price between 93 and 93 + 30 and d_date between CAST('2002-01-23' as DATE) and (CAST('2002-01-23' as DATE) + INTERVAL '60...
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 = mi.movie_id AND k.keyword like '%sequel%' AND t.production_year > 2005 AND t.id = mk.movie_id AND mi.info in ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Denish', 'Norwegian', 'German') AND mk....
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.production_year > 2010 And t.id = ci.movie_id And t.id = mk.movie_id And n.name Like '%Hemsworth%Chris%' And k.id...
job
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 IN (427, 128, 154, 9) AND inv_quantity_on_hand BETWEEN 100 AND 500 AND d_date BETWEEN CAST('2002-01-23' AS DATE) AND ...
tpcds
SELECT MIN(n.name) AS of_person, MIN(t.title) AS biography_movie FROM aka_name AS an, cast_info AS ci, info_type AS it, link_type AS lt, movie_link AS ml, name AS n, person_info AS pi, title AS t WHERE pi.note = 'Volker Boehm' AND n.id = pi.person_id AND an.person_id = ci.person_id AND pi.person_id = ci.person_id AND n...
job
WITH _q AS ( 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_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.country_code ='[nl]' AND mk.keyword_id = k.id AND t.id = mk.movie_id AND k.keyword ='character-name-in-title' AND mc.movie_id = mk.movie_id AND mc.movie_id = t.id AND cn.id = mc.comp...
job
SELECT l_returnflag, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, SUM(l_extendedprice) AS sum_base_price, COUNT(*) AS count_order, AVG(l_quantity) AS avg_qty, l_linestatus, AVG(l_extendedprice) AS avg_price, AVG(l_discount) AS avg_disc, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, ...
tpch
SELECT AVG(ss_coupon_amt) AS agg3, AVG(ss_sales_price) AS agg4, AVG(ss_quantity) AS agg1, AVG(ss_list_price) AS agg2, i_item_id 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 count(*) from badges as b, users as u, posts as p where u.Reputation >= 1 AND u.Id = b.UserId AND p.PostTypeId = 1 AND u.Id = p.OwnerUserId limit 1000;
stats
SELECT ps_partkey, SUM(ps_supplycost * ps_availqty) AS VALUE FROM partsupp, supplier, nation WHERE ps_suppkey = s_suppkey AND s_nationkey = n_nationkey AND n_name = 1 GROUP BY ps_partkey HAVING SUM(ps_supplycost * ps_availqty) > ( SELECT SUM(ps_supplycost * ps_availqty) * 1 FROM partsupp, supplier, nation WHERE ps_supp...
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.id = mk.movie_id AND mc.note LIKE '%(Japan)%' AND rt.role =...
job
SELECT MIN(cn.name) AS from_company, MIN(lt.link) AS link_type, MIN(t.title) AS western_sequel FROM company_name AS cn, company_type AS ct, info_type AS it, keyword AS k, link_type AS lt, movie_companies AS mc, movie_info AS mi, movie_keyword AS mk, movie_link AS ml, title AS t WHERE cn.id = mc.company_id AND k.keyword...
job
SELECT p_type, p_size, p_brand, COUNT(DISTINCT ps_suppkey) AS supplier_cnt FROM partsupp, part WHERE p_size = ANY(ARRAY[1, 1, 1, 1, 1, 1, 1, 1]) AND p_brand <> 1 AND p_type NOT LIKE 1 AND ps_suppkey NOT IN ( SELECT s_suppkey FROM supplier WHERE s_comment LIKE '%Customer%Complaints%' ) AND p_partkey = ps_partkey GROUP B...
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 l_suppkey = s_suppkey AND l_orderkey = o_orderkey AND s_nationkey = n_nationkey AND o_orderdate >= DATE 1 AND c_nationkey = s_nationkey AND o_orderdate < DATE 1...
tpch
SELECT SUM(l_extendedprice * (1 - l_discount)) AS revenue, o_shippriority, l_orderkey, o_orderdate FROM customer, orders, lineitem WHERE c_mktsegment = 1 AND l_shipdate > DATE 1 AND o_orderdate < DATE 1 AND c_custkey = o_custkey AND l_orderkey = o_orderkey GROUP BY l_orderkey, o_orderdate, o_shippriority ORDER BY reven...
tpch
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 p.Id = c.PostId AND pl.LinkTypeId = 1 AND b.UserId = u.Id AND p.Score <= 40 AND c.UserId = u.Id AND p.Id = pl.RelatedPostId AND p.Id = v.PostId AND p.Id = ph.PostId
stats
SELECT MIN(mc.note) AS production_note, MIN(t.title) AS movie_title, MIN(t.production_year) AS movie_year FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info_idx AS mi_idx, title AS t WHERE t.id = mi_idx.movie_id AND it.info = 'top 250 rank' AND ct.kind = 'production companies' AND ct.id = mc.co...
job
SELECT MIN(cn.name) AS from_company, MIN(lt.link) AS link_type, MIN(t.title) AS western_sequel FROM company_name AS cn, company_type AS ct, info_type AS it, keyword AS k, link_type AS lt, movie_companies AS mc, movie_info AS mi, movie_keyword AS mk, movie_link AS ml, title AS t WHERE ct.id = mc.company_type_id AND lt.l...
job
SELECT p_brand, p_type, p_size, COUNT(DISTINCT ps_suppkey) AS supplier_cnt FROM partsupp, part WHERE p_partkey = ps_partkey AND p_size IN (1, 1, 1, 1, 1, 1, 1, 1) AND p_type NOT LIKE 1 AND ps_suppkey NOT IN ( SELECT s_suppkey FROM supplier WHERE s_comment LIKE '%Customer%Complaints%' ) AND p_brand <> 1 GROUP BY p_brand...
tpch
SELECT i_item_desc, i_item_id, s_store_id, MAX(sr_net_loss) AS store_returns_loss, s_store_name, MAX(cs_net_profit) AS catalog_sales_profit, 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
WITH _q AS ( SELECT MIN(mi_idx.info) AS rating, MIN(t.title) AS movie_title FROM info_type AS it, movie_info_idx AS mi_idx, title AS t WHERE mi_idx.info > '7.0' AND it.info ='rating' AND it.id = mi_idx.info_type_id ) SELECT * FROM _q AND t.id = mi_idx.movie_id AND t.production_year BETWEEN 2000 AND 2010
job
SELECT nation, o_year, SUM(amount) AS sum_profit FROM ( SELECT n_name AS nation, EXTRACT(YEAR FROM o_orderdate) AS o_year, l_extendedprice * (1 - l_discount) - ps_supplycost * l_quantity AS amount FROM part, supplier, lineitem, partsupp, orders, nation WHERE s_suppkey = l_suppkey AND ps_partkey = l_partkey AND p_partke...
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.id = mc.movie_id And t.production_year > 1990 And t.id = ci...
job
SELECT i_item_desc, s_store_name, MAX(cs_net_profit) AS catalog_sales_profit, MAX(sr_net_loss) AS store_returns_loss, MAX(ss_net_profit) AS store_sales_profit, s_store_id, 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 COUNT(1) AS cnt, a.ca_state AS state FROM customer_address AS a INNER JOIN customer AS c ON a.ca_address_sk = c.c_current_addr_sk INNER JOIN store_sales AS s ON c.c_customer_sk = s.ss_customer_sk INNER JOIN date_dim AS d ON s.ss_sold_date_sk = d.d_date_sk INNER JOIN item AS i ON s.ss_item_sk = i.i_item_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 it2.info = 'release dates' AND cn.id = mc.compa...
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 = ph.PostId AND p.Id = c.PostId AND b.UserId = c.UserId AND c.Score = 0 AND p.Id = pl.RelatedPostId AND pl.LinkTypeId = 1
stats
SELECT i_item_desc, s_store_id, SUM(cs_quantity) AS catalog_sales_quantity, i_item_id, SUM(ss_quantity) AS store_sales_quantity, s_store_name, SUM(sr_return_quantity) AS store_returns_quantity FROM store_sales JOIN store_returns ON ss_customer_sk = sr_customer_sk AND ss_item_sk = sr_item_sk AND ss_ticket_number = sr_ti...
tpcds
SELECT o_shippriority, SUM(l_extendedprice * (1 - l_discount)) AS revenue, o_orderdate, l_orderkey FROM customer, orders, lineitem WHERE o_orderdate < DATE 1 AND c_mktsegment = 1 AND l_orderkey = o_orderkey AND c_custkey = o_custkey AND l_shipdate > DATE 1 GROUP BY l_orderkey, o_orderdate, o_shippriority ORDER BY reven...
tpch
SELECT i_brand_id AS brand_id, i_manufact, i_brand AS brand, SUM(ss_ext_sales_price) AS ext_price, i_manufact_id FROM date_dim JOIN store_sales ON d_date_sk = ss_sold_date_sk JOIN item ON ss_item_sk = i_item_sk JOIN customer ON ss_customer_sk = c_customer_sk JOIN customer_address ON c_current_addr_sk = ca_address_sk JO...
tpcds
SELECT SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, l_returnflag, AVG(l_discount) AS avg_disc, COUNT(*) AS count_order, SUM(l_extendedprice) AS sum_base_price, SUM(l_quantity) AS sum_qty, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, AVG(l_quantity) AS avg_qty, AVG(l_extendedprice) ...
tpch
WITH _q AS ( 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...
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 an.person_id = ci.person_id AND mc.movie_id = mk.movie_id AND ci.movie_id = mc.movie_id AND...
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 mc.movie_id = t.id And mi.movie_id = mc.movie_i...
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 it.id = mi...
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 b.UserId = c.UserId AND pl.LinkTypeId = 1 AND c.Score = 0 AND p.Id = pl.RelatedPostId AND p.Id = ph.PostId AND p.Id = c.PostId
stats
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: Japanese ve...
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 mi.movie_id = t.id AND miidx.movie_id = t.id AN...
job
SELECT o_year, SUM( CASE WHEN nation = 1 THEN volume ELSE 0 END ) / SUM(volume) AS mkt_share FROM ( SELECT EXTRACT(YEAR FROM o_orderdate) AS o_year, l_extendedprice * (1 - l_discount) AS volume, n2.n_name AS nation FROM part, supplier, lineitem, orders, customer, nation n1, nation n2, region WHERE s_suppkey = l_suppkey...
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 = at.movie_id AND kt.id = t.kind_id AND it2.info = 'release dates...
job
select count(*) from postHistory as ph, posts as p, votes as v, badges as b, users as u, comments as c where u.Id = b.UserId AND p.Id = c.PostId AND p.Score <= 192 AND p.Id = v.PostId AND p.Id = ph.PostId AND p.ViewCount >= 0 AND u.Id = p.OwnerUserId
stats
SELECT COUNT(1) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v WHERE p.Id = pl.PostId AND c.Score = 0 AND p.Id = c.PostId AND pl.LinkTypeId = 1 AND p.Id = ph.PostId AND p.Id = v.PostId AND p.FavoriteCount >= 0
stats
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 o_orderkey = l1.l_orderkey an...
tpch
SELECT c_custkey, c_comment, c_address, n_name, c_acctbal, c_phone, c_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, nation WHERE l_orderkey = o_orderkey AND o_orderdate >= DATE 1 AND c_nationkey = n_nationkey AND o_orderdate < DATE 1 + INTERVAL '3' MONTH AND l_returnflag = 'R...
tpch
WITH _q AS ( SELECT COUNT(*) FROM comments AS c, posts AS p, votes AS v WHERE v.VoteTypeId = 2 AND p.Id = v.PostId AND c.PostId = p.Id AND c.Score = 0 LIMIT 100 ) SELECT * FROM _q;
stats
SELECT i_item_id, s_store_id, s_store_name, MAX(sr_net_loss) AS store_returns_loss, MAX(ss_net_profit) AS store_sales_profit, MAX(cs_net_profit) AS catalog_sales_profit, i_item_desc 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 c_salutation, cnt, c_last_name, c_preferred_cust_flag, ss_ticket_number, c_first_name 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 year_total AS ( SELECT c_first_name AS customer_first_name, c_last_name AS customer_last_name, c_preferred_cust_flag AS customer_preferred_cust_flag, d_year AS dyear, 's' AS sale_type, c_login AS customer_login, c_email_address AS customer_email_address, c_customer_id AS customer_id, c_birth_country AS customer_bi...
tpcds
SELECT l_shipmode, SUM( CASE WHEN o_orderpriority <> '1-URGENT' AND o_orderpriority <> '2-HIGH' THEN 1 ELSE 0 END ) AS low_line_count, SUM( CASE WHEN o_orderpriority = '1-URGENT' OR o_orderpriority = '2-HIGH' THEN 1 ELSE 0 END ) AS high_line_count FROM orders, lineitem WHERE l_receiptdate >= DATE 1 AND l_receiptdate < ...
tpch
SELECT p_type, p_size, COUNT(DISTINCT ps_suppkey) AS supplier_cnt, p_brand FROM partsupp, part WHERE p_partkey = ps_partkey AND ps_suppkey NOT IN ( SELECT s_suppkey FROM supplier WHERE s_comment LIKE '%Customer%Complaints%' ) AND p_brand <> 1 AND p_type NOT LIKE 1 AND p_size = ANY(ARRAY[1, 1, 1, 1, 1, 1, 1, 1]) GROUP B...
tpch
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(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 it1.info = 'rating' and it1.id = mi_idx.info_type_id and mi.movie_id =...
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 k.keyword = 'anime' And n.gender = 'f' And mc.note Not Like '...
job
SELECT o_year, SUM( CASE WHEN nation = 1 THEN volume ELSE 0 END ) / SUM(volume) AS mkt_share FROM ( SELECT EXTRACT(YEAR FROM o_orderdate) AS o_year, l_extendedprice * (1 - l_discount) AS volume, n2.n_name AS nation FROM part, supplier, lineitem, orders, customer, nation n1, nation n2, region WHERE n1.n_regionkey = r_re...
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_suppkey = l_suppkey AND s_nationk...
tpch
SELECT MIN(t.title) AS western_violent_movie, MIN(mi_idx.info) AS rating, MIN(cn.name) AS movie_company 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(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 mc.note LIKE '%(USA)%' AND an.person_id = n.id AND rt.role = 'actress' AN...
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 s_suppkey = ps_suppkey AND p_partkey = ps_partkey AND p_size = 1 AND p_type LIKE 1 AND s_nationkey = n_nationkey AND ps_supplycost = ( SELECT MIN(ps_supplycost) FROM partsupp, supplier,...
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 ps_partkey = l_partkey AND s_suppkey = l_suppkey AND p_name L...
tpch
SELECT MIN(an1.name) AS actress_pseudonym, MIN(t.title) AS japanese_movie_dubbed FROM aka_name AS an1, cast_info AS ci, company_name AS cn, movie_companies AS mc, name AS n1, role_type AS rt, title AS t WHERE t.id = mc.movie_id AND mc.note LIKE '%(Japan)%' AND ci.note = '(voice: English version)' AND an1.person_id = ci...
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.id = t.kind_id AND it1.info = 'rating' AND t.id = mc.movie_id AND t...
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 ci.person_id = an.person_id AND rt.role = 'actress' AND ci.ro...
job
SELECT COUNT(*) FROM postHistory AS ph, posts AS p, votes AS v, badges AS b, users AS u, comments AS c WHERE u.Id = b.UserId AND p.Id = c.PostId AND p.Score <= 192 AND p.ViewCount >= 0 AND p.Id = v.PostId AND u.Id = p.OwnerUserId AND p.Id = ph.PostId
stats
WITH _q AS ( SELECT SUM(l_extendedprice) / 7.0 AS avg_yearly FROM lineitem, part WHERE p_container = 1 AND p_partkey = l_partkey AND p_brand = 1 AND l_quantity < ( SELECT 0.2 * AVG(l_quantity) FROM lineitem WHERE l_partkey = p_partkey ) ) SELECT * FROM _q;
tpch
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.country_cod...
job
SELECT l_orderkey, SUM(l_extendedprice * (1 - l_discount)) AS revenue, o_orderdate, o_shippriority FROM customer, orders, lineitem WHERE l_shipdate > DATE 1 AND l_orderkey = o_orderkey AND c_custkey = o_custkey AND c_mktsegment = 1 AND o_orderdate < DATE 1 GROUP BY l_orderkey, o_orderdate, o_shippriority ORDER BY reven...
tpch
Select l_shipmode, Sum( Case When o_orderpriority = '1-URGENT' Or o_orderpriority = '2-HIGH' Then 1 Else 0 End ) As high_line_count, Sum( Case When o_orderpriority <> '1-URGENT' And o_orderpriority <> '2-HIGH' Then 1 Else 0 End ) As low_line_count From orders, lineitem Where l_receiptdate < DATE 1 + INTERVAL '1' YEAR A...
tpch
select i_brand_id as brand_id, sum(ss_ext_sales_price) as ext_price, 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 where i_manager_id = 1 and d_moy = 11 and d_year = 2001 group by i_brand, i_brand_id order by ext_price desc, brand_id;
tpcds
SELECT s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE n_name = 1 AND o_orderkey = l1.l_orderkey AND EXISTS ( SELECT * FROM lineitem l2 WHERE l2.l_orderkey = l1.l_orderkey AND l2.l_suppkey <> l1.l_suppkey ) AND s_suppkey = l1.l_suppkey AND s_nationkey = n_nationkey AND o_orderstatus = 'F' A...
tpch
SELECT MIN(t.title) AS western_violent_movie, MIN(cn.name) AS movie_company, MIN(mi_idx.info) AS rating 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(k.keyword) AS movie_keyword, MIN(n.name) AS actor_name, MIN(t.title) AS marvel_movie FROM cast_info AS ci, keyword AS k, movie_keyword AS mk, name AS n, title AS t WHERE k.id = mk.keyword_id AND k.keyword = 'marvel-cinematic-universe' AND t.id = ci.movie_id AND t.id = mk.movie_id AND n.id = ci.person_id AND ...
job
SELECT 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 '%Downey%Robert%' AND n.id = ci.person_id AND ci.movie_id = mk.movie_id AND t.id = mk.movie_id AND t.production_year > 2010 AND...
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_commitdate < l_receiptdate AND l_receiptda...
tpch
WITH _q AS ( 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 JOIN store_returns ON ss_customer_sk = sr_customer_sk AND ss_item_sk = sr_item_sk AND ss_ticket_n...
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 mc.note like '%(USA)%' and ci.person_id = an.person_id and it.info = 'rel...
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(t.title) AS american_movie FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info AS mi, title AS t WHERE t.id = mi.movie_id AND mc.movie_id = mi.movie_id AND it.info = 'bottom 10 rank' AND ct.kind = 'production companies' AND it.id = mi.info_type_id AND (mc.note LIKE '%(co-production)%'...
job
SELECT COUNT(DISTINCT ps_suppkey) AS supplier_cnt, p_brand, p_type, p_size FROM partsupp, part WHERE p_partkey = ps_partkey AND p_brand != 1 AND p_type NOT LIKE 1 AND p_size = ANY(ARRAY[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 B...
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 = mi_idx.movie_id AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND mc.movie_id = mi_idx...
job