text
stringlengths
84
1.49k
benchmark
stringclasses
4 values
SELECT MAX(mi_idx.info) AS rating, MAX(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 kt.kind = 'movie' AND mi.movie_id = mi_idx.movi...
job
SELECT s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE s_nationkey = n_nationkey AND o_orderstatus = 'F' AND NOT EXISTS ( SELECT * FROM lineitem l3 WHERE l3.l_orderkey = l1.l_orderkey AND l3.l_suppkey != l1.l_suppkey AND l3.l_receiptdate > l3.l_commitdate ) AND s_suppkey = l1.l_suppkey AND ...
tpch
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 cn.country_code ='[nl]' AND mk.keyword_id = k.id AND cn.id = mc.company_id AND k.keyword ='character-name-in-title' AND mc.movie_id = mk.movie_id AND mc.movie_id = t.id AND t.id = mk.mo...
job
SELECT cc_call_center_id AS call_center, cc_name AS call_center_name, 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
with ss as ( select i_manufact_id, sum(ss_ext_sales_price) as total_sales from store_sales join date_dim on ss_sold_date_sk = d_date_sk join customer_address on ss_addr_sk = ca_address_sk join item on ss_item_sk = i_item_sk where d_moy = 2 and d_year = 2000 and i_category in ('Electronics') and ca_gmt_offset = -5 group...
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 t.production_year > 2000 AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Danish', 'Norwegian', 'German') AND k.keyword LIKE '%sequel%' AND k.id = mk.keyword_i...
job
SELECT extended_price, extended_tax, ca_city, c_first_name, c_last_name, ss_ticket_number, bought_city, list_price FROM ( SELECT ss_ticket_number, ss_customer_sk, ca_city AS bought_city, SUM(ss_ext_sales_price) AS extended_price, SUM(ss_ext_list_price) AS list_price, SUM(ss_ext_tax) AS extended_tax FROM store_sales JOI...
tpcds
SELECT o_orderdate, o_shippriority, SUM(l_extendedprice * (1 - l_discount)) AS revenue, l_orderkey FROM customer, orders, lineitem WHERE o_orderdate < DATE 1 AND l_orderkey = o_orderkey AND l_shipdate > DATE 1 AND c_mktsegment = 1 AND c_custkey = o_custkey GROUP BY l_orderkey, o_orderdate, o_shippriority ORDER BY reven...
tpch
SELECT c_acctbal, c_address, SUM(l_extendedprice * (1 - l_discount)) AS revenue, c_name, n_name, c_comment, c_phone, c_custkey 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 AVG(ss_quantity) AS agg1, AVG(ss_sales_price) AS agg4, AVG(ss_coupon_amt) AS agg3, i_item_id, AVG(ss_list_price) AS agg2 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 MIN(mi.info) AS release_date, MIN(miidx.info) AS rating, MIN(t.title) AS german_movie FROM company_name AS cn, company_type AS ct, info_type AS it, info_type AS it2, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS miidx, title AS t WHERE it2.info = 'release dates' AND cn.id = mc.compa...
job
SELECT s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE s_nationkey = n_nationkey AND s_suppkey = l1.l_suppkey AND o_orderkey = l1.l_orderkey AND l1.l_receiptdate > l1.l_commitdate AND EXISTS ( SELECT * FROM lineitem l2 WHERE l2.l_orderkey = l1.l_orderkey AND l2.l_suppkey <> l1.l_suppkey ) A...
tpch
SELECT s_store_id, MAX(ss_net_profit) AS store_sales_profit, MAX(cs_net_profit) AS catalog_sales_profit, s_store_name, i_item_id, MAX(sr_net_loss) AS store_returns_loss, i_item_desc FROM store_sales JOIN store_returns ON store_sales.ss_customer_sk = store_returns.sr_customer_sk AND store_sales.ss_item_sk = store_return...
tpcds
SELECT 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 ct.kind = 'production companies' AND t.id = mc....
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(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 ci.note LIKE '%(voice)%' AND ci.note LIKE '%(uncredited)%' AND ci.movie_id = mc.movie_id AND cn.id =...
job
SELECT MAX(k.keyword) AS movie_keyword, MAX(n.name) AS actor_name, MAX(t.title) AS marvel_movie FROM cast_info AS ci, keyword AS k, movie_keyword AS mk, name AS n, title AS t WHERE n.id = ci.person_id AND k.keyword = 'marvel-cinematic-universe' AND t.id = mk.movie_id AND k.id = mk.keyword_id AND ci.movie_id = mk.movie_...
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 k.keyword LIKE '%sequel%' AND k.id = mk.keyword_id AND t.production_year > 2000 AND mi.info = ANY(ARRAY['Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Danish', 'Norwegian', ...
job
SELECT s_phone, total_revenue, s_name, s_address, s_suppkey FROM supplier, revenue0 WHERE s_suppkey = supplier_no AND total_revenue = ( SELECT MAX(total_revenue) FROM revenue0 ) ORDER BY s_suppkey;
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 NOT LIKE '%(as Metro-Goldwy...
job
select 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, l_shipmode from orders, lineitem where l_shipmode in (1, 1) AND l_commitdate < l_re...
tpch
WITH _q AS ( 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, tit...
job
Select ca_zip, Sum(cs_sales_price) From catalog_sales Inner Join customer On cs_bill_customer_sk = c_customer_sk Inner Join customer_address On c_current_addr_sk = ca_address_sk Inner Join date_dim On cs_sold_date_sk = d_date_sk Where d_year = 2002 And (SUBSTR(ca_zip, 1, 5) In ( '85669', '86197', '88274', '83405', '864...
tpcds
select o_orderkey, o_orderdate, o_totalprice, c_name, sum(l_quantity), c_custkey 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 p_brand, p_type, p_size, Count(Distinct ps_suppkey) As supplier_cnt From partsupp, part Where p_partkey = ps_partkey And p_brand <> 1 And p_type Not Like 1 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(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.note = '(voice: English version)' AND cn.country_code = '[jp]' AND an1.person_id = n1.id AND an1.person_id =...
job
SELECT c_acctbal, c_phone, c_address, c_name, c_custkey, c_comment, n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, nation WHERE l_orderkey = o_orderkey AND o_orderdate >= DATE 1 AND c_custkey = o_custkey AND l_returnflag = 'R' AND o_orderdate < DATE 1 + INTERVAL '3' MONTH AN...
tpch
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 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.id = mi.info_type_id AND it.info = 'bottom 10 rank' AND ct.kind = 'production companies' AND t.id = mi.movie_id AND (mc.note LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%...
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 ci.note LIKE '%(uncredited)%' AND ci.movie_id = mc.movie_id AND rt.id = ci.role_id AND ci.note LIKE ...
job
select avg(cs_quantity) as agg1, avg(cs_coupon_amt) as agg3, avg(cs_list_price) as agg2, i_item_id, 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_item_desc, s_store_id, MAX(sr_net_loss) AS store_returns_loss, s_store_name, MAX(cs_net_profit) AS catalog_sales_profit, MAX(ss_net_profit) AS store_sales_profit, i_item_id FROM store_sales JOIN store_returns ON store_sales.ss_customer_sk = store_returns.sr_customer_sk AND store_sales.ss_item_sk = store_return...
tpcds
select n_name, sum(l_extendedprice * (1 - l_discount)) as revenue from customer, orders, lineitem, supplier, nation, region where c_nationkey = s_nationkey AND l_suppkey = s_suppkey AND l_orderkey = o_orderkey AND r_name = 1 AND s_nationkey = n_nationkey AND n_regionkey = r_regionkey AND o_orderdate >= DATE 1 AND c_cus...
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 cn.country_code = '[jp]' AND n1.name LIKE '%Yo%' AND n1.id = ci.person_id AND ci.note = '(voice: English versio...
job
SELECT MAX(cn.name) AS from_company, MAX(lt.link) AS link_type, MAX(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 it.info = 'release dates' AND t.id ...
job
select min(mi.info) as release_date, min(miidx.info) as rating, min(t.title) as german_movie from company_name as cn, company_type as ct, info_type as it, info_type as it2, kind_type as kt, movie_companies as mc, movie_info as mi, movie_info_idx as miidx, title as t where ct.kind = 'production companies' and mi.movie_i...
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 (...
tpch
select count(*) from comments as c, posts as p, postLinks as pl, postHistory as ph, votes as v, badges as b, users as u where b.UserId = u.Id and p.Score <= 40 and c.UserId = u.Id and pl.LinkTypeId = 1 and p.Id = c.PostId and p.Id = pl.RelatedPostId and p.Id = v.PostId and p.Id = ph.PostId limit 500;
stats
Select Sum(ss_ext_wholesale_cost), Avg(ss_ext_sales_price), Avg(ss_quantity), 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 COUNT(*) 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 c.Score = 0 AND pl.LinkTypeId = 1 AND p.Id = c.PostId AND b.UserId = c.UserId AND p.Id = v.PostId AND p.Id = ph.PostId
stats
SELECT MIN(k.keyword) AS movie_keyword, MIN(n.name) AS actor_name, MIN(t.title) AS marvel_movie FROM cast_info AS ci, keyword AS k, movie_keyword AS mk, name AS n, title AS t WHERE k.id = mk.keyword_id AND ci.movie_id = mk.movie_id AND n.name LIKE '%Hemsworth%Chris%' AND k.keyword = 'marvel-cinematic-universe' AND n.id...
job
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 = b.UserId AND p.Id = c.PostId AND p.Id = v.PostId AND p.Score <= 192 AND u.Id = p.OwnerUserId AND p.Id = ph.PostId
stats
SELECT c_comment, c_phone, c_name, n_name, c_custkey, c_address, SUM(l_extendedprice * (1 - l_discount)) AS revenue, c_acctbal FROM customer, orders, lineitem, nation WHERE o_orderdate >= DATE 1 AND o_orderdate < DATE 1 + INTERVAL '3' MONTH AND c_nationkey = n_nationkey AND l_returnflag = 'R' AND l_orderkey = o_orderke...
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 mk.keyword_id = k.id AND mc.movie_id = t.id AND mc.movie_id = mk.movie_id AND cn.id = mc.company_id AND t.id = mk.movie_id AND cn.c...
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 it.info ='rating' And mi_idx.info > '7.0' And t.production_year Between 2000 And 2010 And it.id = mi_idx.info_type_id And t.id = mi_idx.movie_id Limit 1000;
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 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 cn.id = mc.company_id AND k.keyword ='character-name-in-title' AND t.id = mk.movie_id AND mc.movie_id = mk.movie_id AND mc.movie_id = t.id 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 n_regionkey = r_regionkey AND l_suppkey = s_suppkey AND l_orderkey = o_orderkey AND c_nationkey = s_nationkey AND s_nationkey = n_nationkey AND o_orderdate >= DATE ...
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 mi.movie_id = t.id AND mk.movie_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 n.name Like '%Downey%Robert%' And k.id = mk.keyword_id And t.id = mk.movie_id And ci.movie_id = mk.movie_id And t.id = ci.movie_id And n.id...
job
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 LIKE '%Yo%' AND t.id = mc.movie_id AND ci.role_id = rt.id AND mc.company_id = cn.id AND n1.id = ci.pers...
job
SELECT SUM(ss_ext_sales_price) AS ext_price, i_brand AS brand, i_manufact_id, i_manufact, i_brand_id AS brand_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 list_price, ca_city, c_last_name, bought_city, extended_price, extended_tax, c_first_name, ss_ticket_number FROM ( SELECT ss_ticket_number, ss_customer_sk, ca_city AS bought_city, SUM(ss_ext_sales_price) AS extended_price, SUM(ss_ext_list_price) AS list_price, SUM(ss_ext_tax) AS extended_tax FROM store_sales JOI...
tpcds
WITH year_total AS ( SELECT c_last_name AS customer_last_name, c_login AS customer_login, d_year AS dyear, SUM(((ss_ext_list_price - ss_ext_wholesale_cost - ss_ext_discount_amt) + ss_ext_sales_price) / 2) AS year_total, c_email_address AS customer_email_address, 's' AS sale_type, c_birth_country AS customer_birth_count...
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 ct.kind = 'production companies' And mi.movie_i...
job
SELECT SUM(l_extendedprice * (1 - l_discount)) AS revenue, o_shippriority, o_orderdate, l_orderkey FROM customer, orders, lineitem WHERE l_shipdate > DATE 1 AND o_orderdate < DATE 1 AND l_orderkey = o_orderkey AND c_mktsegment = 1 AND c_custkey = o_custkey GROUP BY l_orderkey, o_orderdate, o_shippriority ORDER BY reven...
tpch
Select p_brand, p_type, p_size, Count(Distinct ps_suppkey) As supplier_cnt From partsupp, part Where p_partkey = ps_partkey And p_brand <> 1 And p_size In (1, 1, 1, 1, 1, 1, 1, 1) And p_type Not Like 1 And ps_suppkey Not In ( Select s_suppkey From supplier Where s_comment Like '%Customer%Complaints%' ) Group By p_brand...
tpch
SELECT COUNT(*) FROM postHistory AS ph, posts AS p, users AS u, badges AS b WHERE p.Score >= -7 AND u.Id = b.UserId AND p.OwnerUserId = u.Id AND u.Reputation >= 1 AND ph.PostHistoryTypeId = 3 AND ph.UserId = u.Id LIMIT 100;
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 rt.id = ci.role_id AND chn.id = ci.person_role_id AND t.id = mc.movie_id AND cn.country_code = '[ru]...
job
SELECT MIN(chn.name) AS uncredited_voiced_character, MIN(t.title) AS russian_movie FROM char_name AS chn, cast_info AS ci, company_name AS cn, company_type AS ct, movie_companies AS mc, role_type AS rt, title AS t WHERE rt.id = ci.role_id AND chn.id = ci.person_role_id AND ci.note LIKE '%(voice)%' AND ci.note LIKE '%(u...
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 k.keyword = 'character-name-IN-title' AND t.id = mk.movie_id AND ci.movie_id = mk.movie_id ...
job
SELECT SUM(l_extendedprice * l_discount) AS revenue FROM lineitem WHERE l_shipdate >= DATE 1 AND l_discount BETWEEN 1 - 0.01 AND 1 + 0.01 AND l_quantity < 1 AND l_shipdate < DATE 1 + INTERVAL '1' YEAR LIMIT 200;
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 k.keyword LIKE '%sequel%' AND k.id = mk.keyword_id AND mk.movie_id = mi.movie_id AND t.id = mk.movie_id AND t.production_year > 2000 AND mi.info = ANY(ARRAY['Sweden', 'Norway', 'Germany',...
job
SELECT SUM(l_extendedprice * (1 - l_discount)) AS revenue, c_address, c_custkey, c_acctbal, c_comment, n_name, c_name, c_phone 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
WITH year_total AS ( SELECT c_preferred_cust_flag AS customer_preferred_cust_flag, SUM(((ss_ext_list_price - ss_ext_wholesale_cost - ss_ext_discount_amt) + ss_ext_sales_price) / 2) AS year_total, c_login AS customer_login, c_birth_country AS customer_birth_country, 's' AS sale_type, c_last_name AS customer_last_name, c...
tpcds
WITH _q AS ( 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 LIKE '%(Japan)%' AND mc.note NOT LIKE '%(USA)%' AND n1.name LIKE '%Yo%' AND ci.note = '(vo...
job
WITH year_total AS ( SELECT c_first_name AS customer_first_name, d_year AS dyear, c_email_address AS customer_email_address, c_login AS customer_login, 's' AS sale_type, c_preferred_cust_flag AS customer_preferred_cust_flag, c_birth_country AS customer_birth_country, SUM(((ss_ext_list_price - ss_ext_wholesale_cost - ss...
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 p_partkey = l_partkey...
tpch
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 mc.movie_id = t.id AND cn.id = mc.company_id AND k.keyword ='character-name-in-title' AND cn.country_code ='[nl]' AND mc.movie_id = mk.movie_id AND t.id = mk.mo...
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 s_nationkey = n_nationkey AND n_name = 1 AND s_suppkey = l1.l_suppkey AND NOT EXISTS ( SELECT * FROM lineitem l3 WHERE l3.l_or...
tpch
SELECT MIN(n.name) AS voicing_actress, MIN(t.title) AS voiced_movie FROM aka_name AS an, char_name AS chn, cast_info AS ci, company_name AS cn, info_type AS it, movie_companies AS mc, movie_info AS mi, name AS n, role_type AS rt, title AS t WHERE mi.movie_id = ci.movie_id AND it.id = mi.info_type_id AND mc.note LIKE '%...
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 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 ci.movie_id = mk.movie_id AND n.name LIKE '%Downey%Robert%' AND t.id = mk.movie_id AND n.id = c...
job
SELECT s_address, total_revenue, s_name, s_phone, s_suppkey FROM supplier, revenue0 WHERE total_revenue = ( SELECT MAX(total_revenue) FROM revenue0 ) AND s_suppkey = supplier_no ORDER BY s_suppkey
tpch
SELECT AVG(l_quantity) AS avg_qty, SUM(l_extendedprice) AS sum_base_price, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, AVG(l_extendedprice) AS avg_price, l_linestatus, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, AVG(l_discount) AS avg_disc, COUNT(*) AS count_order, l_returnflag, ...
tpch
Select Count(*) From comments As c, posts As p, postLinks As pl, postHistory As ph, votes As v Where c.Score = 0 And p.Id = v.PostId And p.Id = pl.PostId And p.Id = c.PostId And pl.LinkTypeId = 1 And p.Id = ph.PostId And p.FavoriteCount >= 0
stats
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 o_orderkey = l_orderkey AND l_receiptdate < ...
tpch
WITH _q AS ( SELECT c_custkey, c_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue, c_acctbal, n_name, c_address, c_phone, c_comment FROM customer, orders, lineitem, nation WHERE c_custkey = o_custkey AND o_orderdate >= DATE 1 AND c_nationkey = n_nationkey AND l_returnflag = 'R' AND l_orderkey = o_orderkey AND o...
tpch
SELECT COUNT(1) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v WHERE p.FavoriteCount >= 0 AND p.Id = c.PostId AND p.Id = v.PostId AND p.Id = pl.PostId AND c.Score = 0 AND pl.LinkTypeId = 1 AND p.Id = ph.PostId
stats
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 ci.movie_id = mk.movie_id AND t.id = ci.movie_id AND t.production_year > 2010 AND k.keyword = 'marvel-c...
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.id = mi_idx.movie_id AND t.production_year >= 2000 AND t.production_year <= 2005 AND it.id = mi_idx.info_type_id AND it.info ='rating'
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.id = mk.keyword_id AND k.keyword LIKE '%sequel%' AND t.id = mk.movie_id AND mi.info = ANY(ARRAY['Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Denish', 'Norwegian', 'German']) AND mk.movie_id = mi.movi...
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 n.id = pi.person_id AND it.info = 'mini biography' AND pi.person_id = an.person_id AND ml.linked_movie_id = t.id AND i...
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 = mc.movie_id AND ct.id = mc.company_type_id AND it.id = mi_idx.info_type_id AND (mc.note LIKE '%(co-...
job
SELECT AVG(cs_quantity) AS catalog_sales_quantityave, COUNT(ss_quantity) AS store_sales_quantitycount, COUNT(sr_return_quantity) AS store_returns_quantitycount, STDDEV_SAMP(ss_quantity) AS store_sales_quantitystdev, STDDEV_SAMP(sr_return_quantity) AS store_returns_quantitystdev, i_item_id, STDDEV_SAMP(ss_quantity) / AV...
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 t.id = mi_idx.movie_id AND it.info = 'top 250 rank' AND t.id = mc.movie_id AND it.id = mi_idx.info_type_id...
job
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.note = '(voice: English version)' AND ci.movie_id = t.id AND mc.note LIKE '%(Japan)%' AND t.id = mc.movie_id...
job
Select Count(*) From comments As c, posts As p, users As u Where p.ViewCount >= 0 And c.UserId = u.Id And c.CreationDate >= '2010-08-05 00:36:02'::timestamp And p.FavoriteCount >= 0 And p.CommentCount >= 0 And u.Id = p.OwnerUserId
stats
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 s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE s_nationkey = n_nationkey 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 EXISTS ( SELECT * FROM lineitem l2 WHERE l2.l_orderke...
tpch
SELECT STDDEV_SAMP(sr_return_quantity) AS store_returns_quantitystdev, STDDEV_SAMP(ss_quantity) / AVG(ss_quantity) AS store_sales_quantitycov, COUNT(sr_return_quantity) AS store_returns_quantitycount, STDDEV_SAMP(cs_quantity) / AVG(cs_quantity) AS catalog_sales_quantitycov, s_state, COUNT(ss_quantity) AS store_sales_qu...
tpcds
SELECT i_brand AS brand, SUM(ss_ext_sales_price) AS ext_price, i_brand_id AS brand_id FROM date_dim JOIN store_sales ON d_date_sk = ss_sold_date_sk JOIN item ON ss_item_sk = i_item_sk WHERE i_manager_id = 33 AND d_moy = 11 AND d_year = 2001 GROUP BY i_brand, i_brand_id ORDER BY ext_price ASC, brand_id;
tpcds
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 pl.LinkTypeId = 1 AND p.Id = ph.PostId AND p.Id = pl.RelatedPostId AND p.Id = v.PostId AND c.UserId = u.Id AND p.Id = c.PostId AND b.UserId = u.Id AND p.Score <= 40
stats
SELECT MIN(n.name) AS voicing_actress, MIN(t.title) AS voiced_movie FROM aka_name AS an, char_name AS chn, cast_info AS ci, company_name AS cn, info_type AS it, movie_companies AS mc, movie_info AS mi, name AS n, role_type AS rt, title AS t WHERE it.id = mi.info_type_id AND rt.role = 'actress' AND cn.country_code = '[u...
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 t.id = mc.movie_id and ct.kind = 'production companies' and ct.id = mc.company_type_id and (mc.note like '%(co-production)%' or mc.note like '%(present...
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 miidx.movie_id = t.id AND mc.movie_id = t.id AN...
job
SELECT MIN(t.title) AS american_movie FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info AS mi, title AS t WHERE t.id = mi.movie_id AND it.id = mi.info_type_id AND ct.kind = 'production companies' AND mc.movie_id = mi.movie_id AND ct.id = mc.company_type_id AND (mc.note LIKE '%(co-production)%'...
job
SELECT MIN(lt.link) AS link_type, MIN(cn.name) AS from_company, 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.id = mk.keyword_id AND mc.note NO...
job
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 cn.country_code = '[jp]' AND ci.role_id = rt.id AND mc.note NOT LIKE '%(USA)%' AND mc.note LIKE '%(Japan)%' AND...
job
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 = c.PostId and p.Id = pl.RelatedPostId and b.UserId = c.UserId and p.Id = ph.PostId and c.Score = 0 and p.Id = v.PostId and pl.LinkTypeId = 1
stats