text
stringlengths
84
1.49k
benchmark
stringclasses
4 values
select min(cn.name) as from_company, min(lt.link) as link_type, min(t.title) as western_sequel from company_name as cn, company_type as ct, info_type as it, keyword as k, link_type as lt, movie_companies as mc, movie_info as mi, movie_keyword as mk, movie_link as ml, title as t where t.production_year > 1950 and lt.id = ml.link_type_id and mi.movie_id = t.id and k.keyword in ('sequel', 'revenge', 'based-on-novel') and cn.id = mc.company_id and ml.movie_id = mc.movie_id and mc.note not like '%(as Metro-Goldwyn-Mayer Pictures)%' and mi.note like '%internet%' and it.id = mi.info_type_id and t.id = mc.movie_id and ct.id = mc.company_type_id and ml.movie_id = mk.movie_id and mk.movie_id = mc.movie_id and mi.info like 'USA:% 199%' and k.id = mk.keyword_id and t.id = ml.movie_id and mc.note like '%(USA)%' and it.info = 'release dates' and cn.country_code = '[us]' and t.id = mk.movie_id and lt.link like '%follow%' and ml.movie_id = mi.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 cn.id = mc.company_id AND chn.id = ci.person_role_id AND ci.note LIKE '%(uncredited)%' AND t.id = mc.movie_id AND ci.note LIKE '%(voice)%' AND rt.role = 'actor' AND ct.id = mc.company_type_id AND cn.country_code = '[ru]' AND rt.id = ci.role_id AND ci.movie_id = mc.movie_id AND t.id = ci.movie_id AND t.production_year > 2005
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 at.title LIKE '%Champion%' AND cn.country_code = '[us]' AND it2.id = mi.info_type_id AND it1.id = mi_idx.info_type_id AND at.movie_id = mi_idx.movie_id AND mi_idx.info < '3.5' AND it1.info = 'rating' AND mi.movie_id = mc.movie_id AND t.id = mi_idx.movie_id AND mi_idx.movie_id = mc.movie_id AND at.movie_id = mc.movie_id AND kt.id = t.kind_id AND t.id = mi.movie_id AND mi.movie_id = mi_idx.movie_id AND t.production_year > 2000 AND it2.info = 'release dates' AND mi.info LIKE 'USA:%200%' AND kt.kind = 'movie' AND t.id = at.movie_id AND t.id = mc.movie_id AND cn.id = mc.company_id AND at.movie_id = mi.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 t.production_year > 2010 AND k.keyword = 'marvel-cinematic-universe' AND t.id = mk.movie_id AND ci.movie_id = mk.movie_id AND t.id = ci.movie_id AND k.id = mk.keyword_id AND n.name LIKE '%Hemsworth%Chris%' AND n.id = ci.person_id LIMIT 500;
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 like '%(co-production)%' or mc.note like '%(presents)%') AND ct.kind = 'production companies' AND mc.movie_id = mi.movie_id AND t.id = mi.movie_id AND ct.id = mc.company_type_id AND it.info = 'bottom 10 rank' AND mc.note not like '%(as Metro-Goldwyn-Mayer Pictures)%' AND t.id = mc.movie_id AND it.id = mi.info_type_id
job
WITH _q AS ( SELECT SUM(ss_ext_sales_price) AS ext_price, i_brand_id AS brand_id, i_manufact, i_brand AS brand, i_manufact_id 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 INNER JOIN customer ON ss_customer_sk = c_customer_sk INNER JOIN customer_address ON c_current_addr_sk = ca_address_sk INNER JOIN store ON ss_store_sk = s_store_sk WHERE d_moy = 12 AND substr(ca_zip, 1, 5) <> substr(s_zip, 1, 5) AND i_manager_id = 3 AND d_year = 1999 GROUP BY i_brand, i_brand_id, i_manufact_id, i_manufact ORDER BY ext_price DESC, brand, brand_id, i_manufact_id, i_manufact LIMIT 100 ) SELECT * FROM _q;
tpcds
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.id = mc.movie_id AND ct.id = mc.company_type_id AND cn.id = mc.company_id AND rt.id = ci.role_id AND t.production_year > 2005 AND cn.country_code = '[ru]' AND t.id = ci.movie_id AND rt.role = 'actor' AND chn.id = ci.person_role_id AND ci.note LIKE '%(uncredited)%' AND ci.note LIKE '%(voice)%' AND ci.movie_id = mc.movie_id
job
SELECT c_first_name, ss_ticket_number, cnt, c_preferred_cust_flag, c_last_name, c_salutation 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 d_dom BETWEEN 1 AND 2 AND (hd_buy_potential = '1001-5000' OR hd_buy_potential = '5001-10000') AND hd_vehicle_count > 0 AND d_year IN (1999, 2001, 2002) AND s_county IN ('Williamson County', 'Daviess County', 'Oglethorpe County', 'Maricopa County') GROUP BY ss_ticket_number, ss_customer_sk ) AS dj JOIN customer ON ss_customer_sk = c_customer_sk WHERE cnt BETWEEN 1 AND 5 ORDER BY cnt ASC LIMIT 1000;
tpcds
SELECT SUM(l_extendedprice * (1 - l_discount)) AS revenue, n_name FROM customer, orders, lineitem, supplier, nation, region WHERE n_regionkey = r_regionkey AND o_orderdate < DATE 1 + INTERVAL '1' YEAR AND c_nationkey = s_nationkey AND c_custkey = o_custkey AND l_suppkey = s_suppkey AND r_name = 1 AND o_orderdate >= DATE 1 AND l_orderkey = o_orderkey AND s_nationkey = n_nationkey GROUP BY n_name ORDER BY revenue DESC
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 t.id = mc.movie_id AND n1.id = ci.person_id AND n1.name LIKE '%Yo%' AND cn.country_code = '[jp]' AND an1.person_id = n1.id AND ci.role_id = rt.id AND an1.person_id = ci.person_id AND ci.note = '(voice: English version)' AND mc.note LIKE '%(Japan)%' AND mc.company_id = cn.id AND n1.name NOT LIKE '%Yu%' AND rt.role = 'actress' AND ci.movie_id = t.id AND ci.movie_id = mc.movie_id AND mc.note NOT LIKE '%(USA)%'
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 > ( SELECT AVG(c_acctbal) FROM customer WHERE c_acctbal > 0.00 AND SUBSTRING(c_phone FROM 1 FOR 2) IN (1, 1, 1, 1, 1, 1, 1) ) GROUP BY cntrycode ORDER BY cntrycode
tpch
SELECT MIN(n.name) AS of_person, MIN(t.title) AS biography_movie FROM aka_name AS an, cast_info AS ci, info_type AS it, link_type AS lt, movie_link AS ml, name AS n, person_info AS pi, title AS t WHERE (n.gender = 'm' OR (n.gender = 'f' AND n.name LIKE 'B%')) AND t.production_year BETWEEN 1980 AND 1995 AND pi.person_id = ci.person_id AND pi.note = 'Volker Boehm' AND t.id = ci.movie_id AND n.name_pcode_cf BETWEEN 'A' AND 'F' AND an.person_id = ci.person_id AND it.info = 'mini biography' AND ci.movie_id = ml.linked_movie_id AND n.id = an.person_id AND pi.person_id = an.person_id AND it.id = pi.info_type_id AND ml.linked_movie_id = t.id AND lt.link = 'features' AND an.name LIKE '%a%' AND lt.id = ml.link_type_id AND ci.person_id = n.id AND n.id = pi.person_id
job
SELECT MIN(t.title) AS series_named_after_char, MIN(an.name) AS cool_actor_pseudonym FROM aka_name AS an, cast_info AS ci, company_name AS cn, keyword AS k, movie_companies AS mc, movie_keyword AS mk, name AS n, title AS t WHERE mc.movie_id = mk.movie_id AND ci.movie_id = mk.movie_id AND t.id = mc.movie_id AND n.id = ci.person_id AND an.person_id = n.id AND t.id = mk.movie_id AND ci.movie_id = t.id AND mk.keyword_id = k.id AND t.episode_nr < 100 AND mc.company_id = cn.id AND ci.movie_id = mc.movie_id AND cn.country_code = '[us]' AND an.person_id = ci.person_id AND k.keyword = 'character-name-IN-title' AND t.episode_nr >= 50
job
SELECT COUNT(*) FROM comments AS c, posts AS p, votes AS v, users AS u WHERE p.Score >= 0 AND p.ViewCount >= 0 AND u.Id = p.OwnerUserId AND u.Id = c.UserId AND u.Id = v.UserId AND c.Score = 0 LIMIT 50;
stats
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 s_county IN ('Bronz County', 'Daviess County', 'Maricopa County') AND (CASE WHEN hd_vehicle_count > 0 THEN hd_dep_count / hd_vehicle_count ELSE NULL END) > 1.79 AND (hd_buy_potential = '>10000' OR hd_buy_potential = 'Unknown') AND (d_dom >= 1 AND d_dom <= 3 OR d_dom BETWEEN 25 AND 28) AND hd_vehicle_count > 0 AND d_year IN (2000, 2002, 2003) GROUP BY ss_ticket_number, ss_customer_sk ) AS dn JOIN customer ON ss_customer_sk = c_customer_sk WHERE cnt BETWEEN 15 AND 20 ORDER BY c_last_name, c_first_name, c_salutation, cnt DESC LIMIT 100;
tpcds
WITH year_total AS ( SELECT c_birth_country AS customer_birth_country, c_last_name AS customer_last_name, c_customer_id AS customer_id, c_preferred_cust_flag AS customer_preferred_cust_flag, c_email_address AS customer_email_address, 's' AS sale_type, c_first_name AS customer_first_name, d_year AS dyear, c_login AS customer_login, SUM(((ss_ext_list_price - ss_ext_wholesale_cost - ss_ext_discount_amt) + ss_ext_sales_price) / 2) AS year_total FROM customer JOIN store_sales ON c_customer_sk = ss_customer_sk JOIN date_dim ON ss_sold_date_sk = d_date_sk WHERE d_year BETWEEN 2002 AND 2002 + 1 GROUP BY c_customer_id, c_first_name, c_last_name, c_preferred_cust_flag, c_birth_country, c_login, c_email_address, d_year ) SELECT t_s_secyear.customer_id, t_s_secyear.customer_first_name, t_s_secyear.customer_last_name, t_s_secyear.customer_email_address FROM year_total AS t_s_firstyear JOIN year_total AS t_s_secyear ON t_s_firstyear.customer_id = t_s_secyear.customer_id WHERE t_s_firstyear.sale_type = 's' AND t_s_secyear.sale_type = 's' AND t_s_firstyear.dyear = 2002 AND t_s_secyear.dyear = 2002 + 1 AND t_s_firstyear.year_total > 0 AND CASE WHEN t_s_firstyear.year_total > 0 THEN t_s_secyear.year_total / t_s_firstyear.year_total ELSE NULL END > 1.0 ORDER BY t_s_secyear.customer_id, t_s_secyear.customer_first_name, t_s_secyear.customer_last_name, t_s_secyear.customer_email_address LIMIT 100;
tpcds
SELECT MAX(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.production_year > 2005 AND t.id = mk.movie_id AND mk.movie_id = mi.movie_id AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Denish', 'Norwegian', 'German') AND k.id = mk.keyword_id AND t.id = mi.movie_id
job
SELECT MAX(n.name) AS voicing_actress, MAX(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 ci.note IN ('(voice)', '(voice: Japanese version)', '(voice) (uncredited)', '(voice: English version)') AND ci.person_id = an.person_id AND t.id = mc.movie_id AND cn.id = mc.company_id AND n.gender = 'f' AND cn.country_code = '[us]' AND it.id = mi.info_type_id AND an.person_id = n.id AND it.info = 'release dates' AND t.id = ci.movie_id AND rt.role = 'actress' AND mc.note LIKE '%(USA)%' AND t.id = mi.movie_id AND chn.id = ci.person_role_id AND ci.movie_id = mc.movie_id AND mi.movie_id = mc.movie_id AND n.id = ci.person_id AND mi.movie_id = ci.movie_id AND ci.role_id = rt.id
job
SELECT MIN(t.title) AS movie_title FROM company_name AS cn, keyword AS k, movie_companies AS mc, movie_keyword AS mk, title AS t WHERE cn.country_code ='[nl]' AND t.id = mk.movie_id AND mc.movie_id = t.id AND mc.movie_id = mk.movie_id AND k.keyword ='character-name-in-title' AND cn.id = mc.company_id AND mk.keyword_id = k.id
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_returns.sr_item_sk AND store_sales.ss_ticket_number = store_returns.sr_ticket_number INNER JOIN catalog_sales ON store_returns.sr_customer_sk = catalog_sales.cs_bill_customer_sk AND store_returns.sr_item_sk = catalog_sales.cs_item_sk INNER JOIN date_dim AS d1 ON store_sales.ss_sold_date_sk = d1.d_date_sk INNER JOIN date_dim AS d2 ON store_returns.sr_returned_date_sk = d2.d_date_sk INNER JOIN date_dim AS d3 ON catalog_sales.cs_sold_date_sk = d3.d_date_sk INNER JOIN store ON store_sales.ss_store_sk = store.s_store_sk INNER JOIN item ON store_sales.ss_item_sk = item.i_item_sk WHERE d1.d_moy BETWEEN 2 AND 8 AND d2.d_year = 2001 AND d1.d_year = 2001 AND d3.d_moy BETWEEN 2 AND 8 + 3 AND d2.d_moy BETWEEN 2 AND 8 + 3 AND d3.d_year = 2001 GROUP BY i_item_id, i_item_desc, s_store_id, s_store_name ORDER BY i_item_id, i_item_desc, s_store_id, s_store_name LIMIT 100;
tpcds
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 o_orderdate < DATE 1 + INTERVAL '3' MONTH AND c_nationkey = n_nationkey AND l_returnflag = 'R' AND l_orderkey = o_orderkey GROUP BY c_custkey, c_name, c_acctbal, c_phone, n_name, c_address, c_comment ORDER BY revenue ASC LIMIT 20
tpch
SELECT MIN(k.keyword) AS movie_keyword, MIN(t.title) AS marvel_movie, MIN(n.name) AS actor_name FROM cast_info AS ci, keyword AS k, movie_keyword AS mk, name AS n, title AS t WHERE t.id = mk.movie_id AND k.keyword = 'marvel-cinematic-universe' AND t.production_year > 2010 AND n.name LIKE '%Hemsworth%Chris%' AND ci.movie_id = mk.movie_id AND n.id = ci.person_id AND k.id = mk.keyword_id AND t.id = ci.movie_id
job
SELECT o_year, SUM( CASE WHEN nation = 1 THEN volume ELSE 0 END ) / SUM(volume) AS mkt_share FROM ( SELECT EXTRACT(YEAR FROM o_orderdate) AS o_year, l_extendedprice * (1 - l_discount) AS volume, n2.n_name AS nation FROM part, supplier, lineitem, orders, customer, nation n1, nation n2, region WHERE r_name = 1 AND s_nationkey = n2.n_nationkey AND l_orderkey = o_orderkey AND o_custkey = c_custkey AND p_partkey = l_partkey AND n1.n_regionkey = r_regionkey AND c_nationkey = n1.n_nationkey AND s_suppkey = l_suppkey AND o_orderdate BETWEEN DATE '1995-01-01' AND DATE '1996-12-31' AND p_type = 1 ) AS all_nations GROUP BY o_year ORDER BY o_year
tpch
SELECT MIN(miidx.info) AS rating, MIN(mi.info) AS release_date, MIN(t.title) AS german_movie FROM company_name AS cn, company_type AS ct, info_type AS it, info_type AS it2, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS miidx, title AS t WHERE ct.kind = 'production companies' AND miidx.movie_id = mc.movie_id AND ct.id = mc.company_type_id AND cn.id = mc.company_id AND mi.movie_id = t.id AND miidx.movie_id = t.id AND it2.id = mi.info_type_id AND it.id = miidx.info_type_id AND it.info = 'rating' AND kt.kind = 'movie' AND it2.info = 'release dates' AND kt.id = t.kind_id AND mi.movie_id = mc.movie_id AND mc.movie_id = t.id AND mi.movie_id = miidx.movie_id AND cn.country_code = '[de]' LIMIT 10;
job
SELECT MIN(t.title) AS series_named_after_char, MIN(an.name) AS cool_actor_pseudonym FROM aka_name AS an, cast_info AS ci, company_name AS cn, keyword AS k, movie_companies AS mc, movie_keyword AS mk, name AS n, title AS t WHERE t.episode_nr >= 50 AND ci.movie_id = t.id AND k.keyword = 'character-name-in-title' AND cn.country_code = '[us]' AND n.id = ci.person_id AND an.person_id = ci.person_id AND t.id = mc.movie_id AND ci.movie_id = mk.movie_id AND mc.movie_id = mk.movie_id AND mk.keyword_id = k.id AND an.person_id = n.id AND ci.movie_id = mc.movie_id AND t.id = mk.movie_id AND mc.company_id = cn.id AND t.episode_nr < 100
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 ci.movie_id = mk.movie_id AND n.id = ci.person_id AND t.production_year > 2010 AND n.name LIKE '%Hemsworth%Chris%' AND k.keyword = 'marvel-cinematic-universe' AND t.id = ci.movie_id AND k.id = mk.keyword_id AND t.id = mk.movie_id
job
SELECT MIN(miidx.info) AS rating, MIN(mi.info) AS release_date, MIN(t.title) AS german_movie FROM company_name AS cn, company_type AS ct, info_type AS it, info_type AS it2, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS miidx, title AS t WHERE kt.id = t.kind_id AND it2.id = mi.info_type_id AND mi.movie_id = t.id AND it.info = 'rating' AND miidx.movie_id = t.id AND ct.id = mc.company_type_id AND it2.info = 'release dates' AND mi.movie_id = mc.movie_id AND kt.kind = 'movie' AND mc.movie_id = t.id AND miidx.movie_id = mc.movie_id AND cn.country_code = '[de]' AND mi.movie_id = miidx.movie_id AND ct.kind = 'production companies' AND it.id = miidx.info_type_id AND cn.id = mc.company_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.Id = c.PostId AND u.Id = p.OwnerUserId AND p.Id = ph.PostId AND p.ViewCount >= 0 AND p.Id = v.PostId AND p.Score <= 192 AND u.Id = b.UserId
stats
WITH _q AS ( SELECT SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM lineitem, part WHERE ( p_partkey = l_partkey AND p_brand = 1 AND p_container IN ('SM CASE', 'SM BOX', 'SM PACK', 'SM PKG') AND l_quantity >= 1 AND l_quantity <= 1 + 10 AND p_size BETWEEN 1 AND 5 AND l_shipmode IN ('AIR', 'AIR REG') AND l_shipinstruct = 'DELIVER IN PERSON' ) OR ( p_partkey = l_partkey AND p_brand = 1 AND p_container IN ('MED BAG', 'MED BOX', 'MED PKG', 'MED PACK') AND l_quantity >= 1 AND l_quantity <= 1 + 10 AND p_size BETWEEN 1 AND 10 AND l_shipmode IN ('AIR', 'AIR REG') AND l_shipinstruct = 'DELIVER IN PERSON' ) OR ( p_partkey = l_partkey AND p_brand = 1 AND p_container IN ('LG CASE', 'LG BOX', 'LG PACK', 'LG PKG') AND l_quantity >= 1 AND l_quantity <= 1 + 10 AND p_size BETWEEN 1 AND 15 AND l_shipmode IN ('AIR', 'AIR REG') AND l_shipinstruct = 'DELIVER IN PERSON' ) ) SELECT * FROM _q LIMIT 10;
tpch
SELECT promotions, CAST(promotions AS DECIMAL(15, 4)) / CAST(total AS DECIMAL(15, 4)) * 100, total 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_customer_sk = c_customer_sk JOIN customer_address ON c_current_addr_sk = ca_address_sk JOIN item ON ss_item_sk = i_item_sk WHERE (p_channel_dmail = 'Y' OR p_channel_email = 'Y' OR p_channel_tv = 'Y') AND d_year = 2002 AND ca_gmt_offset = -6 AND d_moy = 12 ) AS all_sales AND i_category = 'Jewelry' AND i_category = 'Jewelry' AND s_gmt_offset = -6 AND d_moy = 12 ) AS promotional_sales, ( SELECT SUM(ss_ext_sales_price) AS total FROM store_sales JOIN store ON ss_store_sk = s_store_sk JOIN date_dim ON ss_sold_date_sk = d_date_sk JOIN customer ON ss_customer_sk = c_customer_sk JOIN customer_address ON c_current_addr_sk = ca_address_sk JOIN item ON ss_item_sk = i_item_sk WHERE ca_gmt_offset = -6 AND d_year = 2002 AND s_gmt_offset = -6 ORDER BY promotions, total LIMIT 100;
tpcds
SELECT COUNT(DISTINCT ps_suppkey) AS supplier_cnt, p_brand, p_size, p_type FROM partsupp, part WHERE p_brand <> 1 AND p_size IN (1, 1, 1, 1, 1, 1, 1, 1) AND p_type NOT LIKE 1 AND p_partkey = ps_partkey AND ps_suppkey NOT IN ( SELECT s_suppkey FROM supplier WHERE s_comment LIKE '%Customer%Complaints%' ) GROUP BY p_brand, p_type, p_size ORDER BY supplier_cnt DESC, p_brand, p_type, p_size
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.id = mk.keyword_id AND t.id = mi.movie_id AND mk.movie_id = mi.movie_id AND k.keyword LIKE '%sequel%' AND t.id = mk.movie_id AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Denish', 'Norwegian', 'German') AND t.production_year > 2005 LIMIT 500;
job
SELECT AVG(ss_quantity), AVG(ss_ext_wholesale_cost), AVG(ss_ext_sales_price), 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_sk JOIN date_dim ON d_date_sk = ss_sold_date_sk WHERE s_market_id = 4 AND ca_state IN ('TX', 'WA', 'FL') AND ca_country = 'United States' AND ( (cd_marital_status = 'S' AND cd_education_status = '2 yr Degree' AND ss_sales_price BETWEEN 83 AND 135) OR (cd_marital_status = 'S' AND cd_education_status = 'Secondary' AND ss_sales_price BETWEEN 84 AND 125) OR (cd_marital_status = 'D' AND cd_education_status = 'College' AND ss_sales_price BETWEEN 126 AND 196) ) AND ( (hd_dep_count = 0 AND hd_vehicle_count <= 1) OR (hd_dep_count = 3 AND hd_vehicle_count <= 4) OR (hd_dep_count = 6 AND hd_vehicle_count <= 4) ) AND d_year = 1999
tpcds
SELECT SUM(l_extendedprice) / 7.0 AS avg_yearly FROM lineitem, part WHERE p_brand = 1 AND l_quantity < ( SELECT 0.2 * AVG(l_quantity) FROM lineitem WHERE l_partkey = p_partkey ) AND p_container = 1 AND p_partkey = l_partkey LIMIT 500;
tpch
SELECT AVG(ss_quantity), SUM(ss_ext_wholesale_cost), AVG(ss_ext_wholesale_cost), 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_sk JOIN date_dim ON d_date_sk = ss_sold_date_sk WHERE ( (hd_dep_count = 3 AND hd_vehicle_count <= 3) OR (hd_dep_count = 2 AND hd_vehicle_count <= 2) OR (hd_dep_count = 4 AND hd_vehicle_count <= 5) ) AND ca_country = 'United States' AND ca_state IN ('OH', 'GA', 'NY') AND d_year = 2002 AND ( (cd_marital_status = 'M' AND cd_education_status = 'College' AND ss_sales_price BETWEEN 78 AND 126) OR (cd_marital_status = 'D' AND cd_education_status = 'Primary' AND ss_sales_price BETWEEN 69 AND 117) OR (cd_marital_status = 'D' AND cd_education_status = 'College' AND ss_sales_price BETWEEN 147 AND 164) ) AND s_market_id = 10
tpcds
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 c.UserId = u.Id AND b.UserId = u.Id AND p.Id = ph.PostId AND p.Id = c.PostId AND p.Score <= 40 AND p.Id = pl.RelatedPostId AND p.Id = v.PostId AND pl.LinkTypeId = 1
stats
SELECT i_brand AS brand, i_manufact_id, i_manufact, 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 JOIN customer ON ss_customer_sk = c_customer_sk JOIN customer_address ON c_current_addr_sk = ca_address_sk JOIN store ON ss_store_sk = s_store_sk WHERE d_moy = 11 AND d_year = 1999 AND i_manager_id = 73 AND substr(ca_zip, 1, 5) <> substr(s_zip, 1, 5) GROUP BY i_brand, i_brand_id, i_manufact_id, i_manufact ORDER BY ext_price DESC, brand, brand_id, i_manufact_id, i_manufact;
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 k.id = mk.keyword_id AND t.id = mk.movie_id AND mi_idx.info < '7.0' AND cn.id = mc.company_id AND it1.info = 'countries' AND t.id = mi_idx.movie_id AND cn.country_code != '[us]' AND k.keyword = ANY(ARRAY['murder', 'murder-in-title', 'blood', 'violence']) AND mk.movie_id = mi_idx.movie_id AND t.id = mi.movie_id AND it1.id = mi.info_type_id AND kt.id = t.kind_id AND mc.note LIKE '%(200%)%' AND mi.movie_id = mi_idx.movie_id AND mk.movie_id = mc.movie_id AND t.production_year > 2008 AND t.id = mc.movie_id AND it2.id = mi_idx.info_type_id AND ct.id = mc.company_type_id AND kt.kind IN ('movie', 'episode') AND mi.info IN ('Germany', 'German', 'USA', 'American') AND it2.info = 'rating' AND mk.movie_id = mi.movie_id AND mc.movie_id = mi_idx.movie_id AND mi.movie_id = mc.movie_id AND mc.note NOT LIKE '%(USA)%'
job
SELECT promotions, total, CAST(promotions AS DECIMAL(15, 4)) / CAST(total AS DECIMAL(15, 4)) * 100 FROM ( SELECT SUM(ss_ext_sales_price) AS promotions FROM store_sales JOIN store ON ss_store_sk = s_store_sk JOIN promotion ON ss_promo_sk = p_promo_sk JOIN date_dim ON ss_sold_date_sk = d_date_sk JOIN customer ON ss_customer_sk = c_customer_sk JOIN customer_address ON c_current_addr_sk = ca_address_sk JOIN item ON ss_item_sk = i_item_sk WHERE i_category = 'Jewelry' AND s_gmt_offset = -5 AND d_moy = 8 ) AS all_sales AND s_gmt_offset = -5 AND (p_channel_dmail = 'Y' OR p_channel_email = 'Y' OR p_channel_tv = 'Y') AND d_moy = 8 ) AS promotional_sales, ( SELECT SUM(ss_ext_sales_price) AS total FROM store_sales JOIN store ON ss_store_sk = s_store_sk JOIN date_dim ON ss_sold_date_sk = d_date_sk JOIN customer ON ss_customer_sk = c_customer_sk JOIN customer_address ON c_current_addr_sk = ca_address_sk JOIN item ON ss_item_sk = i_item_sk WHERE ca_gmt_offset = -5 AND ca_gmt_offset = -5 AND d_year = 2001 AND i_category = 'Jewelry' AND d_year = 2001 ORDER BY promotions, total LIMIT 100;
tpcds
SELECT STDDEV_SAMP(sr_return_quantity) AS store_returns_quantitystdev, COUNT(sr_return_quantity) AS store_returns_quantitycount, COUNT(cs_quantity) AS catalog_sales_quantitycount, STDDEV_SAMP(cs_quantity) / AVG(cs_quantity) AS catalog_sales_quantitycov, AVG(sr_return_quantity) AS store_returns_quantityave, STDDEV_SAMP(ss_quantity) AS store_sales_quantitystdev, i_item_id, STDDEV_SAMP(sr_return_quantity) / AVG(sr_return_quantity) AS store_returns_quantitycov, STDDEV_SAMP(ss_quantity) / AVG(ss_quantity) AS store_sales_quantitycov, AVG(ss_quantity) AS store_sales_quantityave, s_state, i_item_desc, COUNT(ss_quantity) AS store_sales_quantitycount, AVG(cs_quantity) AS catalog_sales_quantityave 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_ticket_number JOIN catalog_sales ON sr_customer_sk = cs_bill_customer_sk AND sr_item_sk = cs_item_sk JOIN date_dim AS d1 ON d1.d_date_sk = ss_sold_date_sk JOIN date_dim AS d2 ON sr_returned_date_sk = d2.d_date_sk JOIN date_dim AS d3 ON cs_sold_date_sk = d3.d_date_sk JOIN store ON ss_store_sk = s_store_sk JOIN item ON ss_item_sk = i_item_sk WHERE d2.d_quarter_name IN ('1999Q2', '2002Q2', '1999Q3') AND d3.d_quarter_name IN ('1999Q2', '2002Q2', '1999Q3') AND d1.d_quarter_name = '1999Q2' GROUP BY i_item_id, i_item_desc, s_state ORDER BY i_item_id, i_item_desc, s_state LIMIT 100;
tpcds
Select Min(t.title) As movie_title From company_name As cn, keyword As k, movie_companies As mc, movie_keyword As mk, title As t Where mk.keyword_id = k.id AND t.id = mk.movie_id AND cn.country_code ='[nl]' AND mc.movie_id = mk.movie_id AND cn.id = mc.company_id AND mc.movie_id = t.id AND k.keyword ='character-name-In-title'
job
SELECT MIN(t.production_year) AS movie_year, MIN(mc.note) AS production_note, MIN(t.title) AS movie_title FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info_idx AS mi_idx, title AS t WHERE mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND ct.kind = 'production companies' AND it.info = 'top 250 rank' AND t.id = mc.movie_id AND it.id = mi_idx.info_type_id AND ct.id = mc.company_type_id AND t.id = mi_idx.movie_id AND mc.movie_id = mi_idx.movie_id AND (mc.note LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%')
job
SELECT promotions, total, CAST(promotions AS DECIMAL(15, 4)) / CAST(total AS DECIMAL(15, 4)) * 100 FROM ( SELECT SUM(ss_ext_sales_price) AS promotions FROM store_sales JOIN store ON ss_store_sk = s_store_sk JOIN promotion ON ss_promo_sk = p_promo_sk JOIN date_dim ON ss_sold_date_sk = d_date_sk JOIN customer ON ss_customer_sk = c_customer_sk JOIN customer_address ON c_current_addr_sk = ca_address_sk JOIN item ON ss_item_sk = i_item_sk WHERE s_gmt_offset = -6 AND d_moy = 5 ) AS promotional_sales, ( SELECT SUM(ss_ext_sales_price) AS total FROM store_sales JOIN store ON ss_store_sk = s_store_sk JOIN date_dim ON ss_sold_date_sk = d_date_sk JOIN customer ON ss_customer_sk = c_customer_sk JOIN customer_address ON c_current_addr_sk = ca_address_sk JOIN item ON ss_item_sk = i_item_sk WHERE ca_gmt_offset = -6 AND i_category = 'Home' AND d_year = 2002 AND s_gmt_offset = -6 AND d_moy = 5 ) AS all_sales AND ca_gmt_offset = -6 AND i_category = 'Home' AND d_year = 2002 AND (p_channel_dmail = 'Y' OR p_channel_email = 'Y' OR p_channel_tv = 'Y') ORDER BY promotions, total LIMIT 100;
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 ci.role_id = rt.id AND k.keyword = 'anime' AND n.id = ci.person_id AND ci.note LIKE '%(voice: English version)%' AND mk.movie_id = mc.movie_id AND cn.id = mc.company_id AND an.person_id = n.id AND rt.role = 'actress' AND t.production_year > 1990 AND t.id = ci.movie_id AND mc.note LIKE '%(Japan)%' AND k.id = mk.keyword_id AND t.id = mk.movie_id AND ci.movie_id = mc.movie_id AND ci.person_id = an.person_id AND ct.id = mc.company_type_id AND mk.movie_id = ci.movie_id AND t.id = mc.movie_id AND mc.note NOT LIKE '%(USA)%' AND cn.country_code = '[jp]' AND n.gender = 'f'
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 = c.PostId AND u.Id = p.OwnerUserId AND p.PostTypeId = 1 AND p.Id = ph.PostId AND p.Id = pl.PostId AND p.AnswerCount >= 0 AND p.Id = v.PostId
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 ci.note LIKE '%(voice)%' AND rt.id = ci.role_id AND t.id = mc.movie_id AND cn.country_code = '[ru]' AND cn.id = mc.company_id AND ci.note LIKE '%(uncredited)%' AND t.id = ci.movie_id AND rt.role = 'actor' AND chn.id = ci.person_role_id AND ct.id = mc.company_type_id AND ci.movie_id = mc.movie_id AND t.production_year > 2005
job
Select o_year, Sum( Case When nation = 1 Then volume Else 0 End ) / Sum(volume) As mkt_share From ( Select EXTRACT(YEAR From o_orderdate) As o_year, l_extendedprice * (1 - l_discount) As volume, n2.n_name As nation From part, supplier, lineitem, orders, customer, nation n1, nation n2, region Where n1.n_regionkey = r_regionkey And s_nationkey = n2.n_nationkey And l_orderkey = o_orderkey And p_partkey = l_partkey And c_nationkey = n1.n_nationkey And p_type = 1 ) As all_nations And o_custkey = c_custkey And r_name = 1 And o_orderdate Between DATE '1995-01-01' And DATE '1996-12-31' And s_suppkey = l_suppkey Group By o_year Order By o_year
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 ci.movie_id = mc.movie_id AND cn.country_code = '[ru]' AND rt.role = 'actor' AND t.production_year > 2005 AND ci.note LIKE '%(uncredited)%' AND cn.id = mc.company_id AND t.id = mc.movie_id AND ci.note LIKE '%(voice)%' AND rt.id = ci.role_id AND chn.id = ci.person_role_id AND ct.id = mc.company_type_id AND t.id = ci.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 ci.movie_id = mk.movie_id AND k.id = mk.keyword_id AND t.id = mk.movie_id AND t.id = ci.movie_id AND n.name LIKE '%Downey%Robert%' AND n.id = ci.person_id AND t.production_year > 2010 AND k.keyword = 'marvel-cinematic-universe'
job
SELECT SUM(l_extendedprice * (1 - l_discount)) AS revenue, n_name FROM customer, orders, lineitem, supplier, nation, region WHERE r_name = 1 AND l_suppkey = s_suppkey AND o_orderdate >= DATE 1 AND o_orderdate < DATE 1 + INTERVAL '1' YEAR AND c_custkey = o_custkey AND s_nationkey = n_nationkey AND n_regionkey = r_regionkey AND l_orderkey = o_orderkey AND c_nationkey = s_nationkey GROUP BY n_name ORDER BY revenue DESC
tpch
SELECT COUNT(*) FROM comments AS c, posts AS p, postLinks AS pl WHERE p.CreationDate >= '2010-07-23 07:27:31'::timestamp AND p.CreationDate <= '2014-09-09 01:43:00'::timestamp AND p.Id = pl.PostId AND c.UserId = p.OwnerUserId AND p.CommentCount <= 18 LIMIT 1000;
stats
SELECT cnt, c_preferred_cust_flag, c_first_name, c_salutation, ss_ticket_number, 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 (d_dom BETWEEN 1 AND 3 OR d_dom BETWEEN 25 AND 28) AND (hd_buy_potential = '>10000' OR hd_buy_potential = 'Unknown') AND hd_vehicle_count > 0 AND (CASE WHEN hd_vehicle_count > 0 THEN hd_dep_count / hd_vehicle_count ELSE NULL END) > 1.79 AND d_year IN (2000, 2002, 2003) AND s_county IN ('Bronz County', 'Daviess County', 'Maricopa County') GROUP BY ss_ticket_number, ss_customer_sk ) AS dn JOIN customer ON ss_customer_sk = c_customer_sk WHERE cnt BETWEEN 15 AND 20 ORDER BY c_last_name, c_first_name, c_salutation, cnt ASC LIMIT 100;
tpcds
SELECT AVG(l_quantity) AS avg_qty, SUM(l_extendedprice) AS sum_base_price, COUNT(*) AS count_order, SUM(l_quantity) AS sum_qty, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, AVG(l_discount) AS avg_disc, l_returnflag, AVG(l_extendedprice) AS avg_price, l_linestatus FROM lineitem WHERE l_shipdate <= DATE '1998-12-01' - INTERVAL 1 DAY GROUP BY l_returnflag, l_linestatus ORDER BY l_returnflag, l_linestatus
tpch
WITH _q AS ( SELECT COUNT(*) FROM postHistory AS ph, posts AS p, users AS u, badges AS b WHERE u.Id = b.UserId AND p.OwnerUserId = u.Id AND ph.UserId = u.Id AND ph.PostHistoryTypeId = 3 AND p.Score >= -7 AND u.Reputation >= 1 ) SELECT * FROM _q LIMIT 200;
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 mk.keyword_id = k.id AND cn.id = mc.company_id AND cn.country_code ='[sm]' AND t.id = mk.movie_id AND k.keyword ='character-name-IN-title' AND mc.movie_id = t.id AND mc.movie_id = mk.movie_id
job
SELECT l_returnflag, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, SUM(l_quantity) AS sum_qty, AVG(l_extendedprice) AS avg_price, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, l_linestatus, AVG(l_quantity) AS avg_qty, AVG(l_discount) AS avg_disc, COUNT(*) AS count_order, SUM(l_extendedprice) AS sum_base_price FROM lineitem WHERE l_shipdate <= DATE '1998-12-01' - INTERVAL 1 DAY GROUP BY l_returnflag, l_linestatus ORDER BY l_returnflag, l_linestatus
tpch
SELECT l_returnflag, l_linestatus, SUM(l_quantity) AS sum_qty, SUM(l_extendedprice) AS sum_base_price, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, AVG(l_quantity) AS avg_qty, AVG(l_extendedprice) AS avg_price, AVG(l_discount) AS avg_disc, COUNT(DISTINCT l_returnflag) AS count_order FROM lineitem WHERE l_shipdate <= DATE '1998-12-01' - INTERVAL 1 DAY GROUP BY l_returnflag, l_linestatus ORDER BY l_returnflag, l_linestatus LIMIT 500;
tpch
SELECT c_last_name, c_first_name, c_salutation, c_preferred_cust_flag, ss_ticket_number, cnt FROM ( SELECT ss_ticket_number, ss_customer_sk, COUNT(*) AS cnt FROM store_sales JOIN date_dim ON ss_sold_date_sk = d_date_sk JOIN store ON ss_store_sk = s_store_sk JOIN household_demographics ON ss_hdemo_sk = hd_demo_sk WHERE (hd_buy_potential = '>10000' OR hd_buy_potential = 'Unknown') AND s_county IN ('Bronz County', 'Daviess County', 'Maricopa County') AND hd_vehicle_count > 0 AND (d_dom BETWEEN 1 AND 3 OR d_dom BETWEEN 25 AND 28) AND (CASE WHEN hd_vehicle_count > 0 THEN hd_dep_count / hd_vehicle_count ELSE NULL END) > 1.79 AND d_year IN (2000, 2002, 2003) GROUP BY ss_ticket_number, ss_customer_sk ) AS dn JOIN customer ON ss_customer_sk = c_customer_sk WHERE cnt BETWEEN 15 AND 20 ORDER BY c_last_name, c_first_name, c_salutation, cnt DESC LIMIT 100;
tpcds
SELECT MIN(t.title) AS western_violent_movie, MIN(mi_idx.info) AS rating, MIN(cn.name) AS movie_company FROM company_name AS cn, company_type AS ct, info_type AS it1, info_type AS it2, keyword AS k, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS mi_idx, movie_keyword AS mk, title AS t WHERE mi_idx.info < '7.0' AND mi.movie_id = mi_idx.movie_id AND t.production_year > 2008 AND it2.id = mi_idx.info_type_id AND mk.movie_id = mi.movie_id AND it1.id = mi.info_type_id AND ct.id = mc.company_type_id AND mi.info IN ('Germany', 'German', 'USA', 'American') AND mk.movie_id = mc.movie_id AND kt.kind IN ('movie', 'episode') AND k.id = mk.keyword_id AND kt.id = t.kind_id AND it2.info = 'rating' AND mc.note LIKE '%(200%)%' AND t.id = mk.movie_id AND mi.movie_id = mc.movie_id AND t.id = mc.movie_id AND mk.movie_id = mi_idx.movie_id AND mc.note NOT LIKE '%(USA)%' AND k.keyword IN ('murder', 'murder-in-title', 'blood', 'violence') AND it1.info = 'countries' AND cn.country_code != '[us]' AND mc.movie_id = mi_idx.movie_id AND t.id = mi_idx.movie_id AND t.id = mi.movie_id AND cn.id = mc.company_id
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 c_custkey = o_custkey AND c_nationkey = n_nationkey AND l_orderkey = o_orderkey AND o_orderdate < DATE 1 + INTERVAL '3' MONTH AND l_returnflag = 'R' AND o_orderdate >= DATE 1 GROUP BY c_custkey, c_name, c_acctbal, c_phone, n_name, c_address, c_comment ORDER BY revenue ASC;
tpch
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.id = mc.company_type_id AND t.id = mc.movie_id AND it.info = 'bottom 10 rank' AND ct.kind = 'production companies' AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND mc.movie_id = mi.movie_id AND (mc.note LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%')
job
SELECT i_manufact_id, SUM(ss_ext_sales_price) AS ext_price, i_brand AS brand, 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 JOIN store ON ss_store_sk = s_store_sk WHERE d_moy = 11 AND substr(ca_zip, 1, 5) <> substr(s_zip, 1, 5) AND i_manager_id = 77 AND d_year = 2002 GROUP BY i_brand, i_brand_id, i_manufact_id, i_manufact ORDER BY ext_price ASC, brand, brand_id, i_manufact_id, i_manufact LIMIT 100;
tpcds
SELECT ps_partkey, SUM(ps_supplycost * ps_availqty) AS VALUE FROM partsupp, supplier, nation WHERE n_name = 1 AND s_nationkey = n_nationkey AND ps_suppkey = s_suppkey GROUP BY ps_partkey HAVING SUM(ps_supplycost * ps_availqty) > ( SELECT SUM(ps_supplycost * ps_availqty) * 1 FROM partsupp, supplier, nation WHERE ps_suppkey = s_suppkey AND s_nationkey = n_nationkey AND n_name = 1 ) ORDER BY VALUE DESC LIMIT 200;
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 ci.movie_id = t.id AND cn.country_code = '[us]' AND mc.movie_id = mk.movie_id AND mk.keyword_id = k.id AND t.id = mc.movie_id AND ci.movie_id = mk.movie_id AND an.person_id = n.id AND t.id = mk.movie_id AND mc.company_id = cn.id AND t.episode_nr >= 50 AND ci.movie_id = mc.movie_id AND k.keyword = 'character-name-in-title' AND t.episode_nr < 100 AND an.person_id = ci.person_id AND n.id = ci.person_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 s_nationkey = n1.n_nationkey AND ( (n1.n_name = 1 AND n2.n_name = 1) OR (n1.n_name = 1 AND n2.n_name = 1) ) AND l_shipdate BETWEEN DATE '1995-01-01' AND DATE '1996-12-31' ) AS shipping AND c_nationkey = n2.n_nationkey AND s_suppkey = l_suppkey AND c_custkey = o_custkey GROUP BY supp_nation, cust_nation, l_year ORDER BY supp_nation, cust_nation, l_year
tpch
WITH _q AS ( SELECT MIN(mi_idx.info) AS rating, MIN(t.title) AS movie_title FROM info_type AS it, movie_info_idx AS mi_idx, title AS t WHERE t.id = mi_idx.movie_id AND mi_idx.info > '7.0' AND t.production_year BETWEEN 2000 AND 2010 AND it.id = mi_idx.info_type_id AND it.info ='rating' ) SELECT * FROM _q;
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.id = ci.person_id AND t.id = mk.movie_id AND n.name LIKE '%Downey%Robert%' AND k.id = mk.keyword_id AND t.production_year > 2010 AND ci.movie_id = mk.movie_id AND k.keyword = 'marvel-cinematic-universe' AND t.id = ci.movie_id LIMIT 500;
job
SELECT MIN(cn.name) AS from_company, MIN(lt.link) AS link_type, MIN(t.title) AS western_sequel FROM company_name AS cn, company_type AS ct, info_type AS it, keyword AS k, link_type AS lt, movie_companies AS mc, movie_info AS mi, movie_keyword AS mk, movie_link AS ml, title AS t WHERE lt.link LIKE '%follow%' AND ml.movie_id = mi.movie_id AND cn.id = mc.company_id AND t.id = mk.movie_id AND mk.movie_id = mc.movie_id AND ml.movie_id = mc.movie_id AND mi.note LIKE '%internet%' AND mc.note LIKE '%(USA)%' AND mi.movie_id = t.id AND t.id = mc.movie_id AND mi.info LIKE 'USA:% 199%' AND it.info = 'release dates' AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND k.keyword IN ('sequel', 'revenge', 'based-on-novel') AND ct.id = mc.company_type_id AND t.id = ml.movie_id AND cn.country_code = '[us]' AND lt.id = ml.link_type_id AND t.production_year > 1950 AND ml.movie_id = mk.movie_id AND it.id = mi.info_type_id AND k.id = mk.keyword_id
job
SELECT COUNT(*) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v, badges AS b, users AS u WHERE p.Id = v.PostId AND p.Id = pl.RelatedPostId AND p.Id = ph.PostId AND pl.LinkTypeId = 1 AND c.UserId = u.Id AND p.Score <= 40 AND b.UserId = u.Id AND p.Id = c.PostId
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_orderdate, o_totalprice ORDER BY o_totalprice ASC, o_orderdate LIMIT 100
tpch
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 o_orderdate BETWEEN DATE '1995-01-01' AND DATE '1996-12-31' AND r_name = 1 AND n1.n_regionkey = r_regionkey AND s_suppkey = l_suppkey AND l_orderkey = o_orderkey AND o_custkey = c_custkey AND p_type = 1 ) AS all_nations AND s_nationkey = n2.n_nationkey AND p_partkey = l_partkey AND c_nationkey = n1.n_nationkey GROUP BY o_year ORDER BY o_year
tpch
SELECT SUM(ss_quantity) AS store_sales_quantity, i_item_desc, SUM(sr_return_quantity) AS store_returns_quantity, s_store_id, SUM(cs_quantity) AS catalog_sales_quantity, s_store_name, i_item_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_ticket_number JOIN catalog_sales ON sr_customer_sk = cs_bill_customer_sk AND sr_item_sk = cs_item_sk JOIN date_dim AS d1 ON ss_sold_date_sk = d1.d_date_sk JOIN date_dim AS d2 ON sr_returned_date_sk = d2.d_date_sk JOIN date_dim AS d3 ON cs_sold_date_sk = d3.d_date_sk JOIN store ON ss_store_sk = s_store_sk JOIN item ON ss_item_sk = i_item_sk WHERE d1.d_year = 2001 AND d3.d_year = 2001 AND d2.d_year = 2001 AND d3.d_moy BETWEEN 2 AND 2 + 3 AND d2.d_moy BETWEEN 2 AND 2 + 3 AND d1.d_moy = 2 GROUP BY i_item_id, i_item_desc, s_store_id, s_store_name ORDER BY i_item_id, i_item_desc, s_store_id, s_store_name LIMIT 100;
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 kt.id = t.kind_id AND mi.movie_id = t.id AND mi.movie_id = miidx.movie_id AND it.info = 'rating' AND it2.info = 'release dates' AND ct.id = mc.company_type_id AND miidx.movie_id = t.id AND it.id = miidx.info_type_id AND mi.movie_id = mc.movie_id AND cn.country_code = '[de]' AND miidx.movie_id = mc.movie_id AND mc.movie_id = t.id AND kt.kind = 'movie' AND it2.id = mi.info_type_id AND cn.id = mc.company_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 mc.note NOT LIKE '%(USA)%' AND t.id = mi_idx.movie_id AND mk.movie_id = mi_idx.movie_id AND mi.info IN ('Germany', 'German', 'USA', 'American') AND cn.country_code != '[us]' AND k.id = mk.keyword_id AND t.production_year > 2008 AND t.id = mi.movie_id AND it2.id = mi_idx.info_type_id AND it1.id = mi.info_type_id AND cn.id = mc.company_id AND kt.id = t.kind_id AND t.id = mc.movie_id AND ct.id = mc.company_type_id AND it2.info = 'rating' AND mi_idx.info < '7.0' AND t.id = mk.movie_id AND mc.movie_id = mi_idx.movie_id AND mc.note LIKE '%(200%)%' AND mk.movie_id = mi.movie_id AND k.keyword IN ('murder', 'murder-in-title', 'blood', 'violence') AND mi.movie_id = mc.movie_id AND mi.movie_id = mi_idx.movie_id AND kt.kind IN ('movie', 'episode') AND it1.info = 'countries' AND mk.movie_id = mc.movie_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 INNER JOIN store_returns ON ss_customer_sk = sr_customer_sk AND ss_item_sk = sr_item_sk AND ss_ticket_number = sr_ticket_number INNER JOIN catalog_sales ON sr_customer_sk = cs_bill_customer_sk AND sr_item_sk = cs_item_sk INNER JOIN date_dim AS d1 ON ss_sold_date_sk = d1.d_date_sk INNER JOIN date_dim AS d2 ON sr_returned_date_sk = d2.d_date_sk INNER JOIN date_dim AS d3 ON cs_sold_date_sk = d3.d_date_sk INNER JOIN store ON ss_store_sk = s_store_sk INNER JOIN item ON ss_item_sk = i_item_sk WHERE d3.d_moy BETWEEN 5 AND 5 + 3 AND d2.d_year = 2000 AND d2.d_moy BETWEEN 5 AND 5 + 3 AND d1.d_moy = 5 AND d1.d_year = 2000 AND d3.d_year = 2000 GROUP BY i_item_id, i_item_desc, s_store_id, s_store_name ORDER BY i_item_id, i_item_desc, s_store_id, s_store_name LIMIT 100;
tpcds
SELECT AVG(ss_sales_price) AS agg4, AVG(ss_coupon_amt) AS agg3, AVG(ss_quantity) AS agg1, 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_sk WHERE cd_gender = 'M' AND cd_education_status = 'Primary' AND d_year = 2001 AND cd_marital_status = 'D' AND (p_channel_email = 'N' OR p_channel_event = 'N') GROUP BY i_item_id ORDER BY i_item_id LIMIT 100;
tpcds
SELECT COUNT(*) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v WHERE pl.LinkTypeId = 1 AND p.Id = ph.PostId AND p.Id = pl.PostId AND p.Id = v.PostId AND c.Score = 0 AND p.FavoriteCount >= 0 AND p.Id = c.PostId
stats
SELECT o_year, SUM( CASE WHEN nation = 1 THEN volume ELSE 0 END ) / SUM(volume) AS mkt_share FROM ( SELECT EXTRACT(YEAR FROM o_orderdate) AS o_year, l_extendedprice * (1 - l_discount) AS volume, n2.n_name AS nation FROM part, supplier, lineitem, orders, customer, nation n1, nation n2, region WHERE l_orderkey = o_orderkey AND o_orderdate BETWEEN DATE '1995-01-01' AND DATE '1996-12-31' AND s_nationkey = n2.n_nationkey AND c_nationkey = n1.n_nationkey AND s_suppkey = l_suppkey AND o_custkey = c_custkey AND p_partkey = l_partkey AND r_name = 1 AND n1.n_regionkey = r_regionkey AND p_type = 1 ) AS all_nations GROUP BY o_year ORDER BY o_year
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 ci.movie_id = mk.movie_id AND t.id = ci.movie_id AND n.name LIKE '%Downey%Robert%' AND t.id = mk.movie_id AND t.production_year > 2010 AND n.id = ci.person_id AND k.id = mk.keyword_id AND k.keyword = 'marvel-cinematic-universe'
job
SELECT o_year, SUM( CASE WHEN nation = 1 THEN volume ELSE 0 END ) / SUM(volume) AS mkt_share FROM ( SELECT EXTRACT(YEAR FROM o_orderdate) AS o_year, l_extendedprice * (1 - l_discount) AS volume, n2.n_name AS nation FROM part, supplier, lineitem, orders, customer, nation n1, nation n2, region WHERE o_custkey = c_custkey AND l_orderkey = o_orderkey AND p_partkey = l_partkey AND p_type = 1 ) AS all_nations AND c_nationkey = n1.n_nationkey AND o_orderdate BETWEEN DATE '1995-01-01' AND DATE '1996-12-31' AND r_name = 1 AND s_nationkey = n2.n_nationkey AND s_suppkey = l_suppkey AND n1.n_regionkey = r_regionkey GROUP BY o_year ORDER BY o_year LIMIT 20;
tpch
SELECT SUM(l_extendedprice) AS sum_base_price, SUM(l_quantity) AS sum_qty, COUNT(*) AS count_order, AVG(l_quantity) AS avg_qty, AVG(l_discount) AS avg_disc, AVG(l_extendedprice) AS avg_price, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, l_linestatus, l_returnflag FROM lineitem WHERE l_shipdate <= DATE '1998-12-01' - INTERVAL 1 DAY GROUP BY l_returnflag, l_linestatus ORDER BY l_returnflag, l_linestatus
tpch
SELECT SUM(l_extendedprice * (1 - l_discount)) AS revenue, n_name FROM customer, orders, lineitem, supplier, nation, region WHERE l_orderkey = o_orderkey AND l_suppkey = s_suppkey AND o_orderdate < DATE 1 + INTERVAL '1' YEAR AND o_orderdate >= DATE 1 AND c_nationkey = s_nationkey AND c_custkey = o_custkey AND s_nationkey = n_nationkey AND n_regionkey = r_regionkey AND r_name = 1 GROUP BY n_name ORDER BY revenue DESC
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 = mc.movie_id AND t.id = mi_idx.movie_id AND t.id = mi.movie_id AND cn.id = mc.company_id AND mi.movie_id = mi_idx.movie_id AND mi_idx.movie_id = mc.movie_id AND at.movie_id = mc.movie_id AND it2.info = 'release dates' AND t.id = mc.movie_id AND at.title LIKE '%Champion%' AND kt.kind = 'movie' AND mi.info LIKE 'USA:%200%' AND it1.info = 'rating' AND t.production_year > 2000 AND mi_idx.info < '3.5' AND it1.id = mi_idx.info_type_id AND t.id = at.movie_id AND it2.id = mi.info_type_id AND cn.country_code = '[us]' AND kt.id = t.kind_id AND at.movie_id = mi.movie_id AND at.movie_id = mi_idx.movie_id
job
SELECT promotions, total, CAST(promotions AS DECIMAL(15, 4)) / CAST(total AS DECIMAL(15, 4)) * 100 FROM ( SELECT SUM(ss_ext_sales_price) AS promotions FROM store_sales JOIN store ON ss_store_sk = s_store_sk JOIN promotion ON ss_promo_sk = p_promo_sk JOIN date_dim ON ss_sold_date_sk = d_date_sk JOIN customer ON ss_customer_sk = c_customer_sk JOIN customer_address ON c_current_addr_sk = ca_address_sk JOIN item ON ss_item_sk = i_item_sk WHERE d_year = 2002 AND s_gmt_offset = -6 AND s_gmt_offset = -6 AND i_category = 'Home' AND d_moy = 5 ) AS all_sales AND ca_gmt_offset = -6 AND (p_channel_dmail = 'Y' OR p_channel_email = 'Y' OR p_channel_tv = 'Y') AND i_category = 'Home' AND d_moy = 5 ) AS promotional_sales, ( SELECT SUM(ss_ext_sales_price) AS total FROM store_sales JOIN store ON ss_store_sk = s_store_sk JOIN date_dim ON ss_sold_date_sk = d_date_sk JOIN customer ON ss_customer_sk = c_customer_sk JOIN customer_address ON c_current_addr_sk = ca_address_sk JOIN item ON ss_item_sk = i_item_sk WHERE ca_gmt_offset = -6 AND d_year = 2002 ORDER BY promotions, total LIMIT 100;
tpcds
SELECT MIN(cn.name) AS from_company, MIN(lt.link) AS link_type, MIN(t.title) AS western_sequel FROM company_name AS cn, company_type AS ct, info_type AS it, keyword AS k, link_type AS lt, movie_companies AS mc, movie_info AS mi, movie_keyword AS mk, movie_link AS ml, title AS t WHERE t.id = mk.movie_id AND mi.info LIKE 'USA:% 199%' AND k.id = mk.keyword_id AND mc.note LIKE '%(USA)%' AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND cn.country_code = '[us]' AND ml.movie_id = mc.movie_id AND ml.movie_id = mk.movie_id AND it.info = 'release dates' AND mi.note LIKE '%internet%' AND mk.movie_id = mc.movie_id AND t.id = ml.movie_id AND k.keyword IN ('sequel', 'revenge', 'based-on-novel') AND ml.movie_id = mi.movie_id AND lt.link LIKE '%follow%' AND lt.id = ml.link_type_id AND t.id = mc.movie_id AND ct.id = mc.company_type_id AND it.id = mi.info_type_id AND t.production_year > 1950 AND cn.id = mc.company_id AND mi.movie_id = t.id
job
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 ct.id = mc.company_type_id AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND t.id = mc.movie_id AND it.info = 'top 250 rank' AND mc.movie_id = mi_idx.movie_id AND ct.kind = 'production companies' AND (mc.note LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%') AND it.id = mi_idx.info_type_id ) SELECT * FROM _q AND t.id = mi_idx.movie_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.role_id = rt.id AND mc.note LIKE '%(Japan)%' AND n1.id = ci.person_id AND an1.person_id = n1.id AND mc.company_id = cn.id AND mc.note NOT LIKE '%(USA)%' AND t.id = mc.movie_id AND n1.name LIKE '%Yo%' AND ci.note = '(voice: English version)' AND rt.role = 'actress' AND n1.name NOT LIKE '%Yu%' AND cn.country_code = '[jp]' AND ci.movie_id = t.id AND ci.movie_id = mc.movie_id AND an1.person_id = ci.person_id
job
SELECT MIN(mc.note) AS production_note, MIN(t.title) AS movie_title, MIN(t.production_year) AS movie_year FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info_idx AS mi_idx, title AS t WHERE (mc.note LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%') AND ct.id = mc.company_type_id AND ct.kind = 'production companies' AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND t.id = mc.movie_id AND it.info = 'top 250 rank' AND it.id = mi_idx.info_type_id AND mc.movie_id = mi_idx.movie_id AND t.id = mi_idx.movie_id
job
SELECT SUM(ss_ext_sales_price) AS ext_price, i_manufact_id, i_manufact, i_brand AS brand, 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 JOIN store ON ss_store_sk = s_store_sk WHERE d_year = 2002 AND substr(ca_zip, 1, 5) <> substr(s_zip, 1, 5) AND d_moy = 11 AND i_manager_id = 77 GROUP BY i_brand, i_brand_id, i_manufact_id, i_manufact ORDER BY ext_price DESC, brand, brand_id, i_manufact_id, i_manufact LIMIT 100;
tpcds
SELECT MIN(t.title) AS movie_title FROM company_name AS cn, keyword AS k, movie_companies AS mc, movie_keyword AS mk, title AS t WHERE cn.id = mc.company_id AND mk.keyword_id = k.id AND mc.movie_id = mk.movie_id AND k.keyword ='character-name-in-title' AND mc.movie_id = t.id AND t.id = mk.movie_id AND cn.country_code ='[nl]'
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 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 l1.l_receiptdate > l1.l_commitdate AND o_orderkey = l1.l_orderkey AND n_name = 1 AND s_nationkey = n_nationkey AND s_suppkey = l1.l_suppkey GROUP BY s_name ORDER BY numwait DESC, s_name LIMIT 100
tpch
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_receiptdate >= DATE 1 AND l_commitdate < l_receiptdate AND l_shipdate < l_commitdate AND l_receiptdate < DATE 1 + INTERVAL '1' YEAR AND l_shipmode IN (1, 1) AND o_orderkey = l_orderkey GROUP BY l_shipmode ORDER BY l_shipmode
tpch
Select Sum(ss_ext_sales_price) As ext_price, i_manufact, i_brand_id As brand_id, i_manufact_id, i_brand As brand 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 Join store On ss_store_sk = s_store_sk Where d_moy = 11 And d_year = 1999 And i_manager_id = 12 And substr(ca_zip, 1, 5) != substr(s_zip, 1, 5) Group By i_brand, i_brand_id, i_manufact_id, i_manufact Order By ext_price Desc, brand, brand_id, i_manufact_id, i_manufact Limit 100;
tpcds
WITH year_total AS ( SELECT 's' AS sale_type, c_login AS customer_login, c_customer_id AS customer_id, SUM(((ss_ext_list_price - ss_ext_wholesale_cost - ss_ext_discount_amt) + ss_ext_sales_price) / 2) AS year_total, c_birth_country AS customer_birth_country, d_year AS dyear, c_first_name AS customer_first_name, c_preferred_cust_flag AS customer_preferred_cust_flag, c_last_name AS customer_last_name, c_email_address AS customer_email_address FROM customer JOIN store_sales ON c_customer_sk = ss_customer_sk JOIN date_dim ON ss_sold_date_sk = d_date_sk WHERE d_year BETWEEN 2002 AND 2002 + 1 GROUP BY c_customer_id, c_first_name, c_last_name, c_preferred_cust_flag, c_birth_country, c_login, c_email_address, d_year ) SELECT t_s_secyear.customer_id, t_s_secyear.customer_first_name, t_s_secyear.customer_last_name, t_s_secyear.customer_email_address FROM year_total AS t_s_firstyear JOIN year_total AS t_s_secyear ON t_s_firstyear.customer_id = t_s_secyear.customer_id WHERE t_s_firstyear.sale_type = 's' AND t_s_secyear.sale_type = 's' AND t_s_firstyear.dyear = 2002 AND t_s_secyear.dyear = 2002 + 1 AND t_s_firstyear.year_total > 0 AND CASE WHEN t_s_firstyear.year_total > 0 THEN t_s_secyear.year_total / t_s_firstyear.year_total ELSE NULL END > 1.0 ORDER BY t_s_secyear.customer_id, t_s_secyear.customer_first_name, t_s_secyear.customer_last_name, t_s_secyear.customer_email_address LIMIT 100;
tpcds
SELECT MIN(t.title) AS movie_title FROM company_name AS cn, keyword AS k, movie_companies AS mc, movie_keyword AS mk, title AS t WHERE mk.keyword_id = k.id AND k.keyword ='character-name-in-title' AND cn.country_code ='[nl]' AND cn.id = mc.company_id AND t.id = mk.movie_id AND mc.movie_id = t.id AND mc.movie_id = mk.movie_id
job
SELECT MIN(k.keyword) AS movie_keyword, MIN(t.title) AS marvel_movie, MIN(n.name) AS actor_name FROM cast_info AS ci, keyword AS k, movie_keyword AS mk, name AS n, title AS t WHERE t.id = ci.movie_id AND n.name LIKE '%Hemsworth%Chris%' AND t.production_year > 2010 AND ci.movie_id = mk.movie_id AND k.keyword = 'marvel-cinematic-universe' AND n.id = ci.person_id AND t.id = mk.movie_id AND k.id = mk.keyword_id LIMIT 20;
job
SELECT MIN(k.keyword) AS movie_keyword, MIN(n.name) AS actor_name, MIN(t.title) AS marvel_movie FROM cast_info AS ci, keyword AS k, movie_keyword AS mk, name AS n, title AS t WHERE n.name LIKE '%Hemsworth%Chris%' AND t.id = mk.movie_id AND t.id = ci.movie_id AND n.id = ci.person_id AND t.production_year > 2010 AND k.keyword = 'marvel-cinematic-universe' AND ci.movie_id = mk.movie_id AND k.id = mk.keyword_id
job
SELECT n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, supplier, nation, region WHERE s_nationkey = n_nationkey AND c_nationkey = s_nationkey AND o_orderdate >= DATE 1 AND l_orderkey = o_orderkey AND o_orderdate < DATE 1 + INTERVAL '1' YEAR AND r_name = 1 AND n_regionkey = r_regionkey AND c_custkey = o_custkey AND l_suppkey = s_suppkey GROUP BY n_name ORDER BY revenue DESC
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 ci.movie_id = mk.movie_id AND k.id = mk.keyword_id AND n.name LIKE '%Hemsworth%Chris%' AND t.production_year > 2010 AND k.keyword = 'marvel-cinematic-universe' AND n.id = ci.person_id AND t.id = ci.movie_id AND t.id = mk.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 it1.info = 'countries' and cn.country_code != '[us]' and t.id = mc.movie_id and t.production_year > 2008 and mk.movie_id = mc.movie_id and mc.note not like '%(USA)%' and mc.note like '%(200%)%' and kt.id = t.kind_id and t.id = mk.movie_id and mk.movie_id = mi.movie_id and k.id = mk.keyword_id and it2.id = mi_idx.info_type_id and mc.movie_id = mi_idx.movie_id and t.id = mi_idx.movie_id and mi.info in ('Germany', 'German', 'USA', 'American') and it2.info = 'rating' and mi_idx.info < '7.0' and cn.id = mc.company_id and mi.movie_id = mi_idx.movie_id and ct.id = mc.company_type_id and kt.kind in ('movie', 'episode') and mk.movie_id = mi_idx.movie_id and t.id = mi.movie_id and it1.id = mi.info_type_id and k.keyword in ('murder', 'murder-in-title', 'blood', 'violence') and mi.movie_id = mc.movie_id
job