text
stringlengths
84
1.49k
benchmark
stringclasses
4 values
SELECT STDDEV_SAMP(sr_return_quantity) AS store_returns_quantitystdev, AVG(cs_quantity) AS catalog_sales_quantityave, COUNT(cs_quantity) AS catalog_sales_quantitycount, AVG(sr_return_quantity) AS store_returns_quantityave, i_item_id, STDDEV_SAMP(ss_quantity) / AVG(ss_quantity) AS store_sales_quantitycov, STDDEV_SAMP(sr...
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 t.id = mc.movie_id AND mi.movie_id = mc.m...
job
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 dt.d_year = 1999 AND item.i_manager_id = 67 AND dt.d_moy = 11 group by ...
tpcds
Select o_orderdate, c_name, o_totalprice, Sum(l_quantity), c_custkey, o_orderkey From customer, orders, lineitem Where o_orderkey In ( Select l_orderkey From lineitem Group By l_orderkey Having Sum(l_quantity) > 1 ) And c_custkey = o_custkey And o_orderkey = l_orderkey Group By c_name, c_custkey, o_orderkey, o_orderdat...
tpch
SELECT 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 AVG(cs_coupon_amt) AS agg3, i_item_id, AVG(cs_list_price) AS agg2, AVG(cs_sales_price) AS agg4, AVG(cs_quantity) AS agg1 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(cs_sales_price) AS agg4, AVG(cs_coupon_amt) AS agg3, AVG(cs_list_price) AS agg2, AVG(cs_quantity) AS agg1, i_item_id FROM catalog_sales JOIN customer_demographics ON cs_bill_cdemo_sk = cd_demo_sk JOIN date_dim ON cs_sold_date_sk = d_date_sk JOIN item ON cs_item_sk = i_item_sk JOIN promotion ON cs_promo_sk = ...
tpcds
SELECT i_manufact_id, i_manufact, i_brand_id AS brand_id, i_brand AS brand, SUM(ss_ext_sales_price) AS ext_price 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 c_last_name, c_first_name, c_salutation, c_preferred_cust_flag, ss_ticket_number, cnt from ( select ss_ticket_number, ss_customer_sk, count(*) as cnt from store_sales join date_dim on ss_sold_date_sk = d_date_sk join store on ss_store_sk = s_store_sk join household_demographics on ss_hdemo_sk = hd_demo_sk where ...
tpcds
Select p_partkey, p_mfgr, s_address, s_acctbal, s_name, s_phone, s_comment, n_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
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 t.production_year > 2010 AND k.id = mk.keyword_id AND t.id = ci.movie_id AND ci.movie_id = mk.movie_id AND n.name LIKE '%Downey%Robert%' AN...
job
SELECT n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, supplier, nation, region WHERE r_name = 1 AND o_orderdate >= DATE 1 AND l_suppkey = s_suppkey AND c_custkey = o_custkey AND c_nationkey = s_nationkey AND o_orderdate < DATE 1 + INTERVAL '1' YEAR AND s_nationkey = n_nation...
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 ...
tpcds
SELECT l_shipmode, SUM( CASE WHEN o_orderpriority = '1-URGENT' OR o_orderpriority = '2-HIGH' THEN 1 ELSE 0 END ) AS high_line_count, SUM( CASE WHEN o_orderpriority <> '1-URGENT' AND o_orderpriority <> '2-HIGH' THEN 1 ELSE 0 END ) AS low_line_count FROM orders, lineitem WHERE l_shipdate < l_commitdate AND l_commitdate <...
tpch
select cnt, c_first_name, c_salutation, c_last_name, c_preferred_cust_flag, ss_ticket_number from ( select ss_ticket_number, ss_customer_sk, count(*) as cnt from store_sales join date_dim on ss_sold_date_sk = d_date_sk join store on ss_store_sk = s_store_sk join household_demographics on ss_hdemo_sk = hd_demo_sk where ...
tpcds
select min(mc.note) as production_note, min(t.title) as movie_title, min(t.production_year) as movie_year from company_type as ct, info_type as it, movie_companies as mc, movie_info_idx as mi_idx, title as t where ct.kind = 'production companies' AND mc.movie_id = mi_idx.movie_id AND ct.id = mc.company_type_id AND mc.n...
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 mi.movie_id = mc.movie_id AND an.person_id = n.id AND t.id = mc.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.id = mk.movie_id AND t.id = ci.movie_id AND n.id = ci.person_id AND k.id = mk.keyword_id AND ci.movie_id = mk.movie_id AND t.production_y...
job
SELECT MIN(t.title) AS movie_title FROM keyword AS k, movie_info AS mi, movie_keyword AS mk, title AS t WHERE k.id = mk.keyword_id AND t.id = mi.movie_id AND t.id = mk.movie_id AND t.production_year > 2010 AND mk.movie_id = mi.movie_id AND k.keyword LIKE '%sequel%' AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Danish...
job
SELECT s_name, s_address, p_partkey, s_acctbal, n_name, s_comment, s_phone, p_mfgr FROM part, supplier, partsupp, nation, region WHERE p_partkey = ps_partkey AND s_suppkey = ps_suppkey AND n_regionkey = r_regionkey AND ps_supplycost = ( SELECT MIN(ps_supplycost) FROM partsupp, supplier, nation, region WHERE p_partkey =...
tpch
Select Count(*) From comments As c, posts As p, votes As v, users As u Where p.ViewCount >= 0 AND c.Score = 0 AND p.Score >= 0 AND u.Id = p.OwnerUserId AND u.Id = v.UserId AND u.Id = c.UserId Limit 500;
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 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 c_salutation, c_preferred_cust_flag, ss_ticket_number, c_first_name, cnt, c_last_name FROM ( SELECT ss_ticket_number, ss_customer_sk, COUNT(*) AS cnt FROM store_sales JOIN date_dim ON ss_sold_date_sk = d_date_sk JOIN store ON ss_store_sk = s_store_sk JOIN household_demographics ON ss_hdemo_sk = hd_demo_sk WHERE ...
tpcds
SELECT MIN(t.title) AS movie_title FROM keyword AS k, movie_info AS mi, movie_keyword AS mk, title AS t WHERE k.keyword LIKE '%sequel%' AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Danish', 'Swedish', 'Danish', 'Norwegian', 'German') AND mk.movie_id = mi.movie_id AND t.id = mk.movie_id AND t.id = mi.movie_id AND k.i...
job
Select p_brand, p_type, p_size, Count(Distinct ps_suppkey) As supplier_cnt From partsupp, part Where 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%' ) AND p_brand <> 1 AND p_partkey = ps_partkey AND p_type Not Like 1 Group By p_brand...
tpch
SELECT MIN(n.name) AS voicing_actress, MIN(t.title) AS voiced_movie FROM aka_name AS an, char_name AS chn, cast_info AS ci, company_name AS cn, info_type AS it, movie_companies AS mc, movie_info AS mi, name AS n, role_type AS rt, title AS t WHERE t.production_year > 2000 AND mc.note LIKE '%(USA)%' AND ci.movie_id = mc....
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.id = mc.company_id AND k.keyword ='character-name-in-title' AND mc.movie_id = mk.movie_id AND mc.movie_id = t.id AND cn.country_code ='[sm]' AND t.id = mk.movie_id AND mk.keyword_id ...
job
SELECT i_item_id, i_item_desc, i_category, i_class, i_current_price, SUM(ws_ext_sales_price) AS itemrevenue, SUM(ws_ext_sales_price) * 100 / SUM(SUM(ws_ext_sales_price)) OVER (PARTITION BY i_class) AS revenueratio FROM web_sales JOIN item ON ws_item_sk = i_item_sk JOIN date_dim ON ws_sold_date_sk = d_date_sk WHERE i_ca...
tpcds
SELECT MIN(n.name) AS voicing_actress, MIN(t.title) AS voiced_movie FROM aka_name AS an, char_name AS chn, cast_info AS ci, company_name AS cn, info_type AS it, movie_companies AS mc, movie_info AS mi, name AS n, role_type AS rt, title AS t WHERE cn.id = mc.company_id AND chn.id = ci.person_role_id AND it.id = mi.info_...
job
SELECT s_store_id, MAX(ss_net_profit) AS store_sales_profit, i_item_desc, MAX(cs_net_profit) AS catalog_sales_profit, MAX(sr_net_loss) AS store_returns_loss, s_store_name, i_item_id FROM store_sales JOIN store_returns ON store_sales.ss_customer_sk = store_returns.sr_customer_sk AND store_sales.ss_item_sk = store_return...
tpcds
WITH _q AS ( SELECT MIN(t.title) AS movie_title FROM company_name AS cn, keyword AS k, movie_companies AS mc, movie_keyword AS mk, title AS t WHERE mk.keyword_id = k.id AND cn.id = mc.company_id AND mc.movie_id = t.id AND k.keyword ='character-name-in-title' AND cn.country_code ='[sm]' AND mc.movie_id = mk.movie_id ) S...
job
select s_name, s_address from supplier, nation where n_name = 1 AND s_nationkey = n_nationkey AND s_suppkey in ( select ps_suppkey from partsupp where ps_partkey in ( select p_partkey from part where p_name like 1 ) and ps_availqty > ( select 0.5 * sum(l_quantity) from lineitem where l_partkey = ps_partkey and l_suppke...
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 t.id = mk.movie_id AND t.id = ci.movie_id AND k.keyword = 'marvel-cinematic-universe' AND ci.movie_id = mk.movie_id AND t.production_year >...
job
SELECT COUNT(*) FROM comments AS c, postHistory AS ph, badges AS b, votes AS v, users AS u WHERE v.UserId = c.UserId AND u.UpVotes = 0 AND ph.UserId = v.UserId AND ph.PostHistoryTypeId = 12 AND u.Id = b.UserId AND b.UserId = ph.UserId LIMIT 10;
stats
SELECT MIN(an.name) AS cool_actor_pseudonym, MIN(t.title) AS series_named_after_char FROM aka_name AS an, cast_info AS ci, company_name AS cn, keyword AS k, movie_companies AS mc, movie_keyword AS mk, name AS n, title AS t WHERE cn.country_code = '[us]' AND an.person_id = ci.person_id AND ci.movie_id = t.id AND n.id = ...
job
SELECT s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE o_orderkey = l1.l_orderkey AND s_suppkey = l1.l_suppkey AND o_orderstatus = 'F' AND EXISTS ( SELECT * FROM lineitem l2 WHERE l2.l_orderkey = l1.l_orderkey AND l2.l_suppkey <> l1.l_suppkey ) AND n_name = 1 AND s_nationkey = n_nationkey A...
tpch
SELECT c_first_name, extended_price, ss_ticket_number, extended_tax, list_price, bought_city, ca_city, c_last_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 COUNT(*) FROM postHistory AS ph, posts AS p, users AS u, badges AS b WHERE u.Reputation >= 1 AND u.Id = b.UserId AND p.OwnerUserId = u.Id AND p.Score >= -7 AND ph.PostHistoryTypeId = 3 AND ph.UserId = u.Id LIMIT 100;
stats
SELECT MIN(mi_idx.info) AS rating, MIN(t.title) AS northamerican_movie FROM aka_title AS at, company_name AS cn, info_type AS it1, info_type AS it2, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS mi_idx, title AS t WHERE at.movie_id = mi_idx.movie_id AND at.movie_id = mi.movie_id AND t.id =...
job
SELECT s_acctbal, s_name, n_name, p_partkey, p_mfgr, s_address, s_phone, s_comment FROM part, supplier, partsupp, nation, region WHERE n_regionkey = r_regionkey AND r_name = 1 AND s_suppkey = ps_suppkey AND ps_supplycost = ( SELECT MIN(ps_supplycost) FROM partsupp, supplier, nation, region WHERE p_partkey = ps_partkey ...
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 t.id = mk.movie_id AND t.episode_nr >= 50 AND t.episode_nr < 100 AND mc.movie_id = mk.movie...
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.country_code = '[ru]' AND t.id = mc.movie_id AND t.id = ci.movie_id AND ci.note LIKE '%(uncredite...
job
SELECT COUNT(ss_quantity) AS store_sales_quantitycount, AVG(ss_quantity) AS store_sales_quantityave, COUNT(sr_return_quantity) AS store_returns_quantitycount, STDDEV_SAMP(sr_return_quantity) AS store_returns_quantitystdev, i_item_desc, COUNT(cs_quantity) AS catalog_sales_quantitycount, s_state, STDDEV_SAMP(ss_quantity)...
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.country_code ='[de]' AND k.keyword ='character-name-in-title' AND mc.movie_id = t.id AND mk.keyword_id = k.id AND cn.id = mc.company_id AND mc.movie_id = mk.movie_id AND t.id = mk.mo...
job
SELECT MIN(cn.name) AS movie_company, MIN(mi_idx.info) AS rating, MIN(t.title) AS western_violent_movie FROM company_name AS cn, company_type AS ct, info_type AS it1, info_type AS it2, keyword AS k, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS mi_idx, movie_keyword AS mk, title AS t WHERE...
job
SELECT s_store_id, SUM(ss_quantity) AS store_sales_quantity, s_store_name, SUM(cs_quantity) AS catalog_sales_quantity, SUM(sr_return_quantity) AS store_returns_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 MIN(mi_idx.info) AS rating, MIN(t.title) AS movie_title FROM info_type AS it, movie_info_idx AS mi_idx, title AS t WHERE it.info ='rating' AND t.production_year BETWEEN 2000 AND 2010 AND mi_idx.info > '7.0' AND t.id = mi_idx.movie_id AND it.id = mi_idx.info_type_id LIMIT 50;
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 t.id = mi.movie_id AND chn.id = ci.person_role_id AND ci.person_id = an.p...
job
SELECT COUNT(1) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v WHERE c.Score = 0 AND p.Id = v.PostId AND p.Id = pl.PostId AND p.Id = c.PostId AND p.Id = ph.PostId AND pl.LinkTypeId = 1 AND p.FavoriteCount >= 0
stats
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 i_current_price BETWEEN 77 AND 77 + 30 AND d_date BETWEEN CAST('2001-07-13' AS DATE) AND (CAST('2001-07-13' AS DATE) + INTERVAL '...
tpcds
select count(1) from comments as c, posts as p, votes as v, users as u where p.Score >= 0 AND u.Id = p.OwnerUserId AND u.Id = v.UserId AND c.Score = 0 AND u.Id = c.UserId AND p.ViewCount >= 0
stats
SELECT AVG(cs_quantity) AS catalog_sales_quantityave, COUNT(ss_quantity) AS store_sales_quantitycount, s_state, STDDEV_SAMP(ss_quantity) / AVG(ss_quantity) AS store_sales_quantitycov, STDDEV_SAMP(cs_quantity) / AVG(cs_quantity) AS catalog_sales_quantitycov, AVG(sr_return_quantity) AS store_returns_quantityave, STDDEV_S...
tpcds
SELECT COUNT(*) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v, users AS u WHERE p.Id = v.PostId AND p.Id = pl.PostId AND p.Id = ph.PostId AND u.Id = p.OwnerUserId AND p.Id = c.PostId AND p.AnswerCount >= 0 AND p.PostTypeId = 1
stats
SELECT CAST(promotions AS DECIMAL(15, 4)) / CAST(total AS DECIMAL(15, 4)) * 100, total, promotions FROM ( SELECT SUM(ss_ext_sales_price) AS promotions FROM store_sales JOIN store ON ss_store_sk = s_store_sk JOIN promotion ON ss_promo_sk = p_promo_sk JOIN date_dim ON ss_sold_date_sk = d_date_sk JOIN customer ON ss_custo...
tpcds
SELECT MIN(t.title) AS movie_title FROM keyword AS k, movie_info AS mi, movie_keyword AS mk, title AS t WHERE t.id = mk.movie_id AND mk.movie_id = mi.movie_id AND t.production_year > 2010 AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Danish', 'Swedish', 'Danish', 'Norwegian', 'German') AND k.keyword LIKE '%sequel%' A...
job
SELECT ca_zip, SUM(cs_sales_price) FROM catalog_sales JOIN customer ON cs_bill_customer_sk = c_customer_sk JOIN customer_address ON c_current_addr_sk = ca_address_sk JOIN date_dim ON cs_sold_date_sk = d_date_sk WHERE (SUBSTR(ca_zip, 1, 5) IN ( '85669', '86197', '88274', '83405', '86475', '85392', '85460', '80348', '817...
tpcds
SELECT s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE s_suppkey = l1.l_suppkey 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 s_nationkey = n_nationkey AND o_orderst...
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.name LIKE '%Downey%Robert%' AND k.keyword = 'marvel-cinematic-universe' AND k.id = mk.keyword_id AND ci.movie_id = mk.movie_id AND n.id =...
job
select min(t.title) as american_movie from company_type as ct, info_type as it, movie_companies as mc, movie_info as mi, title as t where t.id = mc.movie_id AND it.info = 'bottom 10 rank' AND (mc.note like '%(co-production)%' or mc.note like '%(presents)%') AND it.id = mi.info_type_id AND ct.id = mc.company_type_id AND...
job
WITH year_total AS ( SELECT c_email_address AS customer_email_address, c_last_name AS customer_last_name, SUM(((ss_ext_list_price - ss_ext_wholesale_cost - ss_ext_discount_amt) + ss_ext_sales_price) / 2) AS year_total, 's' AS sale_type, d_year AS dyear, c_birth_country AS customer_birth_country, c_login AS customer_log...
tpcds
SELECT MIN(mi.info) AS release_date, MIN(miidx.info) AS rating, MIN(t.title) AS german_movie FROM company_name AS cn, company_type AS ct, info_type AS it, info_type AS it2, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS miidx, title AS t WHERE it2.info = 'release dates' AND cn.country_code ...
job
select min(t.title) as american_movie from company_type as ct, info_type as it, movie_companies as mc, movie_info as mi, title as t where mc.note not like '%(as Metro-Goldwyn-Mayer Pictures)%' and ct.kind = 'production companies' and it.info = 'bottom 10 rank' and it.id = mi.info_type_id and ct.id = mc.company_type_id ...
job
select l_orderkey, o_shippriority, sum(l_extendedprice * (1 - l_discount)) as revenue, o_orderdate from customer, orders, lineitem where l_shipdate > DATE 1 AND c_mktsegment = 1 AND o_orderdate < DATE 1 AND l_orderkey = o_orderkey AND c_custkey = o_custkey group by l_orderkey, o_orderdate, o_shippriority order by reven...
tpch
Select COUNT(1) From comments As c, posts As p, postHistory As ph, votes As v, users As u Where u.Id = c.UserId AND p.AnswerCount >= 0 AND p.Score <= 13 AND c.UserId = p.OwnerUserId AND p.OwnerUserId = ph.UserId AND ph.UserId = v.UserId
stats
select count(*) from comments as c, posts as p, users as u where c.CreationDate >= '2010-08-05 00:36:02'::timestamp and c.UserId = u.Id and p.FavoriteCount >= 0 and p.CommentCount >= 0 and u.Id = p.OwnerUserId and p.ViewCount >= 0 LIMIT 10;
stats
SELECT COUNT(*) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v, badges AS b WHERE p.Id = pl.RelatedPostId AND p.Id = ph.PostId AND pl.LinkTypeId = 1 AND p.Id = v.PostId AND p.Id = c.PostId AND b.UserId = c.UserId AND c.Score = 0
stats
SELECT c_name, c_address, c_custkey, n_name, c_comment, c_acctbal, c_phone, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, nation WHERE c_custkey = o_custkey AND o_orderdate >= DATE 1 AND l_returnflag = 'R' AND l_orderkey = o_orderkey AND c_nationkey = n_nationkey AND o_orderdate < ...
tpch
select avg(ss_quantity), avg(ss_ext_sales_price), avg(ss_ext_wholesale_cost), sum(ss_ext_wholesale_cost) from store_sales join store on s_store_sk = ss_store_sk join customer_demographics on cd_demo_sk = ss_cdemo_sk join household_demographics on hd_demo_sk = ss_hdemo_sk join customer_address on ca_address_sk = ss_addr...
tpcds
SELECT MIN(k.keyword) AS movie_keyword, MIN(n.name) AS actor_name, MIN(t.title) AS marvel_movie FROM cast_info AS ci, keyword AS k, movie_keyword AS mk, name AS n, title AS t WHERE k.keyword = 'marvel-cinematic-universe' AND t.production_year > 2010 AND n.name LIKE '%Downey%Robert%' AND t.id = mk.movie_id AND k.id = mk...
job
select count(1) from comments as c, posts as p, postLinks as pl, votes as v where c.CreationDate >= '2010-08-02 23:52:10'::timestamp and p.Id = c.PostId and c.PostId = pl.PostId and v.VoteTypeId = 2 and p.Score >= -3 and pl.PostId = v.PostId limit 200;
stats
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 it.id = mi_idx.info_type_id AND ct.id = mc.company_type_id AND t.id = mc.movie_id AND ct.kind = 'productio...
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 t.production_year > 2000 AND t.id = mi.movie_id AND ci.role_id = rt.id AN...
job
SELECT MIN(cn.name) AS movie_company, MIN(mi_idx.info) AS rating, MIN(t.title) AS western_violent_movie FROM company_name AS cn, company_type AS ct, info_type AS it1, info_type AS it2, keyword AS k, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS mi_idx, movie_keyword AS mk, title AS t WHERE...
job
SELECT MIN(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 (mc.note LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%') AND it.id = mi.info_type_id AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND it...
job
SELECT l_returnflag, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, l_linestatus, AVG(l_extendedprice) AS avg_price, AVG(l_discount) AS avg_disc, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, AVG(l_quantity) AS avg_qty, SUM(l_extendedprice) AS sum_base_price, SUM(l_quantity) AS sum_qt...
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 p_partkey = l_partkey AND o_orderkey = l_orderkey AND p_name ...
tpch
SELECT SUM( CASE WHEN o_orderpriority <> '1-URGENT' AND o_orderpriority <> '2-HIGH' THEN 1 ELSE 0 END ) AS low_line_count, l_shipmode, SUM( CASE WHEN o_orderpriority = '1-URGENT' OR o_orderpriority = '2-HIGH' THEN 1 ELSE 0 END ) AS high_line_count FROM orders, lineitem WHERE l_receiptdate < DATE 1 + INTERVAL '1' YEAR A...
tpch
SELECT MIN(an.name) AS cool_actor_pseudonym, MIN(t.title) AS series_named_after_char FROM aka_name AS an, cast_info AS ci, company_name AS cn, keyword AS k, movie_companies AS mc, movie_keyword AS mk, name AS n, title AS t WHERE mc.movie_id = mk.movie_id AND ci.movie_id = t.id AND n.id = ci.person_id AND k.keyword = 'c...
job
SELECT c_name, c_comment, n_name, c_address, c_custkey, SUM(l_extendedprice * (1 - l_discount)) AS revenue, c_phone, c_acctbal FROM customer, orders, lineitem, nation WHERE c_custkey = o_custkey AND o_orderdate < DATE 1 + INTERVAL '3' MONTH AND l_returnflag = 'R' AND o_orderdate >= DATE 1 AND l_orderkey = o_orderkey AN...
tpch
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 ct.kind = 'production companies' AND it.id = mi_idx.info_type_id AND mc.movie_id = mi_idx.movie_id AND it....
job
SELECT MIN(cn.name) AS movie_company, MIN(mi_idx.info) AS rating, MIN(t.title) AS western_violent_movie FROM company_name AS cn, company_type AS ct, info_type AS it1, info_type AS it2, keyword AS k, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS mi_idx, movie_keyword AS mk, title AS t WHERE...
job
SELECT MIN(an1.name) AS actress_pseudonym, MIN(t.title) AS japanese_movie_dubbed FROM aka_name AS an1, cast_info AS ci, company_name AS cn, movie_companies AS mc, name AS n1, role_type AS rt, title AS t WHERE mc.note LIKE '%(Japan)%' AND mc.note NOT LIKE '%(USA)%' AND ci.role_id = rt.id AND ci.movie_id = t.id AND rt.ro...
job
SELECT STDDEV_SAMP(ss_quantity) / AVG(ss_quantity) AS store_sales_quantitycov, i_item_desc, STDDEV_SAMP(sr_return_quantity) AS store_returns_quantitystdev, AVG(ss_quantity) AS store_sales_quantityave, COUNT(cs_quantity) AS catalog_sales_quantitycount, AVG(cs_quantity) AS catalog_sales_quantityave, STDDEV_SAMP(ss_quanti...
tpcds
SELECT s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE o_orderkey = l1.l_orderkey AND o_orderstatus = 'F' AND s_suppkey = l1.l_suppkey AND s_nationkey = n_nationkey AND EXISTS ( SELECT * FROM lineitem l2 WHERE l2.l_orderkey = l1.l_orderkey AND l2.l_suppkey <> l1.l_suppkey ) AND l1.l_receipt...
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 n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, supplier, nation, region WHERE r_name = 1 AND s_nationkey = n_nationkey AND l_orderkey = o_orderkey AND c_custkey = o_custkey AND l_suppkey = s_suppkey AND n_regionkey = r_regionkey AND o_orderdate < DATE 1 + INTERVAL '1'...
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 (mc.note Like '%(co-production)%' Or mc.note Like '%(presents)%') AND t.id = mi.movie_id AND mc.note Not Like '%(As Metro-Goldwyn-Mayer Pictures)%' AND ct.kind = 'production companie...
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 t.id = mc.movie_id AND n.gender = 'f' AND an.person_id = n.id AND t.id = ...
job
SELECT MIN(mi_idx.info) AS rating, MIN(t.title) AS northamerican_movie FROM aka_title AS at, company_name AS cn, info_type AS it1, info_type AS it2, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS mi_idx, title AS t WHERE t.id = at.movie_id AND kt.kind = 'movie' AND at.title LIKE '%Champion%...
job
WITH _q AS ( SELECT COUNT(*) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v, badges AS b WHERE c.Score = 0 AND p.Id = pl.RelatedPostId AND pl.LinkTypeId = 1 AND b.UserId = c.UserId AND p.Id = c.PostId AND p.Id = ph.PostId AND p.Id = v.PostId ) SELECT * FROM _q;
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 ci.movie_id = mc.movie_id AND t.id = mc.movie_id AND ci.note ...
job
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 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_ad...
tpcds
SELECT MIN(t.title) AS american_movie FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info AS mi, title AS t WHERE t.id = mi.movie_id AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND it.info = 'bottom 10 rank' AND ct.id = mc.company_type_id AND ct.kind = 'production companies' AND t...
job
SELECT o_orderdate, c_name, o_totalprice, SUM(l_quantity), c_custkey, o_orderkey FROM customer, orders, lineitem WHERE o_orderkey IN ( SELECT l_orderkey FROM lineitem GROUP BY l_orderkey HAVING SUM(l_quantity) > 1 ) AND c_custkey = o_custkey AND o_orderkey = l_orderkey GROUP BY c_name, c_custkey, o_orderkey, o_orderdat...
tpch
SELECT i_brand AS brand, SUM(ss_ext_sales_price) AS ext_price, i_manufact_id, i_manufact, i_brand_id AS brand_id FROM date_dim JOIN store_sales ON d_date_sk = ss_sold_date_sk JOIN item ON ss_item_sk = i_item_sk JOIN customer ON ss_customer_sk = c_customer_sk JOIN customer_address ON c_current_addr_sk = ca_address_sk JO...
tpcds
SELECT AVG(l_discount) AS avg_disc, l_returnflag, AVG(l_quantity) AS avg_qty, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, l_linestatus, COUNT(*) AS count_order, SUM(l_extendedprice) AS sum_base_price, AVG(l_extendedprice) AS avg_price, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, ...
tpch
SELECT AVG(l_extendedprice) AS avg_price, COUNT(*) AS count_order, AVG(l_quantity) AS avg_qty, SUM(l_quantity) AS sum_qty, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, l_returnflag, AVG(l_discount) AS avg_disc, SUM(l_extendedprice) AS sum_base_price, l_linestatus, SUM(l_extendedprice * (1 - l_discount) * ...
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 ct.id = mc.company_type_id AND mc.n...
job
SELECT COUNT(1) FROM votes AS v, posts AS p, badges AS b, users AS u WHERE u.Id = p.OwnerUserId AND u.Reputation >= 1 AND u.Id = b.UserId AND p.Score <= 22 AND p.Id = v.PostId LIMIT 50;
stats
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 it.id = mi_idx.info_type_id AND mc.movie_id = mi_idx.movie_id AND t.id = mc.movie_id AND ct.id = mc.compan...
job