text
stringlengths
84
1.49k
benchmark
stringclasses
4 values
Select s_name, Count(*) As numwait From supplier, lineitem l1, orders, nation Where o_orderkey = l1.l_orderkey And n_name = 1 And l1.l_receiptdate > l1.l_commitdate And s_suppkey = l1.l_suppkey And Not Exists ( Select * From lineitem l3 Where l3.l_orderkey = l1.l_orderkey And l3.l_suppkey <> l1.l_suppkey And l3.l_recei...
tpch
SELECT i_item_id, i_item_desc, s_store_id, s_store_name, MAX(ss_net_profit) AS store_sales_profit, MAX(sr_net_loss) AS store_returns_loss, MAX(cs_net_profit) AS catalog_sales_profit FROM store_sales INNER JOIN store_returns ON store_sales.ss_customer_sk = store_returns.sr_customer_sk AND store_sales.ss_item_sk = store_...
tpcds
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 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 count(*) from comments as c, votes as v, users as u where u.Reputation >= 1 and u.Id = c.UserId and u.Id = v.UserId and c.CreationDate >= '2010-08-10 17:55:45'::timestamp LIMIT 100;
stats
Select n_name, Sum(l_extendedprice * (1 - l_discount)) As revenue From customer, orders, lineitem, supplier, nation, region Where s_nationkey = n_nationkey AND o_orderdate < DATE 1 + INTERVAL '1' YEAR AND c_nationkey = s_nationkey AND l_suppkey = s_suppkey AND c_custkey = o_custkey AND r_name = 1 AND n_regionkey = r_re...
tpch
WITH year_total AS ( SELECT c_email_address AS customer_email_address, c_login AS customer_login, c_first_name AS customer_first_name, c_last_name AS customer_last_name, SUM(((ss_ext_list_price - ss_ext_wholesale_cost - ss_ext_discount_amt) + ss_ext_sales_price) / 2) AS year_total, 's' AS sale_type, c_preferred_cust_fl...
tpcds
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 cn.country_code = '[us]' AND t.episode_nr >= 50 AND ci.movie_id = t.id AND ci.movie_id = mc...
job
WITH year_total AS ( SELECT c_preferred_cust_flag AS customer_preferred_cust_flag, c_last_name AS customer_last_name, c_email_address AS customer_email_address, c_customer_id AS customer_id, c_birth_country AS customer_birth_country, 's' AS sale_type, c_login AS customer_login, d_year AS dyear, SUM(((ss_ext_list_price ...
tpcds
WITH year_total AS ( SELECT c_last_name AS customer_last_name, c_first_name AS customer_first_name, d_year AS dyear, c_preferred_cust_flag AS customer_preferred_cust_flag, c_customer_id AS customer_id, c_email_address AS customer_email_address, c_login AS customer_login, c_birth_country AS customer_birth_country, 's' A...
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 mi.movie_id = t.id AND k.id = mk.ke...
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 = t.id AND mk.keyword_id = k.id AND t.id = mk.movie_id AND k.keyword ='character-name-in-title' AND cn.id = mc.company_id AND mc.movie_id = mk.movie_id AND cn.country_code =...
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 it2.info = 'release dates...
job
SELECT AVG(ss_ext_wholesale_cost), SUM(ss_ext_wholesale_cost), AVG(ss_ext_sales_price), 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 c_custkey, c_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue, c_acctbal, n_name, c_address, c_phone, c_comment FROM customer, orders, lineitem, nation WHERE c_nationkey = n_nationkey AND o_orderdate >= DATE 1 AND l_orderkey = o_orderkey AND o_orderdate < DATE 1 + INTERVAL '3' MONTH AND l_returnflag = 'R...
tpch
SELECT MIN(t.title) AS american_movie FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info AS mi, title AS t WHERE t.id = mi.movie_id AND ct.id = mc.company_type_id AND it.info = 'bottom 10 rank' AND it.id = mi.info_type_id AND ct.kind = 'production companies' AND mc.note NOT LIKE '%(as Metro-Gol...
job
WITH year_total AS ( SELECT c_login AS customer_login, 's' AS sale_type, c_customer_id AS customer_id, c_first_name AS customer_first_name, d_year AS dyear, c_last_name AS customer_last_name, c_birth_country AS customer_birth_country, c_email_address AS customer_email_address, SUM(((ss_ext_list_price - ss_ext_wholesale...
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 o_orderkey = l_orderkey AND s_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 = mc.movie_id AND mc.note NOT LIKE '%(USA)%' AND mk.movi...
job
SELECT SUM(CASE WHEN (CAST(d_date AS DATE) < CAST('1998-01-01' AS DATE)) THEN cs_sales_price - COALESCE(cr_refunded_cash, 0) ELSE 0 END) AS sales_before, i_item_id, SUM(CASE WHEN (CAST(d_date AS DATE) >= CAST('1998-01-01' AS DATE)) THEN cs_sales_price - COALESCE(cr_refunded_cash, 0) ELSE 0 END) AS sales_after, w_state ...
tpcds
SELECT MIN(mc.note) AS production_note, MIN(t.title) AS movie_title, MIN(t.production_year) AS movie_year FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info_idx AS mi_idx, title AS t WHERE it.id = mi_idx.info_type_id AND (mc.note LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%') AND ct.i...
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 ct.id = mc.company_type_id AND ct.kind = 'production companies' AND mc.movie_id = mi.movie_id AND it.info = 'bottom 10 rank' AND t.id = mi.movie_id AND it.id =...
job
select avg(l_quantity) as avg_qty, sum(l_quantity) as sum_qty, sum(l_extendedprice * (1 - l_discount)) as sum_disc_price, avg(l_extendedprice) as avg_price, sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) as sum_charge, sum(l_extendedprice) as sum_base_price, l_linestatus, l_returnflag, avg(l_discount) as avg_dis...
tpch
select l_orderkey, sum(l_extendedprice * (1 - l_discount)) as revenue, o_orderdate, o_shippriority from customer, orders, lineitem where c_mktsegment = 1 and l_shipdate > DATE 1 and o_orderdate < DATE 1 and l_orderkey = o_orderkey and c_custkey = o_custkey group by l_orderkey, o_orderdate, o_shippriority order by reven...
tpch
Select Min(t.title) As movie_title From keyword As k, movie_info As mi, movie_keyword As mk, title As t Where mi.info In ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Danish', 'Norwegian', 'German') AND t.id = mk.movie_id AND mk.movie_id = mi.movie_id AND t.production_year > 2000 AND k.keyword Like '%sequel%' ...
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(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 Count(*) From comments As c, postHistory As ph, badges As b, votes As v, users As u Where u.Id = b.UserId And ph.PostHistoryTypeId = 12 And v.UserId = c.UserId And b.UserId = ph.UserId And ph.UserId = v.UserId And u.UpVotes = 0 Limit 500;
stats
SELECT AVG(l_extendedprice) AS avg_price, SUM(l_quantity) AS sum_qty, l_linestatus, AVG(l_discount) AS avg_disc, l_returnflag, COUNT(*) AS count_order, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, AVG(l_quantity) AS avg_qty, SUM(l_extendedprice) AS sum_base_price, SUM(l_extendedprice * (1 - l_di...
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 o_orderkey = l_orderkey AND s_supp...
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
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 o_orderkey = l_orderkey AND s_nationkey = n_nationkey AND p_p...
tpch
SELECT i_brand_id AS brand_id, i_brand AS brand, i_manufact_id, i_manufact, SUM(ss_ext_sales_price) AS ext_price 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 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 MIN(t.title) AS movie_title FROM keyword AS k, movie_info AS mi, movie_keyword AS mk, title AS t WHERE mk.movie_id = mi.movie_id AND k.keyword LIKE '%sequel%' AND t.id = mk.movie_id AND t.id = mi.movie_id AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Danish', 'Swedish', 'Danish', 'Norwegian', 'German') AND k.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 mi.movie_id = mc.movie_id AND cn.id = mc.compan...
job
SELECT MIN(t.production_year) AS movie_year, MIN(mc.note) AS production_note, 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.movie_id = mi_idx.movie_id AND t.id = mc.movie_id AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictur...
job
SELECT COUNT(*) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v WHERE p.Id = v.PostId AND p.Id = c.PostId AND c.Score = 0 AND p.FavoriteCount >= 0 AND pl.LinkTypeId = 1 AND p.Id = ph.PostId AND p.Id = pl.PostId
stats
SELECT o_year, SUM( CASE WHEN nation = 1 THEN volume ELSE 0 END ) / SUM(volume) AS mkt_share FROM ( SELECT EXTRACT(YEAR FROM o_orderdate) AS o_year, l_extendedprice * (1 - l_discount) AS volume, n2.n_name AS nation FROM part, supplier, lineitem, orders, customer, nation n1, nation n2, region WHERE l_orderkey = o_orderk...
tpch
SELECT COUNT(*) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v, badges AS b, users AS u WHERE b.UserId = u.Id AND p.Id = ph.PostId AND c.UserId = u.Id AND pl.LinkTypeId = 1 AND p.Score <= 40 AND p.Id = pl.RelatedPostId AND p.Id = v.PostId AND p.Id = c.PostId
stats
SELECT c_custkey, c_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue, c_acctbal, n_name, c_address, c_phone, c_comment FROM customer, orders, lineitem, nation WHERE l_orderkey = o_orderkey AND c_nationkey = n_nationkey AND o_orderdate >= DATE 1 AND l_returnflag = 'R' AND o_orderdate < DATE 1 + INTERVAL '3' MONT...
tpch
SELECT MIN(mi_idx.info) AS rating, MIN(t.title) AS movie_title FROM info_type AS it, movie_info_idx AS mi_idx, title AS t WHERE mi_idx.info > '7.0' AND it.id = mi_idx.info_type_id AND t.production_year BETWEEN 2000 AND 2010 AND t.id = mi_idx.movie_id AND it.info ='rating' LIMIT 100;
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 t.id = mk.movie_id AND mc.company_id = cn.id AND mk.keyword_i...
job
Select Count(*) From comments As c, posts As p, postLinks As pl, votes As v Where p.Score >= -3 And v.VoteTypeId = 2 And c.PostId = pl.PostId And p.Id = c.PostId And pl.PostId = v.PostId And c.CreationDate >= '2010-08-02 23:52:10'::timestamp
stats
SELECT AVG(l_quantity) AS avg_qty, l_returnflag, COUNT(*) AS count_order, SUM(l_extendedprice) AS sum_base_price, AVG(l_discount) AS avg_disc, l_linestatus, AVG(l_extendedprice) AS avg_price, SUM(l_quantity) AS sum_qty, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, SUM(l_extendedprice * (1 - l_di...
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 ci.person_id = an.person_id AND ct.id = mc.company_type_id AN...
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(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(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.company_id = cn.id AND t.episode_nr >= 50 AND ci.movie_id = mk.movie_id AND t.id = mc.mo...
job
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 LIMIT 1000;
tpch
SELECT MIN(t.title) AS american_movie FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info AS mi, title AS t WHERE mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND (mc.note LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%') AND ct.kind = 'production companies' AND mc.movie_id = mi...
job
SELECT c_preferred_cust_flag, cnt, c_last_name, c_salutation, c_first_name, ss_ticket_number 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 CAST(promotions AS DECIMAL(15, 4)) / CAST(total AS DECIMAL(15, 4)) * 100, promotions, total FROM ( SELECT SUM(ss_ext_sales_price) AS promotions FROM store_sales JOIN store ON ss_store_sk = s_store_sk JOIN promotion ON ss_promo_sk = p_promo_sk JOIN date_dim ON ss_sold_date_sk = d_date_sk JOIN customer ON ss_custo...
tpcds
WITH _q AS ( 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 catalog_sales ON cs_item_sk = i_item_sk WHERE d_date BETWEEN CAST('2000-05-01' AS DATE) AND (CAST('2000-05-01' AS DATE) + INTERVAL '60 days') AND inv_quantity_on_...
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 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 k.keyword LIKE '%sequel%' AND k.id = mk.keyword_id AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Danish', 'Swedish', 'Danish', 'Norwegian', 'German') AND mk.movie_id = mi.movie_id...
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.movie_id = mi_idx.movie_id AND t.id = mc.movie_id AND t.id = mi_idx.mov...
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 mk.keyword_id = k.id AND t.id = mk.movie_id AND cn.id = mc.company_id AND cn.country_code ='[nl]' AND mc.movie_id = t.id AND k.keyword ='character-name-IN-title' AND mc.movie_id = mk.mo...
job
SELECT promotions, total, CAST(promotions AS DECIMAL(15, 4)) / CAST(total AS DECIMAL(15, 4)) * 100 FROM ( SELECT SUM(ss_ext_sales_price) AS promotions FROM store_sales JOIN store ON ss_store_sk = s_store_sk JOIN promotion ON ss_promo_sk = p_promo_sk JOIN date_dim ON ss_sold_date_sk = d_date_sk JOIN customer ON ss_custo...
tpcds
SELECT SUM(l_extendedprice * (1 - l_discount)) AS revenue, o_shippriority, o_orderdate, l_orderkey FROM customer, orders, lineitem WHERE l_orderkey = o_orderkey AND c_custkey = o_custkey AND o_orderdate < DATE 1 AND c_mktsegment = 1 AND l_shipdate > DATE 1 GROUP BY l_orderkey, o_orderdate, o_shippriority ORDER BY reven...
tpch
SELECT MIN(k.keyword) AS movie_keyword, MIN(n.name) AS actor_name, MIN(t.title) AS marvel_movie FROM cast_info AS ci, keyword AS k, movie_keyword AS mk, name AS n, title AS t WHERE n.id = ci.person_id AND ci.movie_id = mk.movie_id AND t.id = ci.movie_id AND k.id = mk.keyword_id AND k.keyword = 'marvel-cinematic-univers...
job
SELECT MIN(t.title) AS movie_title FROM company_name AS cn, keyword AS k, movie_companies AS mc, movie_keyword AS mk, title AS t WHERE cn.id = mc.company_id AND mk.keyword_id = k.id AND k.keyword ='character-name-in-title' AND mc.movie_id = mk.movie_id AND mc.movie_id = t.id AND t.id = mk.movie_id AND cn.country_code =...
job
select MAX(t.title) as movie_title from keyword as k, movie_info as mi, movie_keyword as mk, title as t where mi.info = ANY(ARRAY['Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Denish', 'Norwegian', 'German']) AND t.production_year > 2005 AND k.id = mk.keyword_id AND mk.movie_id = mi.movie_id AND t.id = mi.movie...
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 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(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 '%(uncredited)%' AND rt.role = 'actor' AND cn.id = mc.company_id...
job
SELECT n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, supplier, nation, region WHERE c_custkey = o_custkey AND l_orderkey = o_orderkey AND l_suppkey = s_suppkey AND c_nationkey = s_nationkey AND s_nationkey = n_nationkey AND n_regionkey = r_regionkey AND r_name = 1 AND o_ord...
tpch
select p_type, p_brand, count(distinct ps_suppkey) as supplier_cnt, p_size from partsupp, part where p_partkey = ps_partkey and p_brand <> 1 and ps_suppkey not in ( select s_suppkey from supplier where s_comment like '%Customer%Complaints%' ) and p_size in (1, 1, 1, 1, 1, 1, 1, 1) and p_type not like 1 group by p_brand...
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 count(*) from votes as v, posts as p, users as u where p.PostTypeId = 1 AND u.Reputation >= 1 AND v.UserId = u.Id AND v.PostId = p.Id LIMIT 200;
stats
SELECT l_orderkey, o_orderdate, o_shippriority, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem WHERE c_mktsegment = 1 AND o_orderdate < DATE 1 AND l_shipdate > DATE 1 AND l_orderkey = o_orderkey AND c_custkey = o_custkey GROUP BY l_orderkey, o_orderdate, o_shippriority ORDER BY reven...
tpch
SELECT SUM(l_extendedprice * l_discount) AS revenue FROM lineitem WHERE l_shipdate >= DATE 1 AND l_quantity < 1 AND l_discount BETWEEN 1 - 0.01 AND 1 + 0.01 AND l_shipdate < DATE 1 + INTERVAL '1' YEAR LIMIT 500;
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 ct.kind = 'production companies' AND it.info = 'top 250 rank' AND it.id = mi_idx.in...
job
SELECT MIN(k.keyword) AS movie_keyword, MIN(n.name) AS actor_name, MIN(t.title) AS marvel_movie FROM cast_info AS ci, keyword AS k, movie_keyword AS mk, name AS n, title AS t WHERE t.id = ci.movie_id AND n.name LIKE '%Downey%Robert%' AND t.production_year > 2010 AND k.id = mk.keyword_id AND ci.movie_id = mk.movie_id AN...
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(an.name) AS acress_pseudonym, MIN(t.title) AS japanese_anime_movie FROM aka_name AS an, cast_info AS ci, company_name AS cn, company_type AS ct, keyword AS k, movie_companies AS mc, movie_keyword AS mk, name AS n, role_type AS rt, title AS t WHERE t.id = ci.movie_id AND cn.country_code = '[jp]' AND mc.note N...
job
SELECT COUNT(sr_return_quantity) AS store_returns_quantitycount, AVG(ss_quantity) AS store_sales_quantityave, STDDEV_SAMP(cs_quantity) / AVG(cs_quantity) AS catalog_sales_quantitycov, s_state, STDDEV_SAMP(ss_quantity) / AVG(ss_quantity) AS store_sales_quantitycov, STDDEV_SAMP(sr_return_quantity) AS store_returns_quanti...
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 mk.keyword_id = k.id AND mc.movie_id = t.id AND k.keyword ='character-name-IN-title' AND t.id = mk.movie_id AND cn.country_code ='[de]' AND mc.movie_id = mk.mo...
job
SELECT MAX(k.keyword) AS movie_keyword, MAX(n.name) AS actor_name, MAX(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 ci.movie_id = mk.movie_id AND t.id = ci.movie_id AND k.keyword = 'marvel-cinematic-universe' AND n.name LIKE '%Down...
job
select p_type, p_brand, count(distinct ps_suppkey) as supplier_cnt, 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 o_totalprice, SUM(l_quantity), c_custkey, o_orderkey, o_orderdate, c_name FROM customer, orders, lineitem WHERE o_orderkey IN ( SELECT l_orderkey FROM lineitem GROUP BY l_orderkey HAVING SUM(l_quantity) > 1 ) AND c_custkey = o_custkey AND o_orderkey = l_orderkey GROUP BY c_name, c_custkey, o_orderkey, o_orderdat...
tpch
Select 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 k.keyword ='character-name-In-title' 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 ...
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 p_type LIKE 1 AND s_suppkey = ps_suppkey AND p_size = 1 AND p_partkey = ps_partkey AND r_name = 1 AND ps_supplycost = ( SELECT MIN(ps_supplycost) FROM partsupp, supplier, nation, region...
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
WITH year_total AS ( SELECT c_email_address AS customer_email_address, d_year AS dyear, 's' AS sale_type, c_customer_id AS customer_id, c_last_name AS customer_last_name, SUM(((ss_ext_list_price - ss_ext_wholesale_cost - ss_ext_discount_amt) + ss_ext_sales_price) / 2) AS year_total, c_birth_country AS customer_birth_co...
tpcds
SELECT SUM(l_extendedprice * (1 - l_discount)) AS revenue, o_shippriority, l_orderkey, o_orderdate FROM customer, orders, lineitem WHERE l_orderkey = o_orderkey AND o_orderdate < DATE 1 AND c_mktsegment = 1 AND c_custkey = o_custkey AND l_shipdate > DATE 1 GROUP BY l_orderkey, o_orderdate, o_shippriority ORDER BY reven...
tpch
Select Min(t.title) As movie_title From 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.country_code ='[sm]' And k.keyword ='character-name-In-title' And cn.id = mc.company_id And mk.keyword_id = k.id And t.id = mk.movie_id And mc.movie_id = mk.mo...
job
select s_name, count(1) as numwait from supplier, lineitem l1, orders, nation where s_suppkey = l1.l_suppkey and o_orderkey = l1.l_orderkey and o_orderstatus = 'F' and 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 not...
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 o_orderkey = l_orderkey AND l_commitdate < l...
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 ci.movie_id = mc.movie_id AND rt.role = 'actress' AND mc.note...
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.movie_id = mc.movie_id AND cn.id = mc.company_id AND ci.no...
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 = ci.movie_id AND t.id = mc.movie_id AND chn.id = ci.person_role_id AND ...
job
SELECT list_price, bought_city, ca_city, extended_price, extended_tax, ss_ticket_number, c_first_name, c_last_name 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 SUM(l_extendedprice * (1 - l_discount)) AS revenue, n_name FROM customer, orders, lineitem, supplier, nation, region WHERE l_suppkey = s_suppkey AND l_orderkey = o_orderkey AND r_name = 1 AND s_nationkey = n_nationkey AND n_regionkey = r_regionkey AND c_custkey = o_custkey AND o_orderdate < DATE 1 + INTERVAL '1'...
tpch
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 = ph.PostId AND p.Id = pl.PostId AND p.Id = v.PostId AND p.PostTypeId = 1 AND p.Id = c.PostId AND p.AnswerCount >= 0
stats
SELECT MIN(mi.info) AS release_date, MIN(miidx.info) AS rating, MIN(t.title) AS german_movie FROM company_name AS cn, company_type AS ct, info_type AS it, info_type AS it2, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS miidx, title AS t WHERE ct.kind = 'production companies' AND it2.info =...
job
SELECT 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_suppkey = l_suppkey AND ps_pa...
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 ci.movie_id = t.id AND ci.movie_id = mc.movie_id AND mc.note LIKE '%(Japan)%' AND n1.name LIKE '%Yo%' AND cn.co...
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.Id = pl.RelatedPostId AND p.Score <= 40 AND c.UserId = u.Id AND pl.LinkTypeId = 1 AND p.Id = c.PostId AND b.UserId = u.Id AND p.Id = ph.PostId AND p.Id = v.PostId
stats
Select c_custkey, c_name, Sum(l_extendedprice * (1 - l_discount)) As revenue, c_acctbal, n_name, c_address, c_phone, c_comment From customer, orders, lineitem, nation Where c_nationkey = n_nationkey AND c_custkey = o_custkey AND o_orderdate < DATE 1 + INTERVAL '3' MONTH AND l_orderkey = o_orderkey AND l_returnflag = 'R...
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.info < '3.5' AND kt.id = t.kind_id AND it2.id = mi.info_type_id...
job
WITH _q AS ( SELECT COUNT(*) FROM comments AS c, postHistory AS ph, votes AS v, users AS u WHERE u.UpVotes <= 123 ) SELECT * FROM _q AND ph.UserId = c.UserId AND v.UserId = ph.UserId AND u.Views >= 0 AND u.DownVotes >= 0 AND u.Id = v.UserId
stats