text
stringlengths
84
1.49k
benchmark
stringclasses
4 values
Select cnt, c_last_name, c_first_name, c_preferred_cust_flag, 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
With ss As ( Select i_manufact_id, Sum(ss_ext_sales_price) As total_sales From store_sales INNER JOIN date_dim On ss_sold_date_sk = d_date_sk INNER JOIN customer_address On ss_addr_sk = ca_address_sk INNER JOIN item On ss_item_sk = i_item_sk Where d_year = 2001 AND d_moy = 11 AND i_category In ('Sports') AND ca_gmt_off...
tpcds
SELECT i_brand AS brand, i_brand_id AS brand_id, SUM(ss_ext_sales_price) AS ext_price, i_manufact, i_manufact_id FROM date_dim JOIN store_sales ON d_date_sk = ss_sold_date_sk JOIN item ON ss_item_sk = i_item_sk JOIN customer ON ss_customer_sk = c_customer_sk JOIN customer_address ON c_current_addr_sk = ca_address_sk JO...
tpcds
Select Min(cn.name) As from_company, Min(t.title) As western_sequel, Min(lt.link) As link_type 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 mk.movie_id = mc.movie_id AND t.id ...
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 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 SUM(amount) AS sum_profit, o_year, nation FROM ( SELECT n_name AS nation, EXTRACT(YEAR FROM o_orderdate) AS o_year, l_extendedprice * (1 - l_discount) - ps_supplycost * l_quantity AS amount FROM part, supplier, lineitem, partsupp, orders, nation WHERE ps_partkey = l_partkey AND ps_suppkey = l_suppkey AND p_partk...
tpch
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 c...
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 mk.movie_id = mi.movie_id AND t.id = mk.movie_id AND k.id = mk.keyword_id AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Danish', 'Norw...
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 kt.id = t.kind_id AND cn.country_code = '[de]' ...
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 k.keyword = 'marvel-cinematic-universe' AND t.id = ci.movie_id AND n.name LIKE '%Hemsworth%Chris%' AND n.id = ci.per...
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.production_year > 2000 AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Danish', 'Norwegian', 'German') AND k.id = mk.keyword_i...
job
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 INNER JOIN store_returns ON store_sales.ss_customer_sk = store_returns.sr_customer_sk AND store_sales.ss_item_sk = store_...
tpcds
SELECT AVG(ss_sales_price) AS agg4, AVG(ss_coupon_amt) AS agg3, AVG(ss_quantity) AS agg1, AVG(ss_list_price) AS agg2, i_item_id 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
WITH _q AS ( SELECT MIN(mc.note) AS production_note, MIN(t.title) AS movie_title, MIN(t.production_year) AS movie_year FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info_idx AS mi_idx, title AS t WHERE mc.movie_id = mi_idx.movie_id AND (mc.note LIKE '%(co-production)%' OR mc.note LIKE '%(presen...
job
Select Min(an.name) As cool_actor_pseudonym, Min(t.title) As series_named_after_char From aka_name As an, cast_info As ci, company_name As cn, keyword As k, movie_companies As mc, movie_keyword As mk, name As n, title As t Where t.episode_nr < 100 AND k.keyword = 'character-name-In-title' AND cn.country_code = '[us]' A...
job
SELECT COUNT(1) FROM comments AS c, posts AS p, postLinks AS pl, votes AS v WHERE c.CreationDate >= '2010-08-02 23:52:10'::timestamp AND p.Score >= -3 AND v.VoteTypeId = 2 AND pl.PostId = v.PostId AND c.PostId = pl.PostId AND p.Id = c.PostId
stats
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 mc.movie_id = t.id AND t.id = mk.movie_id AND k.keyword ='character-name-IN-title' AND mk.keyword_id = k.id AND mc.movie_id = mk.movie_id AND cn.country_code ='[nl]' AND cn...
job
SELECT AVG(cs_sales_price) AS agg4, i_item_id, AVG(cs_quantity) AS agg1, AVG(cs_coupon_amt) AS agg3, AVG(cs_list_price) AS agg2 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(mc.note) AS production_note, MIN(t.title) AS movie_title, MIN(t.production_year) AS movie_year FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info_idx AS mi_idx, title AS t WHERE ct.kind = 'production companies' AND ct.id = mc.company_type_id AND mc.note NOT LIKE '%(as Metro-Goldwyn-M...
job
SELECT i_current_price, i_item_id, i_item_desc FROM item JOIN inventory ON i_item_sk = inv_item_sk JOIN date_dim ON d_date_sk = inv_date_sk JOIN store_sales ON ss_item_sk = i_item_sk WHERE inv_quantity_on_hand BETWEEN 100 AND 500 AND i_current_price BETWEEN 80 AND 80 + 30 AND i_manufact_id = ANY(ARRAY[427, 128, 154, 9]...
tpcds
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_commitdate < l_re...
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 c_nationkey = n1.n_na...
tpch
select sum(l_extendedprice) / 7.0 as avg_yearly from lineitem, part where p_container = 1 and l_quantity < ( select 0.2 * avg(l_quantity) from lineitem where l_partkey = p_partkey ) and p_brand = 1 and p_partkey = l_partkey
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 t.production_year > 2000 AND cn.country_code = '[us]' AND mi.movie_id = c...
job
Select cntrycode, Count(1) As numcust, Sum(c_acctbal) As totacctbal From ( Select SUBSTRING(c_phone From 1 FOR 2) As cntrycode, c_acctbal From customer Where Not Exists ( Select * From orders Where o_custkey = c_custkey ) ) As custsale AND SUBSTRING(c_phone From 1 FOR 2) In (1, 1, 1, 1, 1, 1, 1) AND c_acctbal > ( Selec...
tpch
SELECT SUM(l_extendedprice) / 7.0 AS avg_yearly FROM lineitem, part WHERE p_partkey = l_partkey AND l_quantity < ( SELECT 0.2 * AVG(l_quantity) FROM lineitem WHERE l_partkey = p_partkey ) AND p_brand = 1 AND p_container = 1 LIMIT 50;
tpch
SELECT n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, supplier, nation, region WHERE o_orderdate >= DATE 1 AND c_custkey = o_custkey AND c_nationkey = s_nationkey AND n_regionkey = r_regionkey AND l_suppkey = s_suppkey AND o_orderdate < DATE 1 + INTERVAL '1' YEAR AND r_name ...
tpch
with year_total as ( select c_last_name as customer_last_name, sum(((ss_ext_list_price - ss_ext_wholesale_cost - ss_ext_discount_amt) + ss_ext_sales_price) / 2) as year_total, d_year as dyear, 's' as sale_type, c_login as customer_login, c_first_name as customer_first_name, c_email_address as customer_email_address, c_...
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 k.keyword = 'anime' AND cn.id = mc.company_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, 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 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 <= 91 + 30 AND inv_quantity_on_hand BETWEEN 100 AND 500 AND i_manufact_id in (438, 38, 405, 276) AND i_current_pric...
tpcds
select count(ss_quantity) as store_sales_quantitycount, STDDEV_SAMP(ss_quantity) as store_sales_quantitystdev, i_item_desc, STDDEV_SAMP(sr_return_quantity) / avg(sr_return_quantity) as store_returns_quantitycov, s_state, count(cs_quantity) as catalog_sales_quantitycount, avg(ss_quantity) as store_sales_quantityave, avg...
tpcds
SELECT s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE o_orderstatus = 'F' AND o_orderkey = l1.l_orderkey AND s_nationkey = n_nationkey AND EXISTS ( SELECT * FROM lineitem l2 WHERE l2.l_orderkey = l1.l_orderkey AND l2.l_suppkey <> l1.l_suppkey ) AND n_name = 1 AND l1.l_receiptdate > l1.l_co...
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 mi.movie_id = mi_idx.movie_id and cn.country_code = '[us]' and at.movi...
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 t.id = mi.movie_id AND t.id = mk.movie_id AND k.id = mk.keyword_id AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Danish', 'Swedish', 'Danish', 'Norwegian', 'German') AND t.produc...
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 ( (n1.n_name = 1 AND n2.n_name = 1...
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.production_year > 2005 and mi.info in ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Denish', 'Norwegian', 'German') and t.id = mk.movie_id and mk.movie_id = mi.movie_id and k.keyword like '%sequel%' ...
job
WITH _q AS ( SELECT COUNT(*) FROM votes AS v, posts AS p, badges AS b, users AS u WHERE u.Reputation >= 1 ) SELECT * FROM _q AND u.Id = p.OwnerUserId AND p.Id = v.PostId AND p.Score <= 22 AND u.Id = b.UserId
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
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 = n1.id AND ci.movie_id = t.id AND n1.name LIKE '%Yo%' AND n1.name NOT LIKE '%Yu%' AND ci.role_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 mi.movie_id = mc.movie_id And mc.movie_id = t.i...
job
SELECT MIN(t.title) AS movie_title FROM company_name AS cn, keyword AS k, movie_companies AS mc, movie_keyword AS mk, title AS t WHERE mc.movie_id = mk.movie_id AND mk.keyword_id = k.id AND cn.id = mc.company_id AND mc.movie_id = t.id AND k.keyword ='character-name-IN-title' AND t.id = mk.movie_id 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 ps_suppkey = l_suppkey AND p_part...
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.id = mk.keyword_id AND n.name Like '%Hemsworth%Chris%' AND t.id = mk.movie_id AND k.keyword = 'marvel-cinematic-universe' AND t.productio...
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 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 l_orderkey = o_orderkey AND c_nationkey = n_nationkey AND o_orderdate < DATE 1 + INTERVAL '3' MONTH AND l_returnflag = 'R' AND o_orderdate >= DATE ...
tpch
WITH _q AS ( 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_partke...
tpch
SELECT c_count, COUNT(*) AS custdist FROM ( SELECT c_custkey, COUNT(o_orderkey) AS c_count FROM customer LEFT JOIN orders ON c_custkey = o_custkey AND o_comment NOT LIKE 1 GROUP BY c_custkey ) AS c_orders GROUP BY c_count ORDER BY custdist ASC, c_count ASC LIMIT 50;
tpch
SELECT c_acctbal, c_phone, c_custkey, c_name, c_comment, SUM(l_extendedprice * (1 - l_discount)) AS revenue, c_address, n_name 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(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 cn.country_code = '[ru]' AND ci.movie_id = mc.movie_id AND t.id = mc.movie_id AND rt.id = ci.role_id...
job
SELECT ss_ticket_number, ca_city, bought_city, list_price, c_last_name, extended_tax, extended_price, c_first_name 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 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 t.id = ci.movie_id AND ci.movie_id = mc.movie_id AND it.id = mi.info_type...
job
SELECT MAX(cs_net_profit) AS catalog_sales_profit, MAX(sr_net_loss) AS store_returns_loss, i_item_id, MAX(ss_net_profit) AS store_sales_profit, i_item_desc, s_store_name, s_store_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 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 l_shipda...
tpch
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 cn.country_code = '[ru]' AND chn.id = ci.person_role_id AND ci.movie_id = mc.movie_id AND ct.id = mc...
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 chn.id = ci.person_role_id AND cn.id = mc.company_id AND ci.note IN ('(vo...
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 p.Id = c.PostId AND u.Id = p.OwnerUserId AND p.Id = ph.PostId AND p.Id = v.PostId AND p.Score <= 192 AND p.ViewCount >= 0
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.id = ci.person_id AND t.production_year > 2010 AND k.keyword = 'marvel-cinematic-universe' AND k.id = mk.keyword_id AND ci.movie_id = mk....
job
SELECT AVG(cs_quantity) AS agg1, AVG(cs_sales_price) AS agg4, i_item_id, AVG(cs_list_price) AS agg2, AVG(cs_coupon_amt) AS agg3 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 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 s_suppkey = l_suppkey...
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 at.movie_id = mi_idx.movie_id AND it2.id = mi.info_type_id AND t.id = ...
job
SELECT MAX(an.name) AS acress_pseudonym, MAX(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 mc.note LIKE '%(Japan)%' AND t.id = mc.mov...
job
SELECT MIN(t.title) AS movie_title FROM company_name AS cn, keyword AS k, movie_companies AS mc, movie_keyword AS mk, title AS t WHERE mc.movie_id = mk.movie_id AND cn.id = mc.company_id AND t.id = mk.movie_id AND mc.movie_id = t.id AND cn.country_code ='[sm]' AND mk.keyword_id = k.id AND k.keyword ='character-name-in-...
job
select avg(cs_quantity) as agg1, avg(cs_list_price) as agg2, avg(cs_sales_price) as agg4, avg(cs_coupon_amt) as agg3, 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(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
WITH year_total AS ( SELECT c_last_name AS customer_last_name, SUM(((ss_ext_list_price - ss_ext_wholesale_cost - ss_ext_discount_amt) + ss_ext_sales_price) / 2) AS year_total, c_first_name AS customer_first_name, 's' AS sale_type, c_birth_country AS customer_birth_country, c_preferred_cust_flag AS customer_preferred_cu...
tpcds
with year_total as ( select 's' as sale_type, c_first_name as customer_first_name, c_login as customer_login, c_customer_id as customer_id, 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_preferred_cust_flag as customer_preferred_cust_f...
tpcds
SELECT SUM(cs_quantity) AS catalog_sales_quantity, SUM(sr_return_quantity) AS store_returns_quantity, s_store_name, SUM(ss_quantity) AS store_sales_quantity, i_item_desc, i_item_id, 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 o_orderkey, o_orderdate, c_custkey, SUM(l_quantity), c_name, 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(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 mi.movie_id = mc.m...
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 mc.note NOT LIKE '%(USA)%' AND an1.person_id = ci.person_id AND ci.movie_id = mc.movie_id AND ci.movie_id = t.i...
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 cn.country_code = '[us]' AND ci.movie_id = mk.movie_id AND n.id = ci.person_id AND k.keywor...
job
SELECT MIN(mc.note) AS production_note, MIN(t.title) AS movie_title, MIN(t.production_year) AS movie_year FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info_idx AS mi_idx, title AS t WHERE ct.id = mc.company_type_id AND t.id = mc.movie_id AND it.id = mi_idx.info_type_id AND mc.note NOT LIKE '%(...
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 mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND (mc.note LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%') AND mc.movie_id = mi.movie_id AND ct.kind = 'production c...
job
SELECT c_custkey, o_orderkey, SUM(l_quantity), o_orderdate, o_totalprice, c_name FROM customer, orders, lineitem WHERE o_orderkey IN ( SELECT l_orderkey FROM lineitem GROUP BY l_orderkey HAVING SUM(l_quantity) > 1 ) AND c_custkey = o_custkey AND o_orderkey = l_orderkey GROUP BY c_name, c_custkey, o_orderkey, o_orderdat...
tpch
SELECT cnt, c_salutation, c_first_name, ss_ticket_number, c_last_name, c_preferred_cust_flag 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(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 t.id = mi.movie_id AND it.id = mi.info_type_id AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND (mc.note LIKE '%(co-production)%' OR mc.note LIKE...
job
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 mc.movie_id = mk.movie_id ) SELECT * FROM _q AND mk.keyword_id = k.id AND t.id = mk.movie_id AND cn.id = mc.company_id AND cn.country_code ='[nl]' AND mc.movie_id = t.id AN...
job
select s_name, count(1) as numwait from supplier, lineitem l1, orders, nation where n_name = 1 AND 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 o_orderstatus = 'F' AND o_orderkey = l...
tpch
SELECT AVG(ss_coupon_amt) AS agg3, i_item_id, AVG(ss_sales_price) AS agg4, AVG(ss_list_price) AS agg2, 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 COUNT(1) FROM store_sales INNER JOIN household_demographics ON ss_hdemo_sk = hd_demo_sk INNER JOIN time_dim ON ss_sold_time_sk = t_time_sk INNER JOIN store ON ss_store_sk = s_store_sk WHERE hd_dep_count = 2 AND t_minute >= 35 AND t_hour = 10 AND s_store_name = 'ation' ORDER BY COUNT(1) DESC;
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 t.id = mi_idx.movie_id AND at.movie_id = mi_idx.movie_id AND mi_idx.mo...
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 s_acctbal, s_name, n_name, p_partkey, p_mfgr, s_address, s_phone, s_comment FROM part, supplier, partsupp, nation, region WHERE p_partkey = ps_partkey AND ps_supplycost = ( SELECT MAX(ps_supplycost) FROM partsupp, supplier, nation, region WHERE p_partkey = ps_partkey AND s_suppkey = ps_suppkey AND s_nationkey = ...
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 mk.keyword_id = k.id AND mc.movie_id = t.id AND mc.movie_id = mk.movie_id AND k.keyword ='character-name-in-title' AND cn.country_code ='[sm]' AND t.id = mk.movie_id AND cn.id = mc.comp...
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 l_shipdate BETWEEN DATE '1995-01-0...
tpch
SELECT MIN(t.title) AS movie_title FROM keyword AS k, movie_info AS mi, movie_keyword AS mk, title AS t WHERE mk.movie_id = mi.movie_id AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Danish', 'Norwegian', 'German') AND k.id = mk.keyword_id AND t.id = mi.movie_id AND t.production_year > 2000 AND t...
job
Select l_shipmode, Sum( Case When o_orderpriority = '1-URGENT' Or o_orderpriority = '2-HIGH' Then 1 Else 0 End ) As high_line_count, Sum( Case When o_orderpriority <> '1-URGENT' And o_orderpriority <> '2-HIGH' Then 1 Else 0 End ) As low_line_count From orders, lineitem Where o_orderkey = l_orderkey And l_commitdate < l...
tpch
SELECT 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 s_suppkey = l_suppkey...
tpch
SELECT promotions, total, CAST(promotions AS DECIMAL(15, 4)) / CAST(total AS DECIMAL(15, 4)) * 100 FROM ( SELECT SUM(ss_ext_sales_price) AS promotions FROM store_sales JOIN store ON ss_store_sk = s_store_sk JOIN promotion ON ss_promo_sk = p_promo_sk JOIN date_dim ON ss_sold_date_sk = d_date_sk JOIN customer ON ss_custo...
tpcds
SELECT MAX(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 mk.movie_id = mi.movie_id AND mi.info = ANY(ARRAY['Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Danish', 'Norwegian', 'German']) AND t.id = mk.movie_id AND k.keyword LIKE '%sequel...
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 cn.country_code = '[de]' AND ct.kind = 'product...
job
WITH year_total AS ( SELECT c_last_name AS customer_last_name, d_year AS dyear, c_first_name AS customer_first_name, c_login AS customer_login, c_email_address AS customer_email_address, 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 cus...
tpcds
SELECT c_name, o_orderdate, o_totalprice, c_custkey, SUM(l_quantity), o_orderkey 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 SUM(ss_ext_wholesale_cost), AVG(ss_quantity), AVG(ss_ext_sales_price), AVG(ss_ext_wholesale_cost) FROM store_sales JOIN store ON s_store_sk = ss_store_sk JOIN customer_demographics ON cd_demo_sk = ss_cdemo_sk JOIN household_demographics ON hd_demo_sk = ss_hdemo_sk JOIN customer_address ON ca_address_sk = ss_addr...
tpcds
SELECT MIN(t.title) AS movie_title FROM keyword AS k, movie_info AS mi, movie_keyword AS mk, title AS t WHERE mk.movie_id = mi.movie_id AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Danish', 'Norwegian', 'German') AND t.id = mk.movie_id AND k.id = mk.keyword_id AND t.production_year > 2000 AND t...
job
Select Count(*) From badges As b, users As u Where b.UserId = u.Id And u.UpVotes >= 0 LIMIT 1000;
stats
select c_name, o_orderdate, c_custkey, o_orderkey, o_totalprice, sum(l_quantity) 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