text
stringlengths
84
1.49k
benchmark
stringclasses
4 values
SELECT COUNT(1) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v, badges AS b WHERE p.Id = pl.RelatedPostId AND b.UserId = c.UserId AND c.Score = 0 AND p.Id = v.PostId AND p.Id = c.PostId AND p.Id = ph.PostId AND pl.LinkTypeId = 1
stats
SELECT * FROM ( SELECT AVG(ss_list_price) AS b1_lp, COUNT(ss_list_price) AS b1_cnt, COUNT(DISTINCT ss_list_price) AS b1_cntd FROM store_sales WHERE (ss_list_price >= 99 AND ss_list_price <= 99 + 10 OR ss_coupon_amt BETWEEN 2779 AND 2779 + 1000 OR ss_wholesale_cost BETWEEN 69 AND 69 + 20) ) AS b2, ( SELECT AVG(ss_list_p...
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 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 movie_title FROM company_name AS cn, keyword AS k, movie_companies AS mc, movie_keyword AS mk, title AS t WHERE mc.movie_id = t.id AND cn.id = mc.company_id AND mc.movie_id = mk.movie_id AND cn.country_code ='[sm]' AND t.id = mk.movie_id AND k.keyword ='character-name-in-title' AND mk.keyword_id ...
job
SELECT STDDEV_SAMP(ss_quantity) / AVG(ss_quantity) AS store_sales_quantitycov, STDDEV_SAMP(cs_quantity) / AVG(cs_quantity) AS catalog_sales_quantitycov, AVG(sr_return_quantity) AS store_returns_quantityave, AVG(cs_quantity) AS catalog_sales_quantityave, COUNT(cs_quantity) AS catalog_sales_quantitycount, i_item_id, STDD...
tpcds
SELECT n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, supplier, nation, region WHERE l_orderkey = o_orderkey AND n_regionkey = r_regionkey AND c_custkey = o_custkey AND c_nationkey = s_nationkey AND l_suppkey = s_suppkey AND o_orderdate < DATE 1 + INTERVAL '1' YEAR AND o_ord...
tpch
SELECT MAX(t.title) AS movie_title FROM keyword AS k, movie_info AS mi, movie_keyword AS mk, title AS t WHERE t.id = mk.movie_id AND t.production_year > 2010 AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Danish', 'Swedish', 'Danish', 'Norwegian', 'German') AND k.keyword LIKE '%sequel%' AND mk.movie_id = mi.movie_id A...
job
Select s_name, s_address From supplier, nation Where n_name = 1 And s_nationkey = n_nationkey And s_suppkey In ( Select ps_suppkey From partsupp Where ps_partkey In ( Select p_partkey From part Where p_name Like 1 ) And ps_availqty > ( Select 0.5 * Sum(l_quantity) From lineitem Where l_partkey = ps_partkey And l_suppke...
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.id = mi.movie_id AND t.production_year > 2000 AND k.id = mk.keyword_id AND t.id = mk.movie_id AND k.keyword like '%sequel%' AND mk.movie_id = mi.movie_id AND mi.info in ('Sweden', 'Norway', 'Germany', 'Denmar...
job
Select i_item_id, i_item_desc, i_current_price From item Join inventory On i_item_sk = inv_item_sk Join date_dim On d_date_sk = inv_date_sk Join store_sales On ss_item_sk = i_item_sk Where i_current_price Between 91 And 91 + 30 And d_date Between CAST('2002-01-23' As DATE) And (CAST('2002-01-23' As DATE) + INTERVAL '60...
tpcds
SELECT COUNT(sr_return_quantity) AS store_returns_quantitycount, s_state, i_item_desc, COUNT(cs_quantity) AS catalog_sales_quantitycount, COUNT(ss_quantity) AS store_sales_quantitycount, AVG(sr_return_quantity) AS store_returns_quantityave, STDDEV_SAMP(ss_quantity) / AVG(ss_quantity) AS store_sales_quantitycov, STDDEV_...
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 cn.id = mc.company_id AND mc.movie_id = mk.movie_id AND mc.movie_id = t.id AND cn.country_code ='[de]' AND k.keyword ='character-name-in-title' AND t.id = mk.mo...
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 = pl.RelatedPostId AND p.Id = v.PostId AND p.Id = ph.PostId AND p.Id = c.PostId AND c.UserId = u.Id AND p.Score <= 40 AND pl.LinkTypeId = 1 AND b.UserId = u.Id
stats
SELECT MIN(cn.name) AS from_company, MIN(lt.link) AS link_type, MIN(t.title) AS western_sequel FROM company_name AS cn, company_type AS ct, info_type AS it, keyword AS k, link_type AS lt, movie_companies AS mc, movie_info AS mi, movie_keyword AS mk, movie_link AS ml, title AS t WHERE ml.movie_id = mc.movie_id AND cn.co...
job
SELECT n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, supplier, nation, region WHERE l_orderkey = o_orderkey AND o_orderdate >= DATE 1 AND r_name = 1 AND s_nationkey = n_nationkey AND c_custkey = o_custkey AND c_nationkey = s_nationkey AND o_orderdate < DATE 1 + INTERVAL '1'...
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 t.production_year > 2010 AND n.name LIKE '%Hemsworth%Chris%' AND k.id = mk.keyword_id AND t.id = ci.movie_id AND ci...
job
SELECT MIN(cn.name) AS movie_company, MIN(t.title) AS western_violent_movie, MIN(mi_idx.info) AS rating FROM company_name AS cn, company_type AS ct, info_type AS it1, info_type AS it2, keyword AS k, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS mi_idx, movie_keyword AS mk, title AS t WHERE...
job
SELECT MIN(k.keyword) AS movie_keyword, MIN(n.name) AS actor_name, MIN(t.title) AS marvel_movie FROM cast_info AS ci, keyword AS k, movie_keyword AS mk, name AS n, title AS t WHERE n.name LIKE '%Hemsworth%Chris%' AND t.id = ci.movie_id AND t.production_year > 2010 AND n.id = ci.person_id AND t.id = mk.movie_id AND k.id...
job
select min(t.title) as movie_title from keyword as k, movie_info as mi, movie_keyword as mk, title as t where k.keyword like '%sequel%' and mk.movie_id = mi.movie_id and t.id = mi.movie_id and mi.info in ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Denish', 'Norwegian', 'German') and t.production_year > 2005 ...
job
SELECT MIN(an.name) AS cool_actor_pseudonym, MIN(t.title) AS series_named_after_char FROM aka_name AS an, cast_info AS ci, company_name AS cn, keyword AS k, movie_companies AS mc, movie_keyword AS mk, name AS n, title AS t WHERE t.id = mc.movie_id AND t.id = mk.movie_id AND mk.keyword_id = k.id AND ci.movie_id = t.id A...
job
SELECT cc_name AS call_center_name, cc_manager AS manager, cc_call_center_id AS call_center, 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 o_year, sum( case when nation = 1 then volume else 0 end ) / sum(volume) as mkt_share from ( select EXTRACT(YEAR from o_orderdate) as o_year, l_extendedprice * (1 - l_discount) as volume, n2.n_name as nation from part, supplier, lineitem, orders, customer, nation n1, nation n2, region where o_custkey = c_custkey...
tpch
SELECT 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 p_type = 1 ) AS all_n...
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 MIN(k.keyword) AS movie_keyword, MIN(n.name) AS actor_name, MIN(t.title) AS marvel_movie FROM cast_info AS ci, keyword AS k, movie_keyword AS mk, name AS n, title AS t WHERE k.keyword = 'marvel-cinematic-universe' AND k.id = mk.keyword_id AND t.id = mk.movie_id AND t.id = ci.movie_id AND ci.movie_id = mk.movie_i...
job
SELECT MIN(mi_idx.info) AS rating, MIN(t.title) AS northamerican_movie FROM aka_title AS at, company_name AS cn, info_type AS it1, info_type AS it2, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS mi_idx, title AS t WHERE t.id = mc.movie_id AND cn.id = mc.company_id AND mi.movie_id = mi_idx....
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 it.id = mi_idx.info_type_id AND ct.kind = 'production companies' AND t.id = mi_idx.movie_id AND mc.movie_i...
job
SELECT o_year, SUM( CASE WHEN nation = 1 THEN volume ELSE 0 END ) / SUM(volume) AS mkt_share FROM ( SELECT EXTRACT(YEAR FROM o_orderdate) AS o_year, l_extendedprice * (1 - l_discount) AS volume, n2.n_name AS nation FROM part, supplier, lineitem, orders, customer, nation n1, nation n2, region WHERE l_orderkey = o_orderk...
tpch
SELECT COUNT(*) FROM comments AS c, posts AS p, users AS u WHERE u.Id = p.OwnerUserId AND c.CreationDate >= '2010-08-05 00:36:02'::timestamp AND p.FavoriteCount >= 0 AND p.ViewCount >= 0 AND p.CommentCount >= 0 AND c.UserId = u.Id
stats
SELECT MIN(cn.name) AS from_company, MIN(lt.link) AS link_type, MIN(t.title) AS western_sequel FROM company_name AS cn, company_type AS ct, info_type AS it, keyword AS k, link_type AS lt, movie_companies AS mc, movie_info AS mi, movie_keyword AS mk, movie_link AS ml, title AS t WHERE k.keyword = ANY(ARRAY['sequel', 're...
job
SELECT i_current_price, i_item_id, i_item_desc 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 store_sales ON ss_item_sk = i_item_sk WHERE i_current_price BETWEEN 93 AND 93 + 30 AND inv_quantity_on_hand BETWEEN 100 AND 500 AND d_date BETWEEN CAST('2002...
tpcds
Select item.i_brand_id As brand_id, dt.d_year, item.i_brand As brand, Sum(ss_ext_sales_price) As sum_agg 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 = 12 And item.i_manufact_id = 599 Group By dt.d_year, item.i_bra...
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 (mc.note like '%(co-production)%' or mc.note like '%(presents)%') and mc.note not like '%(as Metro-Goldwyn-Mayer Pictures)%' and ct.id = mc.company_type_id and t.id = mi.movie_id and...
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 an.name like '%a%' AND n.id = an.person_id AND pi.person_id = ci.person_id AND ci.person_id = n.id AND t.production_ye...
job
SELECT o_year, SUM( CASE WHEN nation = 1 THEN volume ELSE 0 END ) / SUM(volume) AS mkt_share FROM ( SELECT EXTRACT(YEAR FROM o_orderdate) AS o_year, l_extendedprice * (1 - l_discount) AS volume, n2.n_name AS nation FROM part, supplier, lineitem, orders, customer, nation n1, nation n2, region WHERE p_type = 1 ) AS all_n...
tpch
SELECT i_item_desc, COUNT(sr_return_quantity) AS store_returns_quantitycount, i_item_id, COUNT(ss_quantity) AS store_sales_quantitycount, COUNT(cs_quantity) AS catalog_sales_quantitycount, STDDEV_SAMP(cs_quantity) / AVG(cs_quantity) AS catalog_sales_quantitycov, AVG(ss_quantity) AS store_sales_quantityave, s_state, STD...
tpcds
SELECT COUNT(ss_quantity) AS store_sales_quantitycount, i_item_id, STDDEV_SAMP(cs_quantity) / AVG(cs_quantity) AS catalog_sales_quantitycov, STDDEV_SAMP(ss_quantity) AS store_sales_quantitystdev, STDDEV_SAMP(ss_quantity) / AVG(ss_quantity) AS store_sales_quantitycov, STDDEV_SAMP(sr_return_quantity) / AVG(sr_return_quan...
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 it.info = 'bottom 10 rank' AND mc.movie_id = mi.movie_id AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND it.id = mi.info_type_id AND t.id = mi.movie_id AND ct.kind = '...
job
SELECT i_item_id, i_item_desc, s_store_id, s_store_name, SUM(ss_quantity) AS store_sales_quantity, SUM(sr_return_quantity) AS store_returns_quantity, SUM(cs_quantity) AS catalog_sales_quantity FROM store_sales INNER JOIN store_returns ON ss_customer_sk = sr_customer_sk AND ss_item_sk = sr_item_sk AND ss_ticket_number =...
tpcds
SELECT SUM(ss_ext_sales_price) AS ext_price, item.i_brand AS brand, dt.d_year, item.i_brand_id AS brand_id 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 item.i_manager_id = 67 AND dt.d_moy = 11 AND dt.d_year = 1999 GROUP BY ...
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.info = 'top 250 rank' AND it.id = mi_idx.info_type_id AND mc.movie_id = mi_idx.movie_id AND (mc.note LI...
job
Select i_item_id, i_item_desc, i_category, i_class, i_current_price, Sum(ws_ext_sales_price) As itemrevenue, Sum(ws_ext_sales_price) * 100 / Sum(Sum(ws_ext_sales_price)) OVER (PARTITION By i_class) As revenueratio From web_sales Inner Join item On ws_item_sk = i_item_sk Inner Join date_dim On ws_sold_date_sk = d_date_s...
tpcds
SELECT i_item_desc, i_current_price, i_item_id 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 store_sales ON ss_item_sk = i_item_sk WHERE i_manufact_id IN (427, 128, 154, 9) AND d_date BETWEEN CAST('2002-01-23' AS DATE) AND (CAST('2002-01-23' AS DATE)...
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 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.id = mk.movie_id AND t.production_year > 2010 AND t.id = ci.movie_id AND k.id = mk.keyword_id AND n.id = ci.person_id AND ci.movie_id = m...
job
Select l_orderkey, Sum(l_extendedprice * (1 - l_discount)) As revenue, o_orderdate, o_shippriority From customer, orders, lineitem Where o_orderdate < DATE 1 AND l_shipdate > DATE 1 AND c_mktsegment = 1 AND l_orderkey = o_orderkey AND c_custkey = o_custkey Group By l_orderkey, o_orderdate, o_shippriority Order By reven...
tpch
select l_orderkey, sum(l_extendedprice * (1 - l_discount)) as revenue, o_orderdate, o_shippriority from customer, orders, lineitem where l_orderkey = o_orderkey AND c_mktsegment = 1 AND c_custkey = o_custkey AND l_shipdate > DATE 1 AND o_orderdate < DATE 1 group by l_orderkey, o_orderdate, o_shippriority order by reven...
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.movie_id AND it1.info = 'rating' AND mi.movie_id = mi_idx.mo...
job
With _q As ( Select Count(*) From comments As c, posts As p, postHistory As ph, votes As v, users As u Where u.Id = c.UserId And c.UserId = p.OwnerUserId And p.OwnerUserId = ph.UserId And ph.UserId = v.UserId And p.Score <= 13 And p.AnswerCount >= 0 Limit 50 ) Select * From _q;
stats
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 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 = t.id AND mc.movie_id = mk.mo...
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 n.gender = 'f' AND ci.person_id = an.person_id AND it.info = 'release dat...
job
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 ss_ticket_number, cnt, c_first_name, c_preferred_cust_flag, c_salutation, c_last_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(an1.name) AS actress_pseudonym, MIN(t.title) AS japanese_movie_dubbed FROM aka_name AS an1, cast_info AS ci, company_name AS cn, movie_companies AS mc, name AS n1, role_type AS rt, title AS t WHERE n1.name NOT LIKE '%Yu%' AND n1.name LIKE '%Yo%' AND rt.role = 'actress' AND mc.note LIKE '%(Japan)%' AND ci.mov...
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
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 cn.id = mc.company_id AND k.keyword ='character-name-in-title' AND mc.movie_id = t.id AND mk.keyword_id = k.id AND t.id = mk.movie_id AND cn.country_code ='[nl]' AND mc.mov...
job
Select Sum(l_extendedprice) / 7.0 As avg_yearly From lineitem, part Where p_partkey = l_partkey AND p_container = 1 AND l_quantity < ( Select 0.2 * Avg(l_quantity) From lineitem Where l_partkey = p_partkey ) AND p_brand = 1 LIMIT 1000;
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 (mc.note LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%') AND it.info = 'top 250 rank' AND t.id = ...
job
SELECT MIN(cn.name) AS from_company, MIN(lt.link) AS link_type, MIN(t.title) AS western_sequel FROM company_name AS cn, company_type AS ct, info_type AS it, keyword AS k, link_type AS lt, movie_companies AS mc, movie_info AS mi, movie_keyword AS mk, movie_link AS ml, title AS t WHERE t.production_year > 1950 AND ml.mov...
job
Select Count(*) From comments As c, posts As p, postLinks As pl, postHistory As ph, votes As v, users As u Where p.PostTypeId = 1 AND p.Id = pl.PostId AND p.Id = ph.PostId AND u.Id = p.OwnerUserId AND p.Id = v.PostId AND p.AnswerCount >= 0 AND p.Id = c.PostId
stats
WITH _q AS ( 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 l_rece...
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 mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND it.info = 'top 250 rank' AND mc.movie_id = mi_i...
job
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 t.id = mi.movie_id And k.id = mk.keyword_id And k.keyword Like '%sequel%' And mi.info In ('Sweden', 'Norway', 'Germany', 'Danish', 'Swedish', 'Danish', 'Norwegian', 'German') And t...
job
SELECT SUM(l_extendedprice * (1 - l_discount)) AS revenue, n_name FROM customer, orders, lineitem, supplier, nation, region WHERE c_custkey = o_custkey AND l_orderkey = o_orderkey AND r_name = 1 AND n_regionkey = r_regionkey AND l_suppkey = s_suppkey AND s_nationkey = n_nationkey AND c_nationkey = s_nationkey AND o_ord...
tpch
SELECT MIN(k.keyword) AS movie_keyword, MIN(t.title) AS marvel_movie, MIN(n.name) AS actor_name FROM cast_info AS ci, keyword AS k, movie_keyword AS mk, name AS n, title AS t WHERE t.id = mk.movie_id AND ci.movie_id = mk.movie_id AND n.id = ci.person_id AND k.keyword = 'marvel-cinematic-universe' AND n.name LIKE '%Hems...
job
SELECT COUNT(*) FROM comments AS c, postHistory AS ph, votes AS v, users AS u WHERE u.Views >= 0 AND v.UserId = ph.UserId AND ph.UserId = c.UserId AND u.UpVotes <= 123 AND u.Id = v.UserId AND u.DownVotes >= 0 LIMIT 500;
stats
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.production_year > 2005 AND ct.id = mc.company_type_id AND cn.country_code = '[ru]' AND t.id = mc.m...
job
SELECT COUNT(*) FROM postHistory AS ph, posts AS p, votes AS v, badges AS b, users AS u, comments AS c WHERE p.Id = ph.PostId AND u.Id = p.OwnerUserId AND p.ViewCount >= 0 AND p.Id = v.PostId AND p.Score <= 192 AND p.Id = c.PostId AND u.Id = b.UserId
stats
SELECT s_address, total_revenue, s_suppkey, s_phone, 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 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 miidx.movie_id = mc.movie_id And it2.id = mi.in...
job
Select Min(cn.name) As from_company, Min(lt.link) As link_type, Min(t.title) As western_sequel From company_name As cn, company_type As ct, info_type As it, keyword As k, link_type As lt, movie_companies As mc, movie_info As mi, movie_keyword As mk, movie_link As ml, title As t Where mc.note Like '%(USA)%' And t.id = m...
job
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 SUBSTRING(c_phone From 1 FOR 2) In (1, 1, 1, 1, 1, 1, 1) AND c_acctbal > ( Select Avg(c_acctbal) From customer Where c_acctbal > 0.00 And SUBSTRING(c_phone From 1...
tpch
SELECT s_store_name, i_item_desc, MAX(ss_net_profit) AS store_sales_profit, MAX(sr_net_loss) AS store_returns_loss, MAX(cs_net_profit) AS catalog_sales_profit, i_item_id, s_store_id 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 MIN(t.title) AS northamerican_movie, MIN(mi_idx.info) AS rating FROM aka_title AS at, company_name AS cn, info_type AS it1, info_type AS it2, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS mi_idx, title AS t WHERE kt.id = t.kind_id AND it1.info = 'rating' AND kt.kind = 'movie' AND mi...
job
WITH _q AS ( SELECT SUM(l_extendedprice * l_discount) AS revenue FROM lineitem WHERE l_quantity < 1 AND l_discount BETWEEN 1 - 0.01 AND 1 + 0.01 AND l_shipdate < DATE 1 + INTERVAL '1' YEAR AND l_shipdate >= DATE 1 ) SELECT * FROM _q;
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 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(*) from comments as c, posts as p, postLinks as pl, postHistory as ph, votes as v where p.FavoriteCount >= 0 and p.Id = pl.PostId and p.Id = ph.PostId and pl.LinkTypeId = 1 and c.Score = 0 and p.Id = v.PostId and p.Id = c.PostId
stats
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.id = mk.keyword_id AND t.id = mk.movie_id AND k.keyword LIKE '%sequel%' AND t.production_year > 2000 AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Danish'...
job
WITH year_total AS ( SELECT c_birth_country AS customer_birth_country, SUM(((ss_ext_list_price - ss_ext_wholesale_cost - ss_ext_discount_amt) + ss_ext_sales_price) / 2) AS year_total, c_customer_id AS customer_id, 's' AS sale_type, c_email_address AS customer_email_address, c_preferred_cust_flag AS customer_preferred_c...
tpcds
SELECT MIN(t.title) AS movie_title, MIN(mi_idx.info) AS rating 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.id = mi_idx.movie_id AND it.info ='rating' AND t.production_year >= 2000 AND t.production_year <= 2010
job
Select supp_nation, cust_nation, l_year, Sum(volume) As revenue From ( Select n1.n_name As supp_nation, n2.n_name As cust_nation, EXTRACT(YEAR From l_shipdate) As l_year, l_extendedprice * (1 - l_discount) As volume From supplier, lineitem, orders, customer, nation n1, nation n2 Where c_nationkey = n2.n_nationkey And l...
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 ct.id = mc.company_type_id AND mc.movie_id = t....
job
SELECT MIN(t.title) AS voiced_movie, MIN(n.name) AS voicing_actress FROM aka_name AS an, char_name AS chn, cast_info AS ci, company_name AS cn, info_type AS it, movie_companies AS mc, movie_info AS mi, name AS n, role_type AS rt, title AS t WHERE ci.note IN ('(voice)', '(voice: Japanese version)', '(voice) (uncredited)...
job
SELECT c_first_name, c_preferred_cust_flag, cnt, c_last_name, c_salutation, 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 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 cn.country_code ='[nl]' 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-...
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 t.id = mk.movie_id AND mk.keyword_id = k.id AND cn.id = mc.company_id AND mc.movie_id = mk.movie_id AND k.keyword ='character-name-in-title' AND cn.country_code ='[sm]' AND mc.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 (mc.note LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%') AND t.id = mi_idx.movie_id AND ct.id = m...
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 l_shipmode, SUM( CASE WHEN o_orderpriority <> '1-URGENT' AND o_orderpriority <> '2-HIGH' THEN 1 ELSE 0 END ) AS low_line_count, SUM( CASE WHEN o_orderpriority = '1-URGENT' OR o_orderpriority = '2-HIGH' THEN 1 ELSE 0 END ) AS high_line_count FROM orders, lineitem WHERE l_receiptdate >= DATE 1 AND l_shipdate < l_c...
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 n.gender = 'f' AND cn.id = mc...
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 n.id = ci.person_id And t.production_year > 2010 And ci.movie...
job
SELECT AVG(ss_quantity) AS agg1, AVG(ss_coupon_amt) AS agg3, 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 AVG(cs_quantity) AS agg1, AVG(cs_list_price) AS agg2, AVG(cs_coupon_amt) AS agg3, AVG(cs_sales_price) AS agg4, i_item_id FROM catalog_sales INNER JOIN customer_demographics ON cs_bill_cdemo_sk = cd_demo_sk INNER JOIN date_dim ON cs_sold_date_sk = d_date_sk INNER JOIN item ON cs_item_sk = i_item_sk INNER JOIN pro...
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 n.gender = 'f' AND cn.id = mc.company_id AND mc.note LIKE '%(...
job
SELECT o_year, SUM( CASE WHEN nation = 1 THEN volume ELSE 0 END ) / SUM(volume) AS mkt_share FROM ( SELECT EXTRACT(YEAR FROM o_orderdate) AS o_year, l_extendedprice * (1 - l_discount) AS volume, n2.n_name AS nation FROM part, supplier, lineitem, orders, customer, nation n1, nation n2, region WHERE c_nationkey = n1.n_na...
tpch
SELECT MIN(t.title) AS western_violent_movie, MIN(mi_idx.info) AS rating, MIN(cn.name) AS movie_company FROM company_name AS cn, company_type AS ct, info_type AS it1, info_type AS it2, keyword AS k, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS mi_idx, movie_keyword AS mk, title AS t WHERE...
job
SELECT MIN(mi.info) AS release_date, MIN(miidx.info) AS rating, MIN(t.title) AS german_movie FROM company_name AS cn, company_type AS ct, info_type AS it, info_type AS it2, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS miidx, title AS t WHERE it2.id = mi.info_type_id AND it.info = 'rating'...
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 ct.id = mc.company_type_id AND ct.kind = 'production companies' AND it.inf...
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 mi_idx.info > '8.0' AND t.production_year BETWEEN 2000 AND 2005 AND it.info ='rating' AND it.id = mi_idx.info_type_id AND t.id = mi_idx.movie_id
job
SELECT MIN(t.title) AS movie_title FROM company_name AS cn, keyword AS k, movie_companies AS mc, movie_keyword AS mk, title AS t WHERE cn.id = mc.company_id AND mk.keyword_id = k.id AND cn.country_code ='[de]' AND mc.movie_id = t.id AND k.keyword ='character-name-in-title' AND mc.movie_id = mk.movie_id AND t.id = mk.mo...
job