text
stringlengths
84
1.49k
benchmark
stringclasses
4 values
SELECT n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, supplier, nation, region WHERE o_orderdate < DATE 1 + INTERVAL '1' YEAR AND l_suppkey = s_suppkey AND c_custkey = o_custkey AND s_nationkey = n_nationkey AND c_nationkey = s_nationkey AND r_name = 1 AND n_regionkey = r_re...
tpch
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(cs_coupon_amt) As agg3, Avg(cs_quantity) As agg1, i_item_id, Avg(cs_sales_price) As agg4, 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 AVG(ss_ext_sales_price), SUM(ss_ext_wholesale_cost), AVG(ss_quantity), AVG(ss_ext_wholesale_cost) FROM store_sales JOIN store ON s_store_sk = ss_store_sk JOIN customer_demographics ON cd_demo_sk = ss_cdemo_sk JOIN household_demographics ON hd_demo_sk = ss_hdemo_sk JOIN customer_address ON ca_address_sk = ss_addr...
tpcds
With year_total As ( Select c_email_address As customer_email_address, c_first_name As customer_first_name, c_customer_id As customer_id, c_birth_country As customer_birth_country, c_last_name As customer_last_name, d_year As dyear, 's' As sale_type, Sum(((ss_ext_list_price - ss_ext_wholesale_cost - ss_ext_discount_amt...
tpcds
SELECT COUNT(*) FROM comments AS c, postHistory AS ph, badges AS b, votes AS v, users AS u WHERE b.UserId = ph.UserId AND v.UserId = c.UserId AND ph.UserId = v.UserId AND u.Id = b.UserId AND u.UpVotes = 0 AND ph.PostHistoryTypeId = 12 LIMIT 200;
stats
SELECT MIN(t.title) AS movie_title, MIN(t.production_year) AS movie_year, MIN(mc.note) AS production_note FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info_idx AS mi_idx, title AS t WHERE t.id = mc.movie_id AND it.id = mi_idx.info_type_id AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures...
job
SELECT c_last_name, c_first_name, c_salutation, c_preferred_cust_flag, ss_ticket_number, cnt FROM ( SELECT ss_ticket_number, ss_customer_sk, COUNT(*) AS cnt FROM store_sales INNER JOIN date_dim ON ss_sold_date_sk = d_date_sk INNER JOIN store ON ss_store_sk = s_store_sk INNER JOIN household_demographics ON ss_hdemo_sk =...
tpcds
SELECT COUNT(*) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v WHERE p.Id = ph.PostId AND c.Score = 0 AND p.Id = c.PostId AND p.FavoriteCount >= 0 AND pl.LinkTypeId = 1 AND p.Id = pl.PostId AND p.Id = v.PostId
stats
SELECT l_shipmode, SUM( CASE WHEN o_orderpriority = '1-URGENT' OR o_orderpriority = '2-HIGH' THEN 1 ELSE 0 END ) AS high_line_count, SUM( CASE WHEN o_orderpriority != '1-URGENT' AND o_orderpriority != '2-HIGH' THEN 1 ELSE 0 END ) AS low_line_count FROM orders, lineitem WHERE l_commitdate < l_receiptdate AND l_shipdate ...
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_commitdate < l_receiptdate AND l_receiptda...
tpch
SELECT MIN(cn.name) AS from_company, MIN(lt.link) AS link_type, MIN(t.title) AS western_sequel FROM company_name AS cn, company_type AS ct, info_type AS it, keyword AS k, link_type AS lt, movie_companies AS mc, movie_info AS mi, movie_keyword AS mk, movie_link AS ml, title AS t WHERE cn.id = mc.company_id AND ml.movie_...
job
select min(t.title) as movie_title from keyword as k, movie_info as mi, movie_keyword as mk, title as t where t.id = mk.movie_id and k.id = mk.keyword_id and t.id = mi.movie_id and t.production_year > 2005 and mi.info = ANY(ARRAY['Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Denish', 'Norwegian', 'German']) and...
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 s_suppkey = l_suppkey...
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 l_shipdate BETWEEN DATE '1995-01-0...
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 o_orderkey = l_orderkey And ( (n1....
tpch
SELECT MIN(cn.name) AS movie_company, MIN(mi_idx.info) AS rating, MIN(t.title) AS western_violent_movie FROM company_name AS cn, company_type AS ct, info_type AS it1, info_type AS it2, keyword AS k, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS mi_idx, movie_keyword AS mk, title AS t WHERE...
job
SELECT extended_price, c_last_name, ss_ticket_number, bought_city, list_price, ca_city, extended_tax, 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 dt.d_year, item.i_brand_id AS brand_id, item.i_brand AS brand, SUM(ss_ext_sales_price) AS sum_agg FROM date_dim AS dt JOIN store_sales ON dt.d_date_sk = store_sales.ss_sold_date_sk JOIN item ON store_sales.ss_item_sk = item.i_item_sk WHERE dt.d_moy = 12 AND item.i_manufact_id = 387 GROUP BY dt.d_year, item.i_bra...
tpcds
WITH year_total AS ( SELECT c_login AS customer_login, c_customer_id AS customer_id, c_first_name AS customer_first_name, c_preferred_cust_flag AS customer_preferred_cust_flag, c_birth_country AS customer_birth_country, c_email_address AS customer_email_address, d_year AS dyear, c_last_name AS customer_last_name, 's' A...
tpcds
SELECT dt.d_year, item.i_brand_id AS brand_id, item.i_brand AS brand, SUM(ss_ext_sales_price) AS sum_agg FROM date_dim AS dt INNER JOIN store_sales ON dt.d_date_sk = store_sales.ss_sold_date_sk INNER JOIN item ON store_sales.ss_item_sk = item.i_item_sk WHERE item.i_manufact_id = 703 AND dt.d_moy = 11 GROUP BY dt.d_year...
tpcds
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 catalog_sales ON cs_item_sk = i_item_sk WHERE inv_quantity_on_hand >= 100 AND d_date BETWEEN CAST('2002-01-23' AS DATE) AND (CAST('2002-01-23' AS DATE) + INTERVAL '60 days') A...
tpcds
SELECT c_custkey, c_phone, c_address, c_acctbal, c_comment, n_name, c_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue 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(an.name) AS cool_actor_pseudonym, MIN(t.title) AS series_named_after_char FROM aka_name AS an, cast_info AS ci, company_name AS cn, keyword AS k, movie_companies AS mc, movie_keyword AS mk, name AS n, title AS t WHERE k.keyword = 'character-name-in-title' AND an.person_id = n.id AND ci.movie_id = t.id AND mc...
job
SELECT MIN(an1.name) AS actress_pseudonym, MIN(t.title) AS japanese_movie_dubbed FROM aka_name AS an1, cast_info AS ci, company_name AS cn, movie_companies AS mc, name AS n1, role_type AS rt, title AS t WHERE ci.note = '(voice: English version)' AND n1.name NOT LIKE '%Yu%' AND mc.note LIKE '%(Japan)%' AND an1.person_id...
job
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 JO...
tpcds
Select o_shippriority, Sum(l_extendedprice * (1 - l_discount)) As revenue, l_orderkey, o_orderdate From customer, orders, lineitem Where c_custkey = o_custkey AND l_shipdate > DATE 1 AND o_orderdate < DATE 1 AND c_mktsegment = 1 AND l_orderkey = o_orderkey Group By l_orderkey, o_orderdate, o_shippriority Order By reven...
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 chn.id = ci.person_role_id AND cn.country_code = '[ru]' AND ci.movie_id = mc.movie_id AND t.id = ci....
job
Select Min(mi_idx.info) As rating, Min(t.title) As northamerican_movie From aka_title As at, company_name As cn, info_type As it1, info_type As it2, kind_type As kt, movie_companies As mc, movie_info As mi, movie_info_idx As mi_idx, title As t Where t.id = mi.movie_id AND at.title Like '%Champion%' AND mi.info Like 'US...
job
SELECT MIN(n.name) AS of_person, MIN(t.title) AS biography_movie FROM aka_name AS an, cast_info AS ci, info_type AS it, link_type AS lt, movie_link AS ml, name AS n, person_info AS pi, title AS t WHERE an.person_id = ci.person_id AND pi.note = 'Volker Boehm' AND ml.linked_movie_id = t.id AND ci.movie_id = ml.linked_mov...
job
SELECT s_acctbal, n_name, s_phone, p_partkey, s_comment, s_address, p_mfgr, s_name FROM part, supplier, partsupp, nation, region WHERE p_partkey = ps_partkey AND s_suppkey = ps_suppkey AND p_size = 1 AND p_type LIKE 1 AND s_nationkey = n_nationkey AND n_regionkey = r_regionkey AND r_name = 1 AND ps_supplycost = ( SELEC...
tpch
WITH year_total AS ( SELECT d_year AS dyear, c_last_name AS customer_last_name, c_birth_country AS customer_birth_country, c_login AS customer_login, c_preferred_cust_flag AS customer_preferred_cust_flag, c_first_name AS customer_first_name, c_customer_id AS customer_id, 's' AS sale_type, SUM(((ss_ext_list_price - ss_e...
tpcds
SELECT MIN(mc.note) AS production_note, MIN(t.title) AS movie_title, MIN(t.production_year) AS movie_year FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info_idx AS mi_idx, title AS t WHERE (mc.note LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%') AND t.id = mc.movie_id AND it.id = mi_id...
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 ps_suppkey = l_suppkey and s_suppkey = l_suppkey and o_orderk...
tpch
SELECT COUNT(1) FROM postHistory AS ph, posts AS p, users AS u, badges AS b WHERE u.Id = b.UserId AND ph.PostHistoryTypeId = 3 AND u.Reputation >= 1 AND ph.UserId = u.Id AND p.Score >= -7 AND p.OwnerUserId = u.Id
stats
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 p_name LIKE 1 ) AS profit AND ps_partkey = l_partkey AND s_na...
tpch
WITH _q AS ( Select dt.d_year, item.i_brand_id As brand_id, item.i_brand As brand, Sum(ss_ext_sales_price) As ext_price From date_dim As dt JOIN store_sales On dt.d_date_sk = store_sales.ss_sold_date_sk JOIN item On store_sales.ss_item_sk = item.i_item_sk Where item.i_manager_id = 69 And dt.d_moy = 11 And dt.d_year = 2...
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 mi.info LIKE 'USA:%200%' AND it2.info = 'release dates' AND kt.id = t....
job
SELECT COUNT(*) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v, badges AS b WHERE p.Id = ph.PostId AND p.Id = pl.RelatedPostId AND p.Id = v.PostId AND b.UserId = c.UserId AND c.Score = 0 AND pl.LinkTypeId = 1 AND p.Id = c.PostId
stats
SELECT promotions, total, CAST(promotions AS DECIMAL(15, 4)) / CAST(total AS DECIMAL(15, 4)) * 100 FROM ( SELECT SUM(ss_ext_sales_price) AS promotions FROM store_sales JOIN store ON ss_store_sk = s_store_sk JOIN promotion ON ss_promo_sk = p_promo_sk JOIN date_dim ON ss_sold_date_sk = d_date_sk JOIN customer ON ss_custo...
tpcds
WITH _q AS ( SELECT COUNT(*) FROM store_sales JOIN household_demographics ON ss_hdemo_sk = hd_demo_sk JOIN time_dim ON ss_sold_time_sk = t_time_sk JOIN store ON ss_store_sk = s_store_sk WHERE s_store_name = 'ought' AND t_minute >= 57 AND t_hour = 14 AND hd_dep_count = 6 ORDER BY COUNT(*) DESC LIMIT 100 ) SELECT * FROM ...
tpcds
SELECT promotions, total, CAST(promotions AS DECIMAL(15, 4)) / CAST(total AS DECIMAL(15, 4)) * 100 FROM ( SELECT SUM(ss_ext_sales_price) AS promotions FROM store_sales INNER JOIN store ON ss_store_sk = s_store_sk INNER JOIN promotion ON ss_promo_sk = p_promo_sk INNER JOIN date_dim ON ss_sold_date_sk = d_date_sk INNER J...
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 c_nationkey = n2.n_nationkey AND (...
tpch
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 s_nationkey = n_nationkey AND p_partkey = l_partkey AND s_sup...
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(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 SUM(volume) AS revenue, cust_nation, l_year, supp_nation 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_custkey = o_custkey AND s_nation...
tpch
SELECT COUNT(*) FROM comments AS c, posts AS p, votes AS v, users AS u WHERE u.Id = p.OwnerUserId AND u.Id = c.UserId AND u.Id = v.UserId AND p.Score >= 0 AND p.ViewCount >= 0 AND c.Score = 0 LIMIT 10;
stats
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_returnflag = 'R' AND o_orderdate < DATE 1 + INTERVAL '3' MONTH AND c_nationkey = n_nationkey AND l_orderkey = o_orderkey AND c_custkey = o_custke...
tpch
Select p_brand, p_type, p_size, Count(Distinct ps_suppkey) As supplier_cnt From partsupp, part Where p_brand <> 1 AND p_type Not Like 1 AND p_partkey = ps_partkey AND p_size In (1, 1, 1, 1, 1, 1, 1, 1) AND ps_suppkey Not In ( Select s_suppkey From supplier Where s_comment Like '%Customer%Complaints%' ) Group By p_brand...
tpch
SELECT MIN(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 t.id = mk.movie_id AND k.keyword = 'marvel-cinematic-universe' AND n.name LIKE '%Downe...
job
SELECT l_shipmode, SUM( CASE WHEN o_orderpriority = '1-URGENT' OR o_orderpriority = '2-HIGH' THEN 1 ELSE 0 END ) AS high_line_count, SUM( CASE WHEN o_orderpriority <> '1-URGENT' AND o_orderpriority <> '2-HIGH' THEN 1 ELSE 0 END ) AS low_line_count FROM orders, lineitem WHERE l_commitdate < l_receiptdate AND l_shipdate ...
tpch
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 c_comment, c_name, c_address, c_custkey, SUM(l_extendedprice * (1 - l_discount)) AS revenue, c_phone, n_name, c_acctbal FROM customer, orders, lineitem, nation WHERE o_orderdate < DATE 1 + INTERVAL '3' MONTH AND c_custkey = o_custkey AND c_nationkey = n_nationkey AND l_orderkey = o_orderkey AND l_returnflag = 'R...
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.id = mc.company_id AND t.id = ci.movie_id AND cn.country_code = '[ru]' AND rt.role = 'actor' AND ...
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 mk.keyword_id = k.id AND mc.movie_id = t.id AND t.id = mk.movie_id AND k.keyword ='character-name-in-title' AND cn.country_code =...
job
SELECT MIN(an.name) AS acress_pseudonym, MIN(t.title) AS japanese_anime_movie FROM aka_name AS an, cast_info AS ci, company_name AS cn, company_type AS ct, keyword AS k, movie_companies AS mc, movie_keyword AS mk, name AS n, role_type AS rt, title AS t WHERE t.id = mc.movie_id AND ci.person_id = an.person_id AND k.id =...
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 cn.country_code = '[us]' AND chn.id = ci.person_role_id AND mi.movie_id =...
job
SELECT MAX(mi_idx.info) AS rating, MAX(t.title) AS northamerican_movie FROM aka_title AS at, company_name AS cn, info_type AS it1, info_type AS it2, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS mi_idx, title AS t WHERE t.id = at.movie_id AND at.movie_id = mi.movie_id AND it1.info = 'ratin...
job
SELECT MIN(an.name) AS cool_actor_pseudonym, MIN(t.title) AS series_named_after_char FROM aka_name AS an, cast_info AS ci, company_name AS cn, keyword AS k, movie_companies AS mc, movie_keyword AS mk, name AS n, title AS t WHERE ci.movie_id = t.id AND mc.movie_id = mk.movie_id AND ci.movie_id = mk.movie_id AND an.perso...
job
SELECT MIN(chn.name) AS uncredited_voiced_character, MIN(t.title) AS russian_movie FROM char_name AS chn, cast_info AS ci, company_name AS cn, company_type AS ct, movie_companies AS mc, role_type AS rt, title AS t WHERE rt.role = 'actor' AND ct.id = mc.company_type_id AND t.id = mc.movie_id AND chn.id = ci.person_role_...
job
SELECT MIN(k.keyword) AS movie_keyword, MIN(n.name) AS actor_name, MIN(t.title) AS marvel_movie FROM cast_info AS ci, keyword AS k, movie_keyword AS mk, name AS n, title AS t WHERE n.name LIKE '%Downey%Robert%' AND ci.movie_id = mk.movie_id AND t.id = mk.movie_id AND k.id = mk.keyword_id AND t.id = ci.movie_id AND n.id...
job
SELECT COUNT(*) FROM comments AS c, posts AS p, postHistory AS ph, votes AS v, users AS u WHERE ph.UserId = v.UserId AND u.Id = c.UserId AND p.OwnerUserId = ph.UserId AND c.UserId = p.OwnerUserId AND p.Score <= 13 AND p.AnswerCount >= 0 LIMIT 200;
stats
SELECT s_suppkey, s_name, s_address, s_phone, total_revenue FROM supplier, revenue0 WHERE s_suppkey = supplier_no AND total_revenue = ( SELECT MIN(total_revenue) FROM revenue0 ) ORDER BY s_suppkey LIMIT 50;
tpch
SELECT c_address, c_custkey, SUM(l_extendedprice * (1 - l_discount)) AS revenue, n_name, c_name, c_comment, c_phone, c_acctbal FROM customer, orders, lineitem, nation WHERE c_custkey = o_custkey AND l_orderkey = o_orderkey AND o_orderdate >= DATE 1 AND o_orderdate < DATE 1 + INTERVAL '3' MONTH AND l_returnflag = 'R' AN...
tpch
select min(t.title) as movie_title from company_name as cn, keyword as k, movie_companies as mc, movie_keyword as mk, title as t where k.keyword ='character-name-in-title' AND mc.movie_id = t.id AND cn.id = mc.company_id AND mk.keyword_id = k.id AND t.id = mk.movie_id AND mc.movie_id = mk.movie_id AND cn.country_code =...
job
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 = mk.movie_id AND k.keyword LIKE '%sequel%' AND k.id = mk.keyword_id AND mk.movie_id = mi.movie_id AND t.id = mi.movie_id AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Denish', 'Nor...
job
SELECT o_shippriority, SUM(l_extendedprice * (1 - l_discount)) AS revenue, o_orderdate, l_orderkey FROM customer, orders, lineitem WHERE l_orderkey = o_orderkey AND l_shipdate > DATE 1 AND o_orderdate < DATE 1 AND c_custkey = o_custkey AND c_mktsegment = 1 GROUP BY l_orderkey, o_orderdate, o_shippriority ORDER BY reven...
tpch
SELECT MAX(mc.note) AS production_note, MAX(t.title) AS movie_title, MAX(t.production_year) AS movie_year FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info_idx AS mi_idx, title AS t WHERE it.id = mi_idx.info_type_id AND ct.kind = 'production companies' AND t.id = mc.movie_id AND mc.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 mc.company_id = cn.id AND an1.person_id = ci.person_id AND an1.person_id = n1.id AND ci.note = '(voice: English...
job
SELECT COUNT(*) FROM postHistory AS ph, posts AS p, votes AS v, badges AS b, users AS u, comments AS c WHERE p.Score <= 192 AND p.Id = v.PostId AND p.Id = c.PostId AND u.Id = b.UserId AND u.Id = p.OwnerUserId AND p.ViewCount >= 0 AND p.Id = ph.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 '%(uncredited)%' AND t.id = mc.movie_id AND t.production_year > 2005 AND chn.id = ci.pe...
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 t.id = mc.movie_id AND mc.movie_id = mi.movie_id AND it.info = 'bottom 10 r...
job
SELECT MIN(chn.name) AS uncredited_voiced_character, MIN(t.title) AS russian_movie FROM char_name AS chn, cast_info AS ci, company_name AS cn, company_type AS ct, movie_companies AS mc, role_type AS rt, title AS t WHERE rt.id = ci.role_id AND cn.id = mc.company_id AND cn.country_code = '[ru]' AND t.id = ci.movie_id AND...
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 = v.PostId AND u.Id = p.OwnerUserId AND u.Id = b.UserId AND p.ViewCount >= 0 AND p.Id = ph.PostId AND p.Id = c.PostId AND p.Score <= 192
stats
SELECT MIN(t.title) AS movie_title FROM company_name AS cn, keyword AS k, movie_companies AS mc, movie_keyword AS mk, title AS t WHERE cn.country_code ='[nl]' AND mc.movie_id = t.id AND mc.movie_id = mk.movie_id AND t.id = mk.movie_id AND mk.keyword_id = k.id AND cn.id = mc.company_id AND k.keyword ='character-name-IN-...
job
SELECT SUM(sr_return_quantity) AS store_returns_quantity, s_store_id, s_store_name, SUM(ss_quantity) AS store_sales_quantity, SUM(cs_quantity) AS catalog_sales_quantity, i_item_desc, 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_ti...
tpcds
SELECT i_manufact_id, SUM(ss_ext_sales_price) AS ext_price, 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 JO...
tpcds
SELECT supp_nation, cust_nation, l_year, SUM(volume) AS revenue FROM ( SELECT n1.n_name AS supp_nation, n2.n_name AS cust_nation, EXTRACT(YEAR FROM l_shipdate) AS l_year, l_extendedprice * (1 - l_discount) AS volume FROM supplier, lineitem, orders, customer, nation n1, nation n2 WHERE o_orderkey = l_orderkey AND s_nati...
tpch
Select i_item_id, Avg(ss_quantity) As agg1, Avg(ss_list_price) As agg2, Avg(ss_coupon_amt) As agg3, Avg(ss_sales_price) As agg4 From store_sales Join customer_demographics On ss_cdemo_sk = cd_demo_sk Join date_dim On ss_sold_date_sk = d_date_sk Join item On ss_item_sk = i_item_sk Join promotion On ss_promo_sk = p_promo...
tpcds
SELECT i_item_id, i_item_desc, s_store_id, s_store_name, SUM(ss_quantity) AS store_sales_quantity, SUM(sr_return_quantity) AS store_returns_quantity, SUM(cs_quantity) AS catalog_sales_quantity FROM store_sales INNER JOIN store_returns ON ss_customer_sk = sr_customer_sk AND ss_item_sk = sr_item_sk AND ss_ticket_number =...
tpcds
WITH year_total AS ( SELECT 's' AS sale_type, c_preferred_cust_flag AS customer_preferred_cust_flag, c_birth_country AS customer_birth_country, 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_...
tpcds
select count(*) from comments as c, postHistory as ph, votes as v, users as u where u.UpVotes <= 123 AND u.Id = v.UserId AND v.UserId = ph.UserId AND ph.UserId = c.UserId AND u.Views >= 0 AND u.DownVotes >= 0
stats
SELECT s_name, COUNT(1) AS numwait FROM supplier, lineitem l1, orders, nation WHERE o_orderkey = l1.l_orderkey AND NOT EXISTS ( SELECT * FROM lineitem l3 WHERE l3.l_orderkey = l1.l_orderkey AND l3.l_suppkey <> l1.l_suppkey AND l3.l_receiptdate > l3.l_commitdate ) AND s_nationkey = n_nationkey AND s_suppkey = l1.l_suppk...
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 o_orderkey = l_o...
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 l_shipdate between DATE '1995-01-0...
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 ml.linked_movie_id = t.id AND it.id = pi.info_type_id AN...
job
select count(*) from comments as c, postHistory as ph, badges as b, votes as v, users as u where u.Id = b.UserId AND ph.UserId = v.UserId AND b.UserId = ph.UserId AND u.UpVotes = 0 AND ph.PostHistoryTypeId = 12 AND v.UserId = c.UserId
stats
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 ct.id = mc.company_type_id AND t.production_year > 1990 AND c...
job
SELECT MIN(t.title) AS movie_title FROM keyword AS k, movie_info AS mi, movie_keyword AS mk, title AS t WHERE mk.movie_id = mi.movie_id AND t.id = mi.movie_id AND k.keyword LIKE '%sequel%' AND t.id = mk.movie_id AND k.id = mk.keyword_id AND t.production_year > 2005 AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Denmar...
job
SELECT s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE o_orderstatus = 'F' 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 n_name = 1 AND EXISTS ( SELEC...
tpch
SELECT i_item_id, i_item_desc, i_current_price FROM item INNER JOIN inventory ON i_item_sk = inv_item_sk INNER JOIN date_dim ON d_date_sk = inv_date_sk INNER JOIN catalog_sales ON cs_item_sk = i_item_sk WHERE inv_quantity_on_hand >= 100 AND inv_quantity_on_hand <= 500 AND i_current_price BETWEEN 83 AND 83 + 30 AND d_da...
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 c_custkey = o_custkey AND ( (n1.n_...
tpch
SELECT COUNT(*) FROM postHistory AS ph, posts AS p, votes AS v, badges AS b, users AS u, comments AS c WHERE p.Id = c.PostId AND u.Id = b.UserId AND p.Score <= 192 AND u.Id = p.OwnerUserId AND p.ViewCount >= 0 AND p.Id = v.PostId AND p.Id = ph.PostId
stats
SELECT MIN(t.title) AS american_movie FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info AS mi, title AS t WHERE it.id = mi.info_type_id AND t.id = mi.movie_id AND ct.id = mc.company_type_id AND ct.kind = 'production companies' AND (mc.note LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%...
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 b.UserId = u.Id AND p.Id = v.PostId AND p.Id = pl.RelatedPostId AND p.Id = ph.PostId AND p.Score <= 40 AND pl.LinkTypeId = 1 AND p.Id = c.PostId AND c.UserId = u.Id
stats
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 p_name LIKE 1 ) AS profit AND s_nationkey = n_nationkey AND p...
tpch
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 it.id = mi_idx.info_type_id AND it.info = 'top 250 rank' AND t...
job
SELECT MIN(n.name) AS of_person, MIN(t.title) AS biography_movie FROM aka_name AS an, cast_info AS ci, info_type AS it, link_type AS lt, movie_link AS ml, name AS n, person_info AS pi, title AS t WHERE t.production_year BETWEEN 1980 AND 1995 AND ci.movie_id = ml.linked_movie_id AND pi.person_id = an.person_id AND lt.li...
job
SELECT i_item_desc, i_item_id, s_store_name, s_store_id, SUM(ss_quantity) AS store_sales_quantity, SUM(cs_quantity) AS catalog_sales_quantity, SUM(sr_return_quantity) AS store_returns_quantity FROM store_sales JOIN store_returns ON ss_customer_sk = sr_customer_sk AND ss_item_sk = sr_item_sk AND ss_ticket_number = sr_ti...
tpcds
SELECT MIN(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 ct.kind = 'production companies' AND t.id = mi.movie_id AND ct.id = mc.company_type_id AND t.id = mc.movie_id AND mc.movie_...
job