text
stringlengths
84
1.49k
benchmark
stringclasses
4 values
SELECT SUM(l_quantity), o_orderkey, c_custkey, c_name, o_orderdate, o_totalprice FROM customer, orders, lineitem WHERE o_orderkey IN ( SELECT l_orderkey FROM lineitem GROUP BY l_orderkey HAVING SUM(l_quantity) > 1 ) AND c_custkey = o_custkey AND o_orderkey = l_orderkey GROUP BY c_name, c_custkey, o_orderkey, o_orderdat...
tpch
SELECT MIN(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 an1.person_id = ci.person_id AND n1.name LIKE '%Yo%' AND mc.note NOT LIKE '%(USA)%' AND an1.person_id = n1.id A...
job
SELECT MIN(t.title) AS japanese_movie_dubbed, MIN(an1.name) AS actress_pseudonym 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.role_id = rt.id AND mc.company_id = cn.id AND n1.id = ci.person_id AND t.id = mc.movie_id AND ci.movie_id = ...
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 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 Join store_returns On ss_customer_sk = sr_customer_sk And ss_item_sk = sr_item_sk And ss_ticket_number = sr_ti...
tpcds
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 mi.movie_id = mc.movie_id AND an.person_id ...
job
SELECT MIN(chn.name) AS uncredited_voiced_character, MIN(t.title) AS russian_movie FROM char_name AS chn, cast_info AS ci, company_name AS cn, company_type AS ct, movie_companies AS mc, role_type AS rt, title AS t WHERE ci.note LIKE '%(uncredited)%' AND cn.id = mc.company_id AND ci.note LIKE '%(voice)%' AND rt.id = ci....
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 t.id = mc.movie_id AND rt.role = 'actress' AND an1.person_id = n1.id AND an1.person_id = ci.person_id AND mc.no...
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 ci.movie_id = mk.movie_id and t.episode_nr >= 50 and an.person_id = n.id and mc.company_id ...
job
SELECT MIN(t.title) AS american_movie FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info AS mi, title AS t WHERE t.id = mc.movie_id AND it.info = 'bottom 10 rank' AND t.id = mi.movie_id AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND it.id = mi.info_type_id AND mc.movie_id = mi.m...
job
SELECT AVG(ss_sales_price) AS agg4, AVG(ss_list_price) AS agg2, AVG(ss_coupon_amt) AS agg3, i_item_id, AVG(ss_quantity) AS agg1 FROM store_sales INNER JOIN customer_demographics ON ss_cdemo_sk = cd_demo_sk INNER JOIN date_dim ON ss_sold_date_sk = d_date_sk INNER JOIN item ON ss_item_sk = i_item_sk INNER JOIN promotion ...
tpcds
SELECT MIN(t.title) AS russian_movie, MIN(chn.name) AS uncredited_voiced_character FROM char_name AS chn, cast_info AS ci, company_name AS cn, company_type AS ct, movie_companies AS mc, role_type AS rt, title AS t WHERE ci.note LIKE '%(uncredited)%' AND cn.country_code = '[ru]' AND ct.id = mc.company_type_id AND cn.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 mk.movie_id = mi.movie_id AND t.id = mi.movie_id AND t.production_year > 2005 AND k.id = mk.keyword_id AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Denish', 'Norwegian', 'German') AND t...
job
SELECT MIN(t.title) AS german_movie, MIN(mi.info) AS release_date, MIN(miidx.info) AS rating FROM company_name AS cn, company_type AS ct, info_type AS it, info_type AS it2, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS miidx, title AS t WHERE mi.movie_id = mc.movie_id AND mi.movie_id = mii...
job
SELECT MIN(k.keyword) AS movie_keyword, MIN(n.name) AS actor_name, MIN(t.title) AS marvel_movie FROM cast_info AS ci, keyword AS k, movie_keyword AS mk, name AS n, title AS t WHERE t.id = mk.movie_id AND t.id = ci.movie_id AND k.keyword = 'marvel-cinematic-universe' AND n.name LIKE '%Hemsworth%Chris%' AND ci.movie_id =...
job
SELECT MIN(chn.name) AS uncredited_voiced_character, MIN(t.title) AS russian_movie FROM char_name AS chn, cast_info AS ci, company_name AS cn, company_type AS ct, movie_companies AS mc, role_type AS rt, title AS t WHERE t.production_year > 2005 AND t.id = ci.movie_id AND chn.id = ci.person_role_id AND cn.country_code =...
job
SELECT SUM( CASE WHEN o_orderpriority = '1-URGENT' OR o_orderpriority = '2-HIGH' THEN 1 ELSE 0 END ) AS high_line_count, l_shipmode, SUM( CASE WHEN o_orderpriority <> '1-URGENT' AND o_orderpriority <> '2-HIGH' THEN 1 ELSE 0 END ) AS low_line_count FROM orders, lineitem WHERE l_receiptdate < DATE 1 + INTERVAL '1' YEAR A...
tpch
SELECT COUNT(*) FROM postHistory AS ph, posts AS p, votes AS v, badges AS b, users AS u, comments AS c WHERE p.Score <= 192 AND u.Id = p.OwnerUserId AND p.Id = c.PostId AND p.Id = v.PostId AND p.ViewCount >= 0 AND p.Id = ph.PostId AND u.Id = b.UserId
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.id = mc.company_id AND mc.movie_id = t.id AND mc.movie_id = mk.movie_id AND t.id = mk.movie_id AND cn.country_code ='[de]' AND k.keyword ='character-name-in-title' AND mk.keyword_id ...
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 o_orderkey = l_orderkey AND ( (n1....
tpch
SELECT AVG(l_extendedprice) AS avg_price, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, SUM(l_extendedprice) AS sum_base_price, SUM(l_quantity) AS sum_qty, l_returnflag, l_linestatus, AVG(l_discount) AS avg_disc, AVG(l_quantity) AS avg_qty, COUNT(*) AS count_order, SUM(l_extendedprice * (1 - l_di...
tpch
SELECT MIN(t.title) AS movie_title FROM keyword AS k, movie_info AS mi, movie_keyword AS mk, title AS t WHERE k.keyword LIKE '%sequel%' AND t.id = mk.movie_id AND t.production_year > 2000 AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Danish', 'Norwegian', 'German') AND mk.movie_id = mi.movie_id ...
job
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 c_last_name, c_first_name, c_salutation, c_preferred_cust_flag, ss_ticket_number, cnt FROM ( SELECT ss_ticket_number, ss_customer_sk, COUNT(1) AS cnt FROM store_sales JOIN date_dim ON ss_sold_date_sk = d_date_sk JOIN store ON ss_store_sk = s_store_sk JOIN household_demographics ON ss_hdemo_sk = hd_demo_sk WHERE ...
tpcds
SELECT 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 t.id = mc.movie_id AND an1.person_id = n1.id AND ci.note = '(voice: English version)' AND mc.note LIKE '%(Japan...
job
Select i_item_id, Avg(ss_quantity) As agg1, Avg(ss_list_price) As agg2, Avg(ss_sales_price) As agg4, Avg(ss_coupon_amt) As agg3 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 SUM(l_extendedprice * (1 - l_discount)) AS revenue, o_orderdate, l_orderkey, o_shippriority FROM customer, orders, lineitem WHERE c_mktsegment = 1 AND c_custkey = o_custkey AND o_orderdate < DATE 1 AND l_orderkey = o_orderkey AND l_shipdate > DATE 1 GROUP BY l_orderkey, o_orderdate, o_shippriority ORDER BY reven...
tpch
SELECT SUM(sr_return_quantity) AS store_returns_quantity, i_item_id, i_item_desc, SUM(ss_quantity) AS store_sales_quantity, SUM(cs_quantity) AS catalog_sales_quantity, s_store_name, s_store_id FROM store_sales JOIN store_returns ON ss_customer_sk = sr_customer_sk AND ss_item_sk = sr_item_sk AND ss_ticket_number = sr_ti...
tpcds
SELECT MIN(t.title) AS movie_title FROM keyword AS k, movie_info AS mi, movie_keyword AS mk, title AS t WHERE t.id = mi.movie_id AND k.id = mk.keyword_id AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Denish', 'Norwegian', 'German') AND mk.movie_id = mi.movie_id AND k.keyword LIKE '%sequel%' AND ...
job
SELECT SUM(ss_ext_sales_price) AS ext_price, i_brand AS brand, i_manufact_id, i_brand_id AS brand_id, i_manufact 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 s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE l1.l_receiptdate > l1.l_commitdate AND EXISTS ( SELECT * FROM lineitem l2 WHERE l2.l_orderkey = l1.l_orderkey AND l2.l_suppkey <> l1.l_suppkey ) AND o_orderkey = l1.l_orderkey AND n_name = 1 AND NOT EXISTS ( SELECT * FROM lineitem l3 WH...
tpch
Select Min(t.title) As movie_title From company_name As cn, keyword As k, movie_companies As mc, movie_keyword As mk, title As t Where mc.movie_id = t.id And mc.movie_id = mk.movie_id And cn.country_code ='[de]' And k.keyword ='character-name-In-title' And mk.keyword_id = k.id And t.id = mk.movie_id And cn.id = mc.comp...
job
select sum(case when (CAST(d_date as DATE) < CAST('2000-03-11' as DATE)) then cs_sales_price - COALESCE(cr_refunded_cash, 0) else 0 end) as sales_before, i_item_id, sum(case when (CAST(d_date as DATE) >= CAST('2000-03-11' as DATE)) then cs_sales_price - COALESCE(cr_refunded_cash, 0) else 0 end) as sales_after, w_state ...
tpcds
SELECT COUNT(1) FROM comments AS c, badges AS b WHERE c.UserId = b.UserId AND c.Score = 0 AND b.Date <= '2014-09-11 14:33:06'::timestamp LIMIT 50;
stats
WITH _q AS ( SELECT s_name, s_address FROM supplier, nation WHERE 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_suppkey = ps_suppkey AND l_shipdate >=...
tpch
SELECT MIN(cn.name) AS movie_company, MIN(mi_idx.info) AS rating, MIN(t.title) AS western_violent_movie FROM company_name AS cn, company_type AS ct, info_type AS it1, info_type AS it2, keyword AS k, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS mi_idx, movie_keyword AS mk, title AS t WHERE...
job
Select COUNT(1) From comments As c, posts As p, votes As v Where c.Score = 0 AND c.PostId = p.Id AND v.VoteTypeId = 2 AND p.Id = v.PostId LIMIT 20;
stats
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 an.person_id = n.id AND ci.movie_id = mk.movie_id AND cn.country_code = '[us]' AND mk.keywo...
job
With year_total As ( Select c_email_address As customer_email_address, 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_last_name As customer_last_name, c_first_name As customer_first_name, c_birth_country As customer_birth_country, c_cu...
tpcds
SELECT COUNT(*) FROM postHistory AS ph, posts AS p, votes AS v, badges AS b, users AS u, comments AS c WHERE p.Id = c.PostId AND u.Id = b.UserId AND u.Id = p.OwnerUserId AND p.Id = ph.PostId AND p.Score <= 192 AND p.ViewCount >= 0 AND p.Id = v.PostId
stats
SELECT MIN(mi.info) AS release_date, MIN(miidx.info) AS rating, MIN(t.title) AS german_movie FROM company_name AS cn, company_type AS ct, info_type AS it, info_type AS it2, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS miidx, title AS t WHERE mi.movie_id = mc.movie_id AND kt.id = t.kind_id...
job
SELECT MIN(an.name) AS acress_pseudonym, MIN(t.title) AS japanese_anime_movie FROM aka_name AS an, cast_info AS ci, company_name AS cn, company_type AS ct, keyword AS k, movie_companies AS mc, movie_keyword AS mk, name AS n, role_type AS rt, title AS t WHERE an.person_id = n.id AND mk.movie_id = mc.movie_id AND rt.role...
job
SELECT MIN(an.name) AS acress_pseudonym, MIN(t.title) AS japanese_anime_movie FROM aka_name AS an, cast_info AS ci, company_name AS cn, company_type AS ct, keyword AS k, movie_companies AS mc, movie_keyword AS mk, name AS n, role_type AS rt, title AS t WHERE ci.role_id = rt.id AND t.id = ci.movie_id AND t.production_ye...
job
SELECT COUNT(*) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v, users AS u WHERE p.Id = v.PostId AND p.PostTypeId = 1 AND p.Id = c.PostId AND p.Id = ph.PostId AND p.Id = pl.PostId AND u.Id = p.OwnerUserId AND p.AnswerCount >= 0 LIMIT 1000;
stats
SELECT AVG(ss_ext_wholesale_cost), SUM(ss_ext_wholesale_cost), AVG(ss_quantity), AVG(ss_ext_sales_price) 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 t.production_year > 2010 AND t.id = mk.movie_id AND k.id = mk.keyword_id AND k.keyword = 'marvel-cinematic-universe' AND t.id = ci.movie_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 mk.movie_id = mi.movie_id and k.keyword like '%sequel%' and t.id = mi.movie_id and t.production_year > 2000 and t.id = mk.movie_id and k.id = mk.keyword_id and mi.info in ('Sweden', 'Norway', 'Germany', 'Denmar...
job
SELECT MIN(t.title) AS american_movie FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info AS mi, title AS t WHERE t.id = mc.movie_id AND (mc.note LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%') AND ct.kind = 'production companies' AND ct.id = mc.company_type_id AND mc.note NOT LIKE '%(a...
job
SELECT SUM(amount) AS sum_profit, nation, o_year 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_suppkey = l_suppkey AND o_orderkey = l_orderkey AND s_supp...
tpch
SELECT a.ca_state AS state, COUNT(*) AS cnt 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(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 s_acctbal, s_name, n_name, p_partkey, p_mfgr, s_address, s_phone, s_comment FROM part, supplier, partsupp, nation, region WHERE ps_supplycost = ( SELECT MIN(ps_supplycost) FROM partsupp, supplier, nation, region WHERE p_partkey = ps_partkey AND s_suppkey = ps_suppkey AND s_nationkey = n_nationkey AND n_regionkey...
tpch
SELECT c_phone, c_comment, c_custkey, c_acctbal, n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue, c_name, 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(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 k.id = mk.keyword_id and mk.movie_id = mi.movie_id and t.production_year > 2000 and mi.info in ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Danish', 'Norwegian', 'German'...
job
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 u.Id = p.OwnerUserId AND p.ViewCount >= 0 AND p.Id = c.PostId AND p.Score <= 192 AND p.Id = ph.PostId AND p.Id = v.PostId LIMIT 200;
stats
Select l_shipmode, Sum( Case When o_orderpriority = '1-URGENT' Or o_orderpriority = '2-HIGH' Then 1 Else 0 End ) As high_line_count, Sum( Case When o_orderpriority <> '1-URGENT' And o_orderpriority <> '2-HIGH' Then 1 Else 0 End ) As low_line_count From orders, lineitem Where 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 mc.movie_id = mk.movie_id AND an.person_id = ci.person_id AND ci.movie_id = mk.movie_id AND...
job
select i_brand_id as brand_id, i_brand as brand, sum(ss_ext_sales_price) as ext_price from date_dim INNER JOIN store_sales on d_date_sk = ss_sold_date_sk INNER JOIN item on ss_item_sk = i_item_sk where d_year = 2000 AND i_manager_id = 97 AND d_moy = 11 group by i_brand, i_brand_id order by ext_price desc, brand_id limi...
tpcds
SELECT COUNT(1) FROM postHistory AS ph, posts AS p, votes AS v, badges AS b, users AS u, comments AS c WHERE p.Id = v.PostId AND p.Id = ph.PostId AND p.ViewCount >= 0 AND p.Id = c.PostId AND u.Id = b.UserId AND u.Id = p.OwnerUserId AND p.Score <= 192
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 t.id = mk.movie_id AND mc.movie_id = mk.movie_id AND 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 =...
job
SELECT nation, o_year, SUM(amount) AS sum_profit FROM ( SELECT n_name AS nation, EXTRACT(YEAR FROM o_orderdate) AS o_year, l_extendedprice * (1 - l_discount) - ps_supplycost * l_quantity AS amount FROM part, supplier, lineitem, partsupp, orders, nation WHERE o_orderkey = l_orderkey AND s_nationkey = n_nationkey AND ps_...
tpch
Select Count(*) From posts As p, postLinks As pl, users As u Where p.Id = pl.PostId And p.OwnerUserId = u.Id And p.CommentCount <= 17 And u.CreationDate <= '2014-09-12 07:12:16'::timestamp
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 ='[de]' AND k.keyword ='character-name-in-title' AND t.id = mk.movie_id AND mk.keyword_id = k.id AND cn.id = mc.company_id AND mc.movie_id = t.id AND mc.movie_id = mk.mo...
job
SELECT i_item_desc, i_item_id, i_current_price FROM item JOIN inventory ON i_item_sk = inv_item_sk JOIN date_dim ON d_date_sk = inv_date_sk JOIN catalog_sales ON cs_item_sk = i_item_sk WHERE i_current_price >= 95 AND i_manufact_id IN (148, 455, 491, 85) AND inv_quantity_on_hand BETWEEN 100 AND 500 AND i_current_price <...
tpcds
SELECT supp_nation, cust_nation, l_year, SUM(volume) AS revenue FROM ( SELECT n1.n_name AS supp_nation, n2.n_name AS cust_nation, EXTRACT(YEAR FROM l_shipdate) AS l_year, l_extendedprice * (1 - l_discount) AS volume FROM supplier, lineitem, orders, customer, nation n1, nation n2 WHERE o_orderkey = l_orderkey AND c_nati...
tpch
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 BETWEEN 16 AND 16 + 10 OR ss_coupon_amt BETWEEN 665 AND 665 + 1000 OR ss_wholesale_cost BETWEEN 67 AND 67 + 20) ) AS b1, ( SELECT AVG(ss_list_price) AS b2_lp...
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 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 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 p_name ...
tpch
SELECT MIN(t.title) AS marvel_movie, MIN(k.keyword) AS movie_keyword, 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 k.id = mk.keyword_id AND t.id = mk.movie_id AND t.production_year > 2010 AND n.id = ci.person_id AND k.keyword = 'marvel-cinematic-universe...
job
WITH year_total AS ( SELECT c_email_address AS customer_email_address, c_customer_id AS customer_id, c_first_name AS customer_first_name, c_login AS customer_login, c_birth_country AS customer_birth_country, 's' AS sale_type, d_year AS dyear, c_preferred_cust_flag AS customer_preferred_cust_flag, c_last_name AS custome...
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 NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND t.id = mi.movie_id AND t.id = mc.movie_id AND mc.movie_id = mi.movie_id AND (mc.note LIKE '%(co-production)%' OR mc.note LI...
job
Select Min(t.title) As movie_title From company_name As cn, keyword As k, movie_companies As mc, movie_keyword As mk, title As t Where mk.keyword_id = k.id AND mc.movie_id = t.id AND mc.movie_id = mk.movie_id AND cn.id = mc.company_id AND cn.country_code ='[nl]' AND t.id = mk.movie_id AND k.keyword ='character-name-In-...
job
SELECT ss_ticket_number, cnt, c_preferred_cust_flag, c_first_name, 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 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(t.title) AS movie_title FROM keyword AS k, movie_info AS mi, movie_keyword AS mk, title AS t WHERE mi.info IN ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Denish', 'Norwegian', 'German') AND t.production_year > 2005 AND k.id = mk.keyword_id AND k.keyword LIKE '%sequel%' AND mk.movie_id = mi.movie_i...
job
SELECT MAX(mc.note) AS production_note, MAX(t.title) AS movie_title, MAX(t.production_year) AS movie_year FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info_idx AS mi_idx, title AS t WHERE mc.movie_id = mi_idx.movie_id AND (mc.note LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%') AND ct...
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.role = 'actor' AND t.id = ci.movie_id AND ci.note Like '%(uncredited)%' AND cn.country_code = '[r...
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_shipdate < l_commitdate AND l_commitdate <...
tpch
SELECT AVG(ss_list_price) AS agg2, AVG(ss_coupon_amt) AS agg3, i_item_id, AVG(ss_sales_price) AS agg4, AVG(ss_quantity) AS agg1 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(t.title) AS american_movie FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info AS mi, title AS t WHERE mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND it.id = mi.info_type_id AND (mc.note LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%') AND mc.movie_id = mi.movie_id...
job
SELECT COUNT(1) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v WHERE p.FavoriteCount >= 0 AND pl.LinkTypeId = 1 AND p.Id = v.PostId AND p.Id = c.PostId AND p.Id = pl.PostId AND c.Score = 0 AND p.Id = ph.PostId
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 ( (n1.n_...
tpch
WITH _q AS ( Select p_brand, p_type, p_size, Count(Distinct ps_suppkey) As supplier_cnt From partsupp, part Where p_partkey = ps_partkey AND p_type Not Like 1 AND ps_suppkey Not In ( Select s_suppkey From supplier Where s_comment Like '%Customer%Complaints%' ) AND p_brand != 1 AND p_size In (1, 1, 1, 1, 1, 1, 1, 1) Gro...
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 n.id = ci.person_id AND mc.note LIKE '%(USA)%' AND mi.movie_id = ci.movie...
job
WITH year_total AS ( SELECT c_login AS customer_login, d_year AS dyear, c_first_name AS customer_first_name, 's' AS sale_type, c_last_name AS customer_last_name, c_preferred_cust_flag AS customer_preferred_cust_flag, c_customer_id AS customer_id, c_birth_country AS customer_birth_country, c_email_address AS customer_em...
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 it2.info = 'release dates' and at.movie_id = mi.movie_id and t.id = mi...
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.info = 'release dates' AND ct.kind = 'produ...
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(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 cn.id = mc.company_id AND ci.role_id = rt.id AND mc.note NOT ...
job
SELECT n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, supplier, nation, region WHERE c_nationkey = s_nationkey AND s_nationkey = n_nationkey AND o_orderdate >= DATE 1 AND o_orderdate < DATE 1 + INTERVAL '1' YEAR AND l_orderkey = o_orderkey AND n_regionkey = r_regionkey AND r...
tpch
select min(t.title) as movie_title from company_name as cn, keyword as k, movie_companies as mc, movie_keyword as mk, title as t where cn.country_code ='[sm]' AND mc.movie_id = t.id AND mk.keyword_id = k.id AND k.keyword ='character-name-in-title' AND cn.id = mc.company_id AND t.id = mk.movie_id AND mc.movie_id = mk.mo...
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 = at.movie_id AND kt.id = t.kind_id AND mi.movie_id = mc.movie_id...
job
SELECT s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE s_suppkey = l1.l_suppkey AND n_name = 1 AND o_orderstatus = 'F' AND EXISTS ( SELECT * FROM lineitem l2 WHERE l2.l_orderkey = l1.l_orderkey AND l2.l_suppkey <> l1.l_suppkey ) AND NOT EXISTS ( SELECT * FROM lineitem l3 WHERE l3.l_orderkey...
tpch
Select Avg(cs_quantity) As agg1, Avg(cs_sales_price) As agg4, Avg(cs_list_price) As agg2, i_item_id, Avg(cs_coupon_amt) As agg3 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 Min(t.title) As movie_title From keyword As k, movie_info As mi, movie_keyword As mk, title As t Where mi.info In ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Danish', 'Norwegian', 'German') AND t.id = mk.movie_id AND k.id = mk.keyword_id AND k.keyword Like '%sequel%' AND t.production_year > 2000 AND m...
job
SELECT c_address, c_comment, c_phone, SUM(l_extendedprice * (1 - l_discount)) AS revenue, c_custkey, c_acctbal, c_name, n_name FROM customer, orders, lineitem, nation WHERE o_orderdate < DATE 1 + INTERVAL '3' MONTH AND l_returnflag = 'R' AND c_custkey = o_custkey AND c_nationkey = n_nationkey AND l_orderkey = o_orderke...
tpch
Select dt.d_year, Sum(ss_ext_sales_price) As ext_price, item.i_brand_id As brand_id, item.i_brand As brand 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 = 69 AND dt.d_year = 2000 AND dt.d_moy = 11 Group By ...
tpcds
SELECT MIN(mi_idx.info) AS rating, MIN(cn.name) AS movie_company, 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 MAX(mi_idx.info) AS rating, MAX(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.production_year BETWEEN 2000 AND 2010 AND it.info ='rating' AND mi_idx.info > '7.0' AND t.id = mi_idx.movie_id
job