text
stringlengths
84
1.49k
benchmark
stringclasses
4 values
Select Max(ss_net_profit) As store_sales_profit, i_item_desc, s_store_id, s_store_name, Max(sr_net_loss) As store_returns_loss, i_item_id, Max(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 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.person_id = ci.person_id AND ci.person_id = n.id AND an.name LIKE '%a%' AND ci.movie_id = ml.linked_movie_id AND pi...
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 rt.role = 'actress' AND it.info = 'release dates' AND cn.country_code = '...
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 AVG(cs_quantity) AS catalog_sales_quantityave, i_item_id, COUNT(sr_return_quantity) AS store_returns_quantitycount, STDDEV_SAMP(ss_quantity) AS store_sales_quantitystdev, AVG(ss_quantity) AS store_sales_quantityave, STDDEV_SAMP(cs_quantity) / AVG(cs_quantity) AS catalog_sales_quantitycov, STDDEV_SAMP(sr_return_q...
tpcds
WITH year_total AS ( SELECT c_last_name AS customer_last_name, 's' AS sale_type, c_customer_id AS customer_id, c_email_address AS customer_email_address, c_first_name AS customer_first_name, c_login AS customer_login, SUM(((ss_ext_list_price - ss_ext_wholesale_cost - ss_ext_discount_amt) + ss_ext_sales_price) / 2) AS y...
tpcds
Select s_address, s_phone, total_revenue, s_suppkey, s_name From supplier, revenue0 Where s_suppkey = supplier_no AND total_revenue = ( Select Max(total_revenue) From revenue0 ) Order By s_suppkey
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 STDDEV_SAMP(ss_quantity) / AVG(ss_quantity) AS store_sales_quantitycov, AVG(cs_quantity) AS catalog_sales_quantityave, i_item_desc, COUNT(cs_quantity) AS catalog_sales_quantitycount, STDDEV_SAMP(sr_return_quantity) AS store_returns_quantitystdev, s_state, STDDEV_SAMP(sr_return_quantity) / AVG(sr_return_quantity)...
tpcds
SELECT nation, o_year, SUM(amount) AS sum_profit FROM ( SELECT n_name AS nation, EXTRACT(YEAR FROM o_orderdate) AS o_year, l_extendedprice * (1 - l_discount) - ps_supplycost * l_quantity AS amount FROM part, supplier, lineitem, partsupp, orders, nation WHERE o_orderkey = l_orderkey AND s_suppkey = l_suppkey AND ps_part...
tpch
SELECT s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE 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_receiptdate > l3.l_commitdate ) AND l1.l_receiptdate > l1.l_commitdate AND o_orderkey = l1...
tpch
SELECT o_orderpriority, COUNT(*) AS order_count FROM orders WHERE o_orderdate >= DATE 1 AND o_orderdate < DATE 1 + INTERVAL '3' MONTH AND EXISTS ( SELECT * FROM lineitem WHERE l_orderkey = o_orderkey AND l_commitdate < l_receiptdate ) GROUP BY o_orderpriority ORDER BY o_orderpriority LIMIT 200;
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 it.id = mi_idx.info_type_id AND t.id = mi_idx.movie_id AND mi_idx.info > '7.0' AND t.production_year BETWEEN 2000 AND 2010 AND it.info ='rating' LIMIT 10;
job
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 = ph.PostId AND p.Id = v.PostId AND pl.LinkTypeId = 1 AND p.Score <= 40 AND b.UserId = u.Id AND c.UserId = u.Id AND p.Id = c.PostId AND p.Id = pl.RelatedPostId
stats
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.note NOT LIKE '%(USA)%' AND ci.movie_id = mc.movie_id AND ci.role_id = rt.id AND ci.note = '(voice: English ...
job
SELECT SUM( CASE WHEN nation = 1 THEN volume ELSE 0 END ) / SUM(volume) AS mkt_share, o_year 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 p_type = 1 ) AS all_n...
tpch
SELECT COUNT(1) FROM comments AS c, postHistory AS ph, votes AS v, users AS u WHERE u.Views >= 0 AND ph.UserId = c.UserId AND v.UserId = ph.UserId AND u.UpVotes <= 123 AND u.DownVotes >= 0 AND u.Id = v.UserId LIMIT 20;
stats
SELECT nation, o_year, SUM(amount) AS sum_profit FROM ( SELECT n_name AS nation, EXTRACT(YEAR FROM o_orderdate) AS o_year, l_extendedprice * (1 - l_discount) - ps_supplycost * l_quantity AS amount FROM part, supplier, lineitem, partsupp, orders, nation WHERE s_nationkey = n_nationkey AND p_partkey = l_partkey AND s_sup...
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 k.id = mk.keyword_id AND ci.person_id = an.person_id AND k.ke...
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
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 it2.id = mi.info_type_id...
job
SELECT p_brand, p_type, p_size, COUNT(DISTINCT ps_suppkey) AS supplier_cnt FROM partsupp, part WHERE p_type NOT LIKE 1 AND p_brand <> 1 AND p_partkey = ps_partkey AND p_size IN (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 BY p_brand...
tpch
SELECT MIN(n.name) AS actor_name, MIN(t.title) AS marvel_movie, MIN(k.keyword) AS movie_keyword 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 t.production_year > 2010 AND t.id = mk.movie_id AND k.keyword = 'marvel-cinematic-universe' AND k.id = ...
job
SELECT COUNT(1) FROM comments AS c, posts AS p, postHistory AS ph, votes AS v, users AS u WHERE u.Id = c.UserId AND ph.UserId = v.UserId AND p.OwnerUserId = ph.UserId AND p.AnswerCount >= 0 AND p.Score <= 13 AND c.UserId = p.OwnerUserId LIMIT 100;
stats
SELECT i_item_id, i_current_price, i_item_desc 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 73 AND 73 + 30 AND d_date BETWEEN CAST('1998-01-15' AS DATE) AND (CAST('1998-01-15' AS DATE) + INTERVAL '60...
tpcds
Select i_current_price, i_item_id, i_item_desc 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 (301, 227, 392, 436) AND d_date BETWEEN CAST('2002-01-23' As DATE) AND (CAST('2002-01-23' As DATE) + INTERVAL '60 ...
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 an.person_id = ci.person_id AND t.production_year BETWEEN 1980 AND 1995 AND n.id = an.person_id AND pi.person_id = an....
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 o_orderkey = l_orderkey AND l_commitdate < l...
tpch
SELECT SUM(ss_ext_wholesale_cost), AVG(ss_quantity), AVG(ss_ext_sales_price), AVG(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 STDDEV_SAMP(cs_quantity) / AVG(cs_quantity) AS catalog_sales_quantitycov, i_item_id, STDDEV_SAMP(ss_quantity) / AVG(ss_quantity) AS store_sales_quantitycov, STDDEV_SAMP(sr_return_quantity) / AVG(sr_return_quantity) AS store_returns_quantitycov, COUNT(cs_quantity) AS catalog_sales_quantitycount, i_item_desc, STDD...
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 ct.kind = 'production companies' AND (mc.note LIKE '%(co-production)%' OR ...
job
select min(t.title) as movie_title from keyword as k, movie_info as mi, movie_keyword as mk, title as t where t.id = mk.movie_id and mk.movie_id = mi.movie_id and t.id = mi.movie_id and mi.info = ANY(ARRAY['Sweden', 'Norway', 'Germany', 'Danish', 'Swedish', 'Danish', 'Norwegian', 'German']) and k.id = mk.keyword_id and...
job
SELECT c_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue, c_acctbal, c_phone, c_comment, n_name, c_custkey, c_address 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(k.keyword) As movie_keyword, Min(n.name) As actor_name, Min(t.title) As marvel_movie From cast_info As ci, keyword As k, movie_keyword As mk, name As n, title As t Where k.keyword = 'marvel-cinematic-universe' And t.id = mk.movie_id And k.id = mk.keyword_id And n.id = ci.person_id And n.name Like '%Downey%Ro...
job
SELECT SUM( CASE WHEN o_orderpriority <> '1-URGENT' AND o_orderpriority <> '2-HIGH' THEN 1 ELSE 0 END ) AS low_line_count, l_shipmode, 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 o_orderkey = l_orderkey AND l_receiptdate >=...
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 t.episode_nr >= 50 AND an.person_id = ci.person_id AND k.keyword = 'character-name-in-title...
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 cn.country_code ='[nl]' AND 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.mo...
job
SELECT MIN(mi_idx.info) AS rating, MIN(t.title) AS movie_title FROM info_type AS it, movie_info_idx AS mi_idx, title AS t WHERE t.id = mi_idx.movie_id AND it.id = mi_idx.info_type_id AND it.info ='rating' AND t.production_year BETWEEN 2000 AND 2010 AND mi_idx.info > '7.0' LIMIT 500;
job
Select s_address, s_suppkey, total_revenue, s_name, s_phone From supplier, revenue0 Where s_suppkey = supplier_no And total_revenue = ( Select Max(total_revenue) From revenue0 ) Order By s_suppkey
tpch
Select Count(*) From comments As c, posts As p, postLinks As pl, postHistory As ph, votes As v, users As u Where p.Id = c.PostId And p.Id = pl.PostId And p.Id = v.PostId And p.AnswerCount >= 0 And p.Id = ph.PostId And u.Id = p.OwnerUserId And p.PostTypeId = 1 LIMIT 1000;
stats
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 s_suppkey = l_suppkey AND c_custke...
tpch
SELECT nation, o_year, SUM(amount) AS sum_profit FROM ( SELECT n_name AS nation, EXTRACT(YEAR FROM o_orderdate) AS o_year, l_extendedprice * (1 - l_discount) - ps_supplycost * l_quantity AS amount FROM part, supplier, lineitem, partsupp, orders, nation WHERE s_suppkey = l_suppkey AND p_partkey = l_partkey AND p_name LI...
tpch
SELECT MIN(mi_idx.info) AS rating, MIN(t.title) AS northamerican_movie FROM aka_title AS at, company_name AS cn, info_type AS it1, info_type AS it2, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS mi_idx, title AS t WHERE t.id = mi_idx.movie_id AND it2.info = 'release dates' AND cn.id = mc.c...
job
SELECT MIN(t.title) AS series_named_after_char, MIN(an.name) AS cool_actor_pseudonym FROM aka_name AS an, cast_info AS ci, company_name AS cn, keyword AS k, movie_companies AS mc, movie_keyword AS mk, name AS n, title AS t WHERE t.id = mc.movie_id AND an.person_id = n.id AND t.id = mk.movie_id AND ci.movie_id = t.id AN...
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 ps_partkey = l_partkey AND p_partkey = l_partkey AND s_suppke...
tpch
SELECT MIN(mi_idx.info) AS rating, MIN(t.title) AS western_violent_movie, 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 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 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 it.id = miidx.info_type_id AND kt.kind = 'movie...
job
Select dt.d_year, item.i_brand_id As brand_id, item.i_brand As brand, Sum(ss_ext_sales_price) As ext_price From date_dim As dt Join store_sales On dt.d_date_sk = store_sales.ss_sold_date_sk Join item On store_sales.ss_item_sk = item.i_item_sk Where dt.d_moy = 11 And dt.d_year = 1999 And item.i_manager_id = 67 Group By ...
tpcds
select s_comment, s_name, n_name, p_mfgr, s_address, s_phone, p_partkey, s_acctbal 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 cn.id = mc.company_id AND ct.id = m...
job
SELECT AVG(ss_coupon_amt) AS agg3, AVG(ss_quantity) AS agg1, AVG(ss_list_price) AS agg2, i_item_id, AVG(ss_sales_price) AS agg4 FROM store_sales JOIN customer_demographics ON ss_cdemo_sk = cd_demo_sk JOIN date_dim ON ss_sold_date_sk = d_date_sk JOIN item ON ss_item_sk = i_item_sk JOIN promotion ON ss_promo_sk = p_promo...
tpcds
SELECT 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 SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, COUNT(*) AS count_order, l_returnflag, SUM(l_quantity) AS sum_qty, AVG(l_quantity) AS avg_qty, AVG(l_discount) AS avg_disc, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, l_linestatus, SUM(l_extendedprice) AS sum_base_price, AVG(l_e...
tpch
SELECT l_orderkey, o_shippriority, SUM(l_extendedprice * (1 - l_discount)) AS revenue, o_orderdate FROM customer, orders, lineitem WHERE l_orderkey = o_orderkey AND c_custkey = o_custkey AND l_shipdate > DATE 1 AND o_orderdate < DATE 1 AND c_mktsegment = 1 GROUP BY l_orderkey, o_orderdate, o_shippriority ORDER BY reven...
tpch
Select Count(1) From comments As c, postHistory As ph, votes As v, users As u Where u.Id = v.UserId And ph.UserId = c.UserId And v.UserId = ph.UserId And u.Views >= 0 And u.DownVotes >= 0 And u.UpVotes <= 123
stats
SELECT COUNT(*) FROM comments AS c, posts AS p, postHistory AS ph, votes AS v, users AS u WHERE c.UserId = p.OwnerUserId AND u.Id = c.UserId AND p.OwnerUserId = ph.UserId AND ph.UserId = v.UserId AND p.Score <= 13 AND p.AnswerCount >= 0 LIMIT 200;
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 p.Id = pl.RelatedPostId AND p.Id = c.PostId AND p.Score <= 40 AND c.UserId = u.Id AND b.UserId = u.Id AND pl.LinkTypeId = 1 AND p.Id = ph.PostId AND p.Id = v.PostId
stats
Select i_brand As brand, Sum(ss_ext_sales_price) As ext_price, i_brand_id As brand_id, i_manufact, 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 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.Score <= 192 and p.ViewCount >= 0 and p.Id = v.PostId and p.Id = ph.PostId and p.Id = c.PostId and u.Id = p.OwnerUserId
stats
SELECT ps_partkey, SUM(ps_supplycost * ps_availqty) AS VALUE FROM partsupp, supplier, nation WHERE s_nationkey = n_nationkey AND n_name = 1 AND ps_suppkey = s_suppkey 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 Count(*) From comments As c, postHistory As ph, votes As v, users As u Where u.Id = v.UserId AND u.DownVotes >= 0 AND u.Views >= 0 AND ph.UserId = c.UserId AND u.UpVotes <= 123 AND v.UserId = ph.UserId Limit 50;
stats
SELECT MIN(n.name) AS of_person, MIN(t.title) AS biography_movie FROM aka_name AS an, cast_info AS ci, info_type AS it, link_type AS lt, movie_link AS ml, name AS n, person_info AS pi, title AS t WHERE an.person_id = ci.person_id AND lt.link = 'features' AND ml.linked_movie_id = t.id AND pi.note = 'Volker Boehm' AND lt...
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(k.keyword) AS movie_keyword, MIN(n.name) AS actor_name, MIN(t.title) AS marvel_movie FROM cast_info AS ci, keyword AS k, movie_keyword AS mk, name AS n, title AS t WHERE n.id = ci.person_id AND k.keyword = 'marvel-cinematic-universe' AND n.name LIKE '%Downey%Robert%' AND ci.movie_id = mk.movie_id AND k.id = ...
job
WITH _q AS ( SELECT MIN(k.keyword) AS movie_keyword, MIN(n.name) AS actor_name, MIN(t.title) AS marvel_movie FROM cast_info AS ci, keyword AS k, movie_keyword AS mk, name AS n, title AS t WHERE n.name LIKE '%Hemsworth%Chris%' AND n.id = ci.person_id AND k.keyword = 'marvel-cinematic-universe' AND k.id = mk.keyword_id A...
job
select s_name, count(*) as numwait from supplier, lineitem l1, orders, nation where l1.l_receiptdate > l1.l_commitdate 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 n_name = 1 AND not exists ( select * from lineitem l3 wh...
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 n1.id = ci.person_id AND an1.person_id = n1.id AND cn.country_code = '[jp]' AND mc.note NOT LIKE '%(USA)%' AND ...
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 an.person_id = n.id AND mi.movie_id = ci.movie_id AND t.id = ci.movie_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 p_type, p_size, p_brand, COUNT(DISTINCT ps_suppkey) AS supplier_cnt FROM partsupp, part WHERE ps_suppkey NOT IN ( SELECT s_suppkey FROM supplier WHERE s_comment LIKE '%Customer%Complaints%' ) AND p_partkey = ps_partkey AND p_type NOT LIKE 1 AND p_brand <> 1 AND p_size IN (1, 1, 1, 1, 1, 1, 1, 1) GROUP BY p_brand...
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 k.keyword ='character-name-in-title' AND t.id = mk.movie_id AND cn.id = mc.company_id AND mc.movie_id = mk.movie_id ) SELECT * FROM _q AND mk.keyword_id = k.id AND cn.count...
job
SELECT COUNT(*) FROM comments AS c, posts AS p, postLinks AS pl, votes AS v WHERE p.Score >= -3 AND c.CreationDate >= '2010-08-02 23:52:10'::timestamp AND c.PostId = pl.PostId AND pl.PostId = v.PostId AND v.VoteTypeId = 2 AND p.Id = c.PostId
stats
select count(*) from postHistory as ph, posts as p, votes as v, badges as b, users as u, comments as c where p.ViewCount >= 0 and u.Id = p.OwnerUserId and u.Id = b.UserId and p.Id = v.PostId and p.Score <= 192 and p.Id = ph.PostId and p.Id = c.PostId
stats
SELECT MIN(n.name) AS of_person, MIN(t.title) AS biography_movie FROM aka_name AS an, cast_info AS ci, info_type AS it, link_type AS lt, movie_link AS ml, name AS n, person_info AS pi, title AS t WHERE pi.person_id = ci.person_id AND n.id = an.person_id AND ci.person_id = n.id AND n.id = pi.person_id AND lt.id = ml.lin...
job
select max(sr_net_loss) as store_returns_loss, i_item_desc, max(ss_net_profit) as store_sales_profit, s_store_id, max(cs_net_profit) as catalog_sales_profit, i_item_id, s_store_name 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 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 JOIN store_returns ON store_sales.ss_customer_sk = store_returns.sr_customer_sk AND store_sales.ss_item_sk = store_return...
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 at.movie_id = mi_idx.movie_id AND at.title LIKE '%Champion%' AND it1.i...
job
Select Count(*) 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(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 = mk.movie_id AND cn.country_code ='[nl]' AND t.id = mk.movie_id AND mc.movie_id = t.id AND cn.id = mc.company_id AND k.keyword ='character-name-in-...
job
SELECT MIN(t.title) AS movie_title FROM keyword AS k, movie_info AS mi, movie_keyword AS mk, title AS t WHERE t.production_year > 2005 AND mi.info = ANY(ARRAY['Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Denish', 'Norwegian', 'German']) AND t.id = mk.movie_id AND k.id = mk.keyword_id AND k.keyword LIKE '%seque...
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 ci.person_id = an.person_id AND t.id = mc.movie_id AND t.id = mi.movie_id...
job
SELECT c_preferred_cust_flag, ss_ticket_number, c_first_name, 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(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.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND it.id = mi.info_type_id AND (mc.note LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%') AND ct...
job
SELECT p_brand, p_type, p_size, COUNT(DISTINCT ps_suppkey) AS supplier_cnt 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_type NOT LIKE 1 AND p_size = ANY(ARRAY[1, 1, 1, 1, 1, 1, 1, 1]) AND p_brand <> 1 GROUP B...
tpch
SELECT s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE n_name = 1 AND s_suppkey = l1.l_suppkey AND 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 o_orderstatus = 'F' AND l1.l_receiptdate > l1.l_com...
tpch
Select 100.00 * Sum( Case When p_type Like 'PROMO%' Then l_extendedprice * (1 - l_discount) Else 0 End ) / Sum(l_extendedprice * (1 - l_discount)) As promo_revenue From lineitem, part Where l_partkey = p_partkey And l_shipdate >= DATE 1 And l_shipdate < DATE 1 + INTERVAL '1' MONTH LIMIT 100;
tpch
SELECT COUNT(cs_quantity) AS catalog_sales_quantitycount, i_item_desc, COUNT(sr_return_quantity) AS store_returns_quantitycount, STDDEV_SAMP(sr_return_quantity) / AVG(sr_return_quantity) AS store_returns_quantitycov, AVG(cs_quantity) AS catalog_sales_quantityave, AVG(ss_quantity) AS store_sales_quantityave, STDDEV_SAMP...
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 r_name = 1 AND o_cust...
tpch
SELECT nation, o_year, SUM(amount) AS sum_profit FROM ( SELECT n_name AS nation, EXTRACT(YEAR FROM o_orderdate) AS o_year, l_extendedprice * (1 - l_discount) - ps_supplycost * l_quantity AS amount FROM part, supplier, lineitem, partsupp, orders, nation WHERE s_nationkey = n_nationkey AND ps_partkey = l_partkey AND p_na...
tpch
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 > '8.0' AND t.id = mi_idx.movie_id AND t.production_year BETWEEN 2000 AND 2005 AND it.id = mi_idx.info_type_id AND it.info ='rating' ) SELECT * FROM _q LIMIT 10;
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 c_comment, c_phone, n_name, c_acctbal, c_custkey, c_address, SUM(l_extendedprice * (1 - l_discount)) AS revenue, c_name FROM customer, orders, lineitem, nation WHERE l_orderkey = o_orderkey AND o_orderdate >= DATE 1 AND c_custkey = o_custkey AND o_orderdate < DATE 1 + INTERVAL '3' MONTH AND c_nationkey = n_natio...
tpch
SELECT MIN(n.name) AS of_person, MIN(t.title) AS biography_movie FROM aka_name AS an, cast_info AS ci, info_type AS it, link_type AS lt, movie_link AS ml, name AS n, person_info AS pi, title AS t WHERE n.id = an.person_id AND (n.gender = 'm' OR (n.gender = 'f' AND n.name LIKE 'B%')) AND it.info = 'mini biography' AND i...
job
SELECT c_custkey, c_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue, c_acctbal, n_name, c_address, c_phone, c_comment FROM customer, orders, lineitem, nation WHERE o_orderdate < DATE 1 + INTERVAL '3' MONTH AND c_nationkey = n_nationkey AND o_orderdate >= DATE 1 AND c_custkey = o_custkey AND l_orderkey = o_orde...
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 ct.id = mc.company_type_id AND mc.note NOT LIKE '%(as Metro-Goldwyn-M...
job
SELECT MAX(sr_net_loss) AS store_returns_loss, i_item_desc, s_store_name, MAX(cs_net_profit) AS catalog_sales_profit, s_store_id, i_item_id, MAX(ss_net_profit) AS store_sales_profit FROM store_sales JOIN store_returns ON store_sales.ss_customer_sk = store_returns.sr_customer_sk AND store_sales.ss_item_sk = store_return...
tpcds
select avg(ss_quantity), avg(ss_ext_sales_price), avg(ss_ext_wholesale_cost), sum(ss_ext_wholesale_cost) from store_sales join store on s_store_sk = ss_store_sk join customer_demographics on cd_demo_sk = ss_cdemo_sk join household_demographics on hd_demo_sk = ss_hdemo_sk join customer_address on ca_address_sk = ss_addr...
tpcds
SELECT MIN(t.title) AS movie_title FROM keyword AS k, movie_info AS mi, movie_keyword AS mk, title AS t WHERE mk.movie_id = mi.movie_id AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Danish', 'Swedish', 'Danish', 'Norwegian', 'German') AND k.id = mk.keyword_id AND t.production_year > 2010 AND k.keyword LIKE '%sequel%'...
job
SELECT i_item_desc, SUM(sr_return_quantity) AS store_returns_quantity, SUM(ss_quantity) AS store_sales_quantity, s_store_id, s_store_name, i_item_id, 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