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 an.name LIKE '%a%' AND ci.person_id = n.id AND n.name_pcode_cf BETWEEN 'A' AND 'F' AND lt.link = 'features' AND (n.gen...
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 mc.movie_id = mi_idx.movie_id AND (mc.note LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%') AND it...
job
select count(ss_quantity) as store_sales_quantitycount, STDDEV_SAMP(sr_return_quantity) as store_returns_quantitystdev, avg(cs_quantity) as catalog_sales_quantityave, STDDEV_SAMP(cs_quantity) / avg(cs_quantity) as catalog_sales_quantitycov, count(cs_quantity) as catalog_sales_quantitycount, avg(ss_quantity) as store_sa...
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 miidx.movie_id = mc.movie_id AND mc.movie_id = ...
job
SELECT COUNT(ss_quantity) AS store_sales_quantitycount, STDDEV_SAMP(ss_quantity) / AVG(ss_quantity) AS store_sales_quantitycov, STDDEV_SAMP(cs_quantity) / AVG(cs_quantity) AS catalog_sales_quantitycov, STDDEV_SAMP(sr_return_quantity) AS store_returns_quantitystdev, s_state, AVG(ss_quantity) AS store_sales_quantityave, ...
tpcds
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 at.movie_id = mc.movie_id AND it1.info = 'rating...
job
WITH _q AS ( 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.Score <= 40 AND p.Id = c.PostId AND p.Id = pl.RelatedPostId AND pl.LinkTypeId = 1 AND c.UserId = u.Id AND p.Id = v.PostId AND p.Id = ph.PostId ) SELECT * FROM ...
stats
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_size, COUNT(DISTINCT ps_suppkey) AS supplier_cnt, p_type, p_brand FROM partsupp, part WHERE p_size IN (1, 1, 1, 1, 1, 1, 1, 1) AND p_type NOT LIKE 1 AND p_brand != 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 count(*) from comments as c, posts as p, postLinks as pl, votes as v where c.CreationDate >= '2010-08-02 23:52:10'::timestamp and p.Id = c.PostId and p.Score >= -3 and pl.PostId = v.PostId and c.PostId = pl.PostId and v.VoteTypeId = 2
stats
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 cn.id = mc.company_id AND t.id = at.movie_id AND kt.kind = 'movie' AND...
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 t.id = mi_idx.movie_id AND t.id = mc.movie_id AND (mc.note LIKE '%(co-production)%' OR mc.note LIKE '%(pre...
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.episode_nr >= 50 AND an.person_id = n.id AND ci.movie_id = t.id AND ci.movie_id = mk.movi...
job
SELECT ps_partkey, SUM(ps_supplycost * ps_availqty) AS VALUE FROM partsupp, supplier, nation WHERE ps_suppkey = s_suppkey AND n_name = 1 AND s_nationkey = n_nationkey 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 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, l_shipmode from orders, lineitem where l_receiptdate < DATE 1 + INTERVAL '1' YEAR a...
tpch
SELECT s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE n_name = 1 AND o_orderstatus = 'F' 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 o_orderkey = l1.l_orderkey AND NOT EXISTS ( SELECT * FROM ...
tpch
WITH year_total AS ( SELECT c_last_name AS customer_last_name, d_year AS dyear, c_login AS customer_login, c_email_address AS customer_email_address, c_first_name AS customer_first_name, c_preferred_cust_flag AS customer_preferred_cust_flag, SUM(((ss_ext_list_price - ss_ext_wholesale_cost - ss_ext_discount_amt) + ss_ex...
tpcds
SELECT MIN(k.keyword) AS movie_keyword, MIN(n.name) AS actor_name, MIN(t.title) AS marvel_movie FROM cast_info AS ci, keyword AS k, movie_keyword AS mk, name AS n, title AS t WHERE n.name LIKE '%Hemsworth%Chris%' AND k.id = mk.keyword_id AND t.production_year > 2010 AND t.id = mk.movie_id AND t.id = ci.movie_id AND k.k...
job
SELECT MIN(t.title) AS movie_title FROM company_name AS cn, keyword AS k, movie_companies AS mc, movie_keyword AS mk, title AS t WHERE cn.country_code ='[de]' AND mk.keyword_id = k.id AND cn.id = mc.company_id AND t.id = mk.movie_id AND mc.movie_id = t.id AND mc.movie_id = mk.movie_id AND k.keyword ='character-name-in-...
job
SELECT MAX(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 cn.id = mc.company_id AND t.id = mk.movie_id AND k.keyword ='character-name-IN-title' AND mk.keyword_id = k.id AND cn.country_code ='[nl]' AND mc.movie_id ...
job
SELECT MIN(chn.name) AS uncredited_voiced_character, MIN(t.title) AS russian_movie FROM char_name AS chn, cast_info AS ci, company_name AS cn, company_type AS ct, movie_companies AS mc, role_type AS rt, title AS t WHERE t.id = ci.movie_id AND ci.note LIKE '%(uncredited)%' AND t.id = mc.movie_id AND rt.id = ci.role_id A...
job
WITH year_total AS ( SELECT SUM(((ss_ext_list_price - ss_ext_wholesale_cost - ss_ext_discount_amt) + ss_ext_sales_price) / 2) AS year_total, c_first_name AS customer_first_name, c_birth_country AS customer_birth_country, d_year AS dyear, c_last_name AS customer_last_name, 's' AS sale_type, c_preferred_cust_flag AS cust...
tpcds
SELECT MIN(t.title) AS movie_title FROM keyword AS k, movie_info AS mi, movie_keyword AS mk, title AS t WHERE t.id = mk.movie_id AND k.keyword LIKE '%sequel%' AND k.id = mk.keyword_id AND mk.movie_id = mi.movie_id AND mi.info = ANY(ARRAY['Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Danish', 'Norwegian', 'Germa...
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(mc.note) AS production_note, MIN(t.title) AS movie_title, MIN(t.production_year) AS movie_year FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info_idx AS mi_idx, title AS t WHERE mc.movie_id = mi_idx.movie_id AND ct.id = mc.company_type_id AND ct.kind = 'production companies' AND (mc....
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.id = mc.company_type_id AND it.info = 'top 250 rank' AND t.id = mi_idx.movie_id AND (mc.note LIKE '%(co...
job
SELECT cc_name AS call_center_name, cc_call_center_id AS call_center, cc_manager AS manager, SUM(cr_net_loss) AS returns_loss FROM call_center JOIN catalog_returns ON cr_call_center_sk = cc_call_center_sk JOIN date_dim ON cr_returned_date_sk = d_date_sk JOIN customer ON cr_returning_customer_sk = c_customer_sk JOIN cus...
tpcds
SELECT MIN(miidx.info) AS rating, MIN(mi.info) AS release_date, 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 mi.movie_id = miidx.movi...
job
select min(t.title) as movie_title from company_name as cn, keyword as k, movie_companies as mc, movie_keyword as mk, title as t where cn.country_code ='[sm]' AND mk.keyword_id = k.id AND t.id = mk.movie_id AND mc.movie_id = t.id AND mc.movie_id = mk.movie_id AND k.keyword ='character-name-in-title' AND cn.id = mc.comp...
job
SELECT c_salutation, c_last_name, cnt, 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
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 k.id = mk.keyword_id AND t.id = mk.movie_id AND n.id = ci.person_id AND k.keyword = 'marvel-cinematic-universe' AND t.id = ci.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(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(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 ci.movie_id = ml.linked_movie_id AND lt.link = 'features' AND ml.linked_movie_id = t.id AND an.person_id = ci.person_i...
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(t.title) AS american_movie FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info AS mi, title AS t WHERE it.info = 'bottom 10 rank' AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND t.id = mc.movie_id AND it.id = mi.info_type_id AND ct.kind = 'production companies' AND ct.i...
job
SELECT MIN(t.title) AS movie_title FROM company_name AS cn, keyword AS k, movie_companies AS mc, movie_keyword AS mk, title AS t WHERE k.keyword ='character-name-in-title' AND t.id = mk.movie_id AND mk.keyword_id = k.id AND mc.movie_id = t.id AND cn.id = mc.company_id AND mc.movie_id = mk.movie_id AND cn.country_code =...
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 c.Score = 0 AND p.Id = c.PostId AND p.Id = pl.RelatedPostId AND pl.LinkTypeId = 1 AND p.Id = ph.PostId
stats
SELECT s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE EXISTS ( SELECT * FROM lineitem l2 WHERE l2.l_orderkey = l1.l_orderkey AND l2.l_suppkey <> l1.l_suppkey ) AND n_name = 1 AND o_orderkey = l1.l_orderkey AND s_nationkey = n_nationkey AND l1.l_receiptdate > l1.l_commitdate AND o_orderstat...
tpch
WITH _q AS ( 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 mc.movie_id = t.id AND t.id = mk.movie_id AND cn.id = mc.company_id AND k.keyword ='character-name-in-title' AND mc.movie_id = mk.movie_id ) SELECT...
job
SELECT s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE EXISTS ( SELECT * FROM lineitem l2 WHERE l2.l_orderkey = l1.l_orderkey AND l2.l_suppkey <> l1.l_suppkey ) AND o_orderkey = l1.l_orderkey AND s_nationkey = n_nationkey AND l1.l_receiptdate > l1.l_commitdate AND s_suppkey = l1.l_suppkey A...
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 o_orderkey = l_orderkey AND s_suppkey = l_suppkey AND ps_supp...
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_commitdate < l_receiptdate AND l_shipmode ...
tpch
SELECT promotions, total, CAST(promotions AS DECIMAL(15, 4)) / CAST(total AS DECIMAL(15, 4)) * 100 FROM ( SELECT SUM(ss_ext_sales_price) AS promotions FROM store_sales JOIN store ON ss_store_sk = s_store_sk JOIN promotion ON ss_promo_sk = p_promo_sk JOIN date_dim ON ss_sold_date_sk = d_date_sk JOIN customer ON ss_custo...
tpcds
select n_name, sum(l_extendedprice * (1 - l_discount)) as revenue from customer, orders, lineitem, supplier, nation, region where c_custkey = o_custkey AND c_nationkey = s_nationkey AND l_orderkey = o_orderkey AND o_orderdate < DATE 1 + INTERVAL '1' YEAR AND s_nationkey = n_nationkey AND n_regionkey = r_regionkey AND o...
tpch
SELECT n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, supplier, nation, region WHERE r_name = 1 AND o_orderdate >= DATE 1 AND c_nationkey = s_nationkey AND c_custkey = o_custkey AND o_orderdate < DATE 1 + INTERVAL '1' YEAR AND l_orderkey = o_orderkey AND l_suppkey = s_suppke...
tpch
SELECT c_address, c_comment, c_acctbal, c_custkey, c_name, n_name, c_phone, SUM(l_extendedprice * (1 - l_discount)) AS revenue 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 american_movie FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info AS mi, title AS t WHERE ct.id = mc.company_type_id AND it.info = 'bottom 10 rank' AND t.id = mi.movie_id AND it.id = mi.info_type_id AND mc.movie_id = mi.movie_id AND mc.note NOT LIKE '%(as Metro-Goldwyn-Ma...
job
SELECT s_store_name, SUM(ss_quantity) AS store_sales_quantity, SUM(cs_quantity) AS catalog_sales_quantity, i_item_id, s_store_id, SUM(sr_return_quantity) AS store_returns_quantity, i_item_desc FROM store_sales INNER JOIN store_returns ON ss_customer_sk = sr_customer_sk AND ss_item_sk = sr_item_sk AND ss_ticket_number =...
tpcds
select min(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 mc.company_id = cn.id and ci.note = '(voice: English version)' and rt.role = 'actress' and an1.person_id = ci.p...
job
SELECT i_item_id, i_item_desc, s_store_id, s_store_name, MIN(ss_net_profit) AS store_sales_profit, MIN(sr_net_loss) AS store_returns_loss, MIN(cs_net_profit) AS catalog_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(DISTINCT ps_suppkey) AS supplier_cnt, p_type, p_size, p_brand FROM partsupp, part WHERE p_size IN (1, 1, 1, 1, 1, 1, 1, 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%' ) AND p_brand <> 1 GROUP BY p_brand...
tpch
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 i_manufact_id = ANY(ARRAY[211, 362, 413, 88]) AND inv_quantity_on_hand BETWEEN 100 AND 500 AND d_date BETWEEN C...
tpcds
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 = mc.movie_id and n1.name like '%Yo%' and ci.role_id = rt.id and mc.company_id = cn.id and rt.role ...
job
SELECT SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, l_linestatus, COUNT(1) AS count_order, SUM(l_quantity) AS sum_qty, AVG(l_quantity) AS avg_qty, SUM(l_extendedprice) AS sum_base_price, l_returnflag, AVG(l_extendedprice) AS avg_price, AVG(l_discount) AS avg_disc, SUM(l_extendedprice * (1 - l_discount) * ...
tpch
select cntrycode, count(*) as numcust, sum(c_acctbal) as totacctbal from ( select SUBSTRING(c_phone from 1 FOR 2) as cntrycode, c_acctbal from customer where not exists ( select * from orders where o_custkey = c_custkey ) ) as custsale AND SUBSTRING(c_phone from 1 FOR 2) in (1, 1, 1, 1, 1, 1, 1) AND c_acctbal > ( selec...
tpch
SELECT o_year, nation, SUM(amount) AS sum_profit FROM ( SELECT n_name AS nation, EXTRACT(YEAR FROM o_orderdate) AS o_year, l_extendedprice * (1 - l_discount) - ps_supplycost * l_quantity AS amount FROM part, supplier, lineitem, partsupp, orders, nation WHERE ps_partkey = l_partkey AND p_name LIKE 1 ) AS profit AND o_or...
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 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 it.id = mi_idx.info_type_id AND it.info = 'top 250 rank' AND ct.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.id = mc.company_id AND k.keyword ='character-name-in-title' AND mk.keyword_id = k.id AND t.id = mk.movie_id AND cn.country_code =...
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(mc.note) AS production_note, MIN(t.title) AS movie_title, MIN(t.production_year) AS movie_year FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info_idx AS mi_idx, title AS t WHERE mc.movie_id = mi_idx.movie_id AND t.id = mi_idx.movie_id AND ct.kind = 'production companies' AND it.id = ...
job
select min(k.keyword) as movie_keyword, min(n.name) as actor_name, min(t.title) as marvel_movie from cast_info as ci, keyword as k, movie_keyword as mk, name as n, title as t where t.production_year > 2010 AND 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.keywor...
job
SELECT SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, l_linestatus, COUNT(*) AS count_order, AVG(l_quantity) AS avg_qty, SUM(l_extendedprice) AS sum_base_price, AVG(l_discount) AS avg_disc, l_returnflag, SUM(l_quantity) AS sum_qty, AVG(l_extendedprice) AS avg_price, SUM(l_extendedprice * (1 - l_discount) * ...
tpch
SELECT MIN(an.name) AS cool_actor_pseudonym, MIN(t.title) AS series_named_after_char FROM aka_name AS an, cast_info AS ci, company_name AS cn, keyword AS k, movie_companies AS mc, movie_keyword AS mk, name AS n, title AS t WHERE ci.movie_id = mk.movie_id AND ci.movie_id = mc.movie_id AND n.id = ci.person_id AND t.id = ...
job
select l_year, cust_nation, sum(volume) as revenue, supp_nation from ( select n1.n_name as supp_nation, n2.n_name as cust_nation, EXTRACT(YEAR from l_shipdate) as l_year, l_extendedprice * (1 - l_discount) as volume from supplier, lineitem, orders, customer, nation n1, nation n2 where s_suppkey = l_suppkey and o_orderk...
tpch
WITH year_total AS ( SELECT c_email_address AS customer_email_address, c_customer_id AS customer_id, c_login AS customer_login, c_last_name AS customer_last_name, 's' AS sale_type, c_birth_country AS customer_birth_country, d_year AS dyear, c_first_name AS customer_first_name, c_preferred_cust_flag AS customer_preferre...
tpcds
SELECT MAX(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 k.keyword ='character-name-in-title' AND mc.movie_id = mk.movie_id AND cn.country_code ='[nl]' AND mc.movie_id = t.id AND cn.id = mc.company_id AND t.id = mk.mo...
job
with _q as ( select count(*) from posts as p, postLinks as pl, users as u where p.Id = pl.PostId AND p.CommentCount <= 17 AND u.CreationDate <= '2014-09-12 07:12:16'::timestamp ) select * from _q AND p.OwnerUserId = u.Id
stats
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 pl.LinkTypeId = 1 AND p.Id = ph.PostId AND p.Id = v.PostId AND p.Id = c.PostId AND p.Score <= 40 AND c.UserId = u.Id AND b.UserId = u.Id AND p.Id = pl.RelatedPostId
stats
select min(t.title) as movie_title from keyword as k, movie_info as mi, movie_keyword as mk, title as t where t.id = mk.movie_id and k.id = mk.keyword_id and mi.info in ('Sweden', 'Norway', 'Germany', 'Danish', 'Swedish', 'Danish', 'Norwegian', 'German') and t.production_year > 2010 and t.id = mi.movie_id and mk.movie_...
job
select min(t.title) as russian_movie, min(chn.name) as uncredited_voiced_character from char_name as chn, cast_info as ci, company_name as cn, company_type as ct, movie_companies as mc, role_type as rt, title as t where ci.note like '%(voice)%' and chn.id = ci.person_role_id and t.production_year > 2005 and ci.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 INNER JOIN store ON s_store_sk = ss_store_sk INNER JOIN customer_demographics ON cd_demo_sk = ss_cdemo_sk INNER JOIN household_demographics ON hd_demo_sk = ss_hdemo_sk INNER JOIN customer_address ON...
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 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' AS DATE) + INTERVAL...
tpcds
SELECT s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE l1.l_receiptdate > l1.l_commitdate AND s_suppkey = l1.l_suppkey 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 o_orderstatus = 'F' AND n_na...
tpch
SELECT n_name, s_phone, s_address, s_comment, p_partkey, s_name, s_acctbal, p_mfgr 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(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 ml.movie_id = mk.movie_id and t.pro...
job
select min(t.title) as movie_title from company_name as cn, keyword as k, movie_companies as mc, movie_keyword as mk, title as t where cn.country_code ='[de]' and mc.movie_id = t.id and mk.keyword_id = k.id and mc.movie_id = mk.movie_id and t.id = mk.movie_id and k.keyword ='character-name-in-title' and cn.id = mc.comp...
job
SELECT COUNT(*) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v, users AS u WHERE p.Id = ph.PostId AND p.PostTypeId = 1 AND p.AnswerCount >= 0 AND u.Id = p.OwnerUserId AND p.Id = pl.PostId AND p.Id = v.PostId AND p.Id = c.PostId LIMIT 200;
stats
SELECT MIN(mc.note) AS production_note, MIN(t.title) AS movie_title, MIN(t.production_year) AS movie_year FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info_idx AS mi_idx, title AS t WHERE ct.kind = 'production companies' AND ct.id = mc.company_type_id AND mc.movie_id = mi_idx.movie_id AND t.id...
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 i_manufact, i_brand AS brand, i_brand_id AS brand_id, 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 c_acctbal, c_comment, n_name, c_phone, c_custkey, c_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue, c_address FROM customer, orders, lineitem, nation WHERE l_orderkey = o_orderkey AND c_custkey = o_custkey AND c_nationkey = n_nationkey AND l_returnflag = 'R' AND o_orderdate >= DATE 1 AND o_orderdate < ...
tpch
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 s_suppkey, s_name, s_address, s_phone, total_revenue from supplier, revenue0 where s_suppkey = supplier_no AND total_revenue = ( select max(total_revenue) from revenue0 ) order by s_suppkey LIMIT 1000;
tpch
SELECT MIN(cn.name) AS from_company, MIN(lt.link) AS link_type, MIN(t.title) AS western_sequel FROM company_name AS cn, company_type AS ct, info_type AS it, keyword AS k, link_type AS lt, movie_companies AS mc, movie_info AS mi, movie_keyword AS mk, movie_link AS ml, title AS t WHERE mc.note LIKE '%(USA)%' AND ct.id = ...
job
select c_first_name, c_preferred_cust_flag, ss_ticket_number, c_salutation, c_last_name, 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(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.production_year > 2010 AND t.id = ci.movie_id AND k.keyword = 'marvel-cinematic-universe' AND k.id = mk.keyword_id AND n.name LIKE '%Down...
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 k.keyword = 'marvel-cinematic-universe' AND t.production_year > 2010 AND n.id = ci.person_id AND k.id = m...
job
SELECT l_shipmode, SUM( CASE WHEN o_orderpriority = '1-URGENT' OR o_orderpriority = '2-HIGH' THEN 1 ELSE 0 END ) AS high_line_count, SUM( CASE WHEN o_orderpriority != '1-URGENT' AND o_orderpriority != '2-HIGH' THEN 1 ELSE 0 END ) AS low_line_count FROM orders, lineitem WHERE l_shipmode IN (1, 1) AND o_orderkey = l_orde...
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 p_size = 1 AND p_type LIKE 1 AND p_partkey = ps_partkey AND s_nationkey = n_nationkey AND s_suppkey = ps_suppkey AND ps_supplycost = ( SELECT MIN(ps_supply...
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 t.production_year > 2000 AND t.id = mi.movie_id AND t.id = mk.movie_id AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Danish', 'Norw...
job
SELECT c_comment, c_name, n_name, c_custkey, c_address, c_acctbal, c_phone, SUM(l_extendedprice * (1 - l_discount)) AS revenue 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 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.PostTypeId = 1 and p.Id = ph.PostId and p.Id = c.PostId and p.Id = v.PostId and p.AnswerCount >= 0 and p.Id = pl.PostId
stats
SELECT l_shipmode, SUM( CASE WHEN o_orderpriority = '1-URGENT' OR o_orderpriority = '2-HIGH' THEN 1 ELSE 0 END ) AS high_line_count, SUM( CASE WHEN o_orderpriority <> '1-URGENT' AND o_orderpriority <> '2-HIGH' THEN 1 ELSE 0 END ) AS low_line_count FROM orders, lineitem WHERE l_receiptdate >= DATE 1 AND l_receiptdate < ...
tpch
SELECT COUNT(ss_quantity) AS store_sales_quantitycount, AVG(cs_quantity) AS catalog_sales_quantityave, STDDEV_SAMP(sr_return_quantity) / AVG(sr_return_quantity) AS store_returns_quantitycov, i_item_id, STDDEV_SAMP(ss_quantity) / AVG(ss_quantity) AS store_sales_quantitycov, i_item_desc, s_state, AVG(sr_return_quantity) ...
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 cn.id = mc.company_id AND kt.kind = 'movie' AND...
job
WITH year_total AS ( SELECT '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_total, c_last_name AS customer_last_name, c_preferred_cust_flag AS customer_preferred_cust_flag, c_email_address AS customer_email_address, c...
tpcds
SELECT o_orderdate, c_custkey, SUM(l_quantity), o_totalprice, o_orderkey, 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 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 LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%') AND ct.id = mc.company_type_id AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND t.id = mi.movie_id AND...
job