text
stringlengths
84
1.49k
benchmark
stringclasses
4 values
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_orderdate BETWEEN D...
tpch
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 c.UserId = u.Id AND p.Id = ph.PostId AND b.UserId = u.Id AND p.Score <= 40 AND p.Id = pl.RelatedPostId AND pl.LinkTypeId = 1 AND p.Id = c.PostId
stats
SELECT c_first_name, extended_price, list_price, ca_city, bought_city, extended_tax, ss_ticket_number, 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 o_year, SUM( CASE WHEN nation = 1 THEN volume ELSE 0 END ) / SUM(volume) AS mkt_share FROM ( SELECT EXTRACT(YEAR FROM o_orderdate) AS o_year, l_extendedprice * (1 - l_discount) AS volume, n2.n_name AS nation FROM part, supplier, lineitem, orders, customer, nation n1, nation n2, region WHERE p_type = 1 ) AS all_n...
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 it1.info = 'rating' AND mi_idx.movie_id ...
job
Select cc_name As call_center_name, cc_manager As manager, Sum(cr_net_loss) As returns_loss, cc_call_center_id As call_center From call_center Join catalog_returns On cr_call_center_sk = cc_call_center_sk Join date_dim On cr_returned_date_sk = d_date_sk Join customer On cr_returning_customer_sk = c_customer_sk Join cus...
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.movie_id = mi_idx.movie_id AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND t.id = mi_idx...
job
SELECT MIN(cn.name) AS movie_company, MIN(mi_idx.info) AS rating, MIN(t.title) AS western_violent_movie FROM company_name AS cn, company_type AS ct, info_type AS it1, info_type AS it2, keyword AS k, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS mi_idx, movie_keyword AS mk, title AS t WHERE...
job
SELECT c_first_name, extended_price, ca_city, c_last_name, ss_ticket_number, extended_tax, bought_city, list_price 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 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 b.UserId = u.Id AND p.Id = pl.RelatedPostId AND p.Id = ph.PostId AND pl.LinkTypeId = 1 AND p.Id = c.PostId AND p.Score <= 40 AND c.UserId = u.Id
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 n.id = ci.person_id AND an.person_id = n.id AND t.episode_nr < 100 AND cn.country_code = '[...
job
SELECT nation, SUM(amount) AS sum_profit, o_year FROM ( SELECT n_name AS nation, EXTRACT(YEAR FROM o_orderdate) AS o_year, l_extendedprice * (1 - l_discount) - ps_supplycost * l_quantity AS amount FROM part, supplier, lineitem, partsupp, orders, nation WHERE p_partkey = l_partkey AND s_nationkey = n_nationkey AND p_nam...
tpch
SELECT MIN(mc.note) AS production_note, MIN(t.title) AS movie_title, MIN(t.production_year) AS movie_year FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info_idx AS mi_idx, title AS t WHERE mc.movie_id = mi_idx.movie_id AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND it.info = 'to...
job
SELECT SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, AVG(l_extendedprice) AS avg_price, SUM(l_extendedprice) AS sum_base_price, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, AVG(l_quantity) AS avg_qty, COUNT(*) AS count_order, l_linestatus, l_returnflag, SUM(l_quantity) AS sum_qty, A...
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 ct.kind = 'production companies' AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND t.id = mc.movie_id AND t.id = mi.movie_id AND mc.movie_id = mi.movie_id AND ct.id = mc...
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 mi.info IN ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Denish', 'Norwegian', 'German') AND t.id = mk.movie_id AND mk.movie_id = mi.movie_id AND k.keyword LIKE '%sequel%' AND ...
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 mi.info = ANY(ARRAY['Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Danish', 'Norwegian', 'German']) AND k.keyword LIKE '%sequel%' AND mk.movie_id = mi.movie_id AND k.id = mk.keywor...
job
SELECT MIN(k.keyword) AS movie_keyword, MIN(n.name) AS actor_name, MIN(t.title) AS marvel_movie FROM cast_info AS ci, keyword AS k, movie_keyword AS mk, name AS n, title AS t WHERE t.id = mk.movie_id AND k.id = mk.keyword_id AND ci.movie_id = mk.movie_id AND k.keyword = 'marvel-cinematic-universe' AND t.id = ci.movie_i...
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 k.keyword = 'marvel-cinematic-universe' AND k.id = mk.keyword_id AND n.name LIKE '%Downey%Robert%' AND n.id = ci.person_id AND t.id = mk.mo...
job
SELECT AVG(ss_quantity), AVG(ss_ext_sales_price), AVG(ss_ext_wholesale_cost), SUM(ss_ext_wholesale_cost) FROM store_sales INNER JOIN store ON s_store_sk = ss_store_sk INNER JOIN customer_demographics ON cd_demo_sk = ss_cdemo_sk INNER JOIN household_demographics ON hd_demo_sk = ss_hdemo_sk INNER JOIN customer_address ON...
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 mc.movie_id = t.id And miidx.movie_id = t.id An...
job
SELECT MIN(lt.link) AS link_type, MIN(t.title) AS western_sequel, MIN(cn.name) AS from_company 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 mi.note LIKE '%internet%' AND t.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 ct.kind = 'production companies' AND mc.movie_id = mi_idx.movie_id AND it.info = 'top 250 rank' AND ct.id ...
job
SELECT ca_city, extended_tax, list_price, bought_city, c_last_name, ss_ticket_number, c_first_name, extended_price 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 s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE o_orderkey = l1.l_orderkey AND EXISTS ( SELECT * FROM lineitem l2 WHERE l2.l_orderkey = l1.l_orderkey AND l2.l_suppkey <> l1.l_suppkey ) AND NOT EXISTS ( SELECT * FROM lineitem l3 WHERE l3.l_orderkey = l1.l_orderkey AND l3.l_suppkey <> ...
tpch
SELECT AVG(cs_quantity) AS catalog_sales_quantityave, i_item_desc, s_state, COUNT(sr_return_quantity) AS store_returns_quantitycount, STDDEV_SAMP(sr_return_quantity) / AVG(sr_return_quantity) AS store_returns_quantitycov, i_item_id, COUNT(ss_quantity) AS store_sales_quantitycount, STDDEV_SAMP(sr_return_quantity) AS sto...
tpcds
SELECT l_linestatus, AVG(l_discount) AS avg_disc, l_returnflag, SUM(l_extendedprice) AS sum_base_price, SUM(l_quantity) AS sum_qty, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, COUNT(*) AS count_order, AVG(l_extendedprice) AS avg_price, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, ...
tpch
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 = 2001 AND item.i_manager_id = 11 AND dt.d_moy = 12 group by ...
tpcds
SELECT MIN(t.title) AS movie_title, MIN(mi_idx.info) AS rating FROM info_type AS it, movie_info_idx AS mi_idx, title AS t WHERE t.production_year >= 2000 AND it.info ='rating' AND t.production_year <= 2005 AND t.id = mi_idx.movie_id AND it.id = mi_idx.info_type_id AND mi_idx.info > '8.0'
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 it.id = mi_idx.info_type_id AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND it.info = 'top ...
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 p_partkey = l_partkey AND s_nationkey = n_nationkey AND s_sup...
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 p_name LIKE 1 ) AS profit AND s_nat...
tpch
SELECT c_preferred_cust_flag, ss_ticket_number, c_first_name, c_last_name, c_salutation, 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 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_supp...
tpch
SELECT MIN(n.name) AS voicing_actress, MIN(t.title) AS voiced_movie FROM aka_name AS an, char_name AS chn, cast_info AS ci, company_name AS cn, info_type AS it, movie_companies AS mc, movie_info AS mi, name AS n, role_type AS rt, title AS t WHERE n.id = ci.person_id AND ci.movie_id = mc.movie_id AND t.id = ci.movie_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 l_orderkey = o_orderkey AND c_nationkey = n_nationkey AND o_orderdate < DATE 1 + INTERVAL '3' MONTH AND l_returnflag = 'R' AND o_orderdate >= DATE ...
tpch
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.country_code ='[nl]' AND mc.movie_id = mk.movie_id AND t.id = mk.movie_id AND cn.id = mc.company_id AND mc.movie_id = t.id AND k.keyword ='character-name-in-...
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 = mi.movie_id AND mk.movie_id = mi.movie_id AND t.id = mk.movie_id AND t.production_year > 2000 AND k.keyword LIKE '%sequel%' AND k.id = mk.keyword_id AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Denmar...
job
SELECT n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, supplier, nation, region WHERE l_suppkey = s_suppkey AND c_nationkey = s_nationkey AND r_name = 1 AND c_custkey = o_custkey AND o_orderdate >= DATE 1 AND s_nationkey = n_nationkey AND o_orderdate < DATE 1 + INTERVAL '1' Y...
tpch
select min(k.keyword) as movie_keyword, min(n.name) as actor_name, min(t.title) as marvel_movie from cast_info as ci, keyword as k, movie_keyword as mk, name as n, title as t where k.keyword = 'marvel-cinematic-universe' and k.id = mk.keyword_id and n.name like '%Downey%Robert%' and t.production_year > 2010 and ci.movi...
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.name LIKE '%a%' AND an.person_id = ci.person_id AND t.production_year BETWEEN 1980 AND 1995 AND n.name_pcode_cf BET...
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 mi_idx.info < '3.5' AND t.id = mi_idx.movie_id AND at.movie_id = mi.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 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 it1.info = 'rating' AND at.movie_id = mc.movie_id AND cn.id = mc.compa...
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 p_type LIKE 1 AND ps_supplycost = ( SELECT MIN(ps_supplycost) FROM partsupp, supplier, nation, region WHERE p_par...
tpch
WITH _q AS ( SELECT SUM(l_extendedprice * l_discount) AS revenue FROM lineitem WHERE l_shipdate >= DATE 1 AND l_quantity < 1 ) SELECT * FROM _q AND l_discount BETWEEN 1 - 0.01 AND 1 + 0.01 AND l_shipdate < DATE 1 + INTERVAL '1' YEAR LIMIT 100;
tpch
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 t.id = mc.movie_id AND t.id = mi_idx.movie_...
job
SELECT l_returnflag, SUM(l_quantity) AS sum_qty, AVG(l_discount) AS avg_disc, 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, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, l_linestatus, COUNT(*) AS count_order, ...
tpch
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.info = 'top 250 rank' AND ct.id = mc.company_type_id AND it.id = mi_idx.info_type_id AND mc.note NOT LI...
job
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.production_year BETWEEN 2000 AND 2010 AND t.id = mi_idx.movie_id AND mi_idx.info > '7.0' AND it.info ='rating' AND it.id = mi_idx.info_type_id LIMIT 200;
job
SELECT AVG(cs_coupon_amt) AS agg3, AVG(cs_sales_price) AS agg4, i_item_id, AVG(cs_list_price) AS agg2, 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 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 cn.country_code = '[jp]' AND ci.note = '(voice: English version)' AND t.id = mc.movie_id AND ci.role_id = rt.id...
job
With _q As ( Select dt.d_year, Sum(ss_ext_sales_price) As sum_agg, item.i_brand_id As brand_id, item.i_brand As brand From date_dim As dt Join store_sales On dt.d_date_sk = store_sales.ss_sold_date_sk Join item On store_sales.ss_item_sk = item.i_item_sk Where item.i_manufact_id = 703 And dt.d_moy = 11 Group By dt.d_yea...
tpcds
SELECT MIN(n.name) AS voicing_actress, MIN(t.title) AS voiced_movie FROM aka_name AS an, char_name AS chn, cast_info AS ci, company_name AS cn, info_type AS it, movie_companies AS mc, movie_info AS mi, name AS n, role_type AS rt, title AS t WHERE t.id = ci.movie_id AND chn.id = ci.person_role_id AND it.id = mi.info_typ...
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 mk.movie_id = mc.movie_id AND mi.in...
job
select bought_city, ss_ticket_number, ca_city, extended_tax, extended_price, list_price, c_last_name, 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 SUM(l_extendedprice) AS sum_base_price, COUNT(*) AS count_order, AVG(l_discount) AS avg_disc, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, l_linestatus, AVG(l_extendedprice) AS avg_price, AVG(l_quantity) AS avg_qty, SUM(l_quantity...
tpch
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 p_partkey = ps_partkey AND p_type Not Like 1 AND ps_suppkey Not In ( Select s_suppkey From supplier Where s_comment Like '%Customer%Complaints%' ) AND p_brand <> 1 Group By p_brand...
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 lt.id = ml.link_type_id AND ci.person_id = n.id AND it.id = pi.info_type_id AND it.info = 'mini biography' AND lt.link...
job
SELECT MIN(mi.info) AS release_date, MIN(miidx.info) AS rating, MIN(t.title) AS german_movie FROM company_name AS cn, company_type AS ct, info_type AS it, info_type AS it2, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS miidx, title AS t WHERE miidx.movie_id = mc.movie_id AND it2.id = mi.in...
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 l_orde...
tpch
SELECT SUM(cs_quantity) AS catalog_sales_quantity, s_store_name, SUM(ss_quantity) AS store_sales_quantity, i_item_desc, s_store_id, SUM(sr_return_quantity) AS store_returns_quantity, 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 nation, SUM(amount) AS sum_profit, o_year FROM ( SELECT n_name AS nation, EXTRACT(YEAR FROM o_orderdate) AS o_year, l_extendedprice * (1 - l_discount) - ps_supplycost * l_quantity AS amount FROM part, supplier, lineitem, partsupp, orders, nation WHERE ps_partkey = l_partkey AND p_partkey = l_partkey AND s_nation...
tpch
SELECT STDDEV_SAMP(cs_quantity) / AVG(cs_quantity) AS catalog_sales_quantitycov, AVG(cs_quantity) AS catalog_sales_quantityave, STDDEV_SAMP(sr_return_quantity) / AVG(sr_return_quantity) AS store_returns_quantitycov, COUNT(sr_return_quantity) AS store_returns_quantitycount, AVG(sr_return_quantity) AS store_returns_quant...
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 mc.movie_id = t.id AND mk.keyword_id = k.id AND k.keyword ='character-name-in-title' AND cn.country_code ='[sm]' AND t.id = mk.movie_id AND mc.movie_id = mk.mo...
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 an.person_id = n.id AND rt.role = 'actress' AND mi.movie_id = ci.movie_id...
job
SELECT COUNT(*) FROM comments AS c, posts AS p, users AS u WHERE p.CommentCount >= 0 AND c.CreationDate >= '2010-08-05 00:36:02'::timestamp AND p.ViewCount >= 0 AND c.UserId = u.Id AND u.Id = p.OwnerUserId AND p.FavoriteCount >= 0 LIMIT 10;
stats
SELECT SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, l_returnflag, l_linestatus, COUNT(*) AS count_order, AVG(l_quantity) AS avg_qty, AVG(l_discount) AS avg_disc, SUM(l_quantity) AS sum_qty, SUM(l_extendedprice) AS sum_base_price, AVG(l_extendedprice) AS avg_price, SUM(l_extendedprice * (1 - l_discount) * ...
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 t.id = at.movie_id AND cn.id = mc.company_id AND t.production_year > 2...
job
SELECT i_item_id, i_item_desc, s_store_id, s_store_name, MAX(ss_net_profit) AS store_sales_profit, MAX(sr_net_loss) AS store_returns_loss, MAX(cs_net_profit) AS catalog_sales_profit FROM store_sales JOIN store_returns ON store_sales.ss_customer_sk = store_returns.sr_customer_sk AND store_sales.ss_item_sk = store_return...
tpcds
SELECT 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 ct.id = mc.company_type_id AND t.id = mi.movie_id AND ct.kind = 'production companies' AND it.info = 'bottom 10 rank' AND it.id = mi.info_type_id AND t.id = mc.movie_id AND mc.note N...
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 it.info = 'top 250 rank' AND t.id = mc.movie_id AND mc.movie_id = mi_idx.movie_id AND ct.id = mc.company_t...
job
SELECT AVG(ss_ext_sales_price), AVG(ss_quantity), AVG(ss_ext_wholesale_cost), SUM(ss_ext_wholesale_cost) FROM store_sales INNER JOIN store ON s_store_sk = ss_store_sk INNER JOIN customer_demographics ON cd_demo_sk = ss_cdemo_sk INNER JOIN household_demographics ON hd_demo_sk = ss_hdemo_sk INNER JOIN customer_address ON...
tpcds
SELECT o_year, SUM( CASE WHEN nation = 1 THEN volume ELSE 0 END ) / SUM(volume) AS mkt_share FROM ( SELECT EXTRACT(YEAR FROM o_orderdate) AS o_year, l_extendedprice * (1 - l_discount) AS volume, n2.n_name AS nation FROM part, supplier, lineitem, orders, customer, nation n1, nation n2, region WHERE l_orderkey = o_orderk...
tpch
SELECT p_brand, p_type, p_size, COUNT(DISTINCT ps_suppkey) AS supplier_cnt FROM partsupp, part WHERE ps_suppkey NOT IN ( SELECT s_suppkey FROM supplier WHERE s_comment LIKE '%Customer%Complaints%' ) AND p_brand <> 1 AND p_type NOT LIKE 1 AND p_partkey = ps_partkey AND p_size = ANY(ARRAY[1, 1, 1, 1, 1, 1, 1, 1]) GROUP B...
tpch
Select o_year, Sum(amount) As sum_profit, nation From ( Select n_name As nation, EXTRACT(YEAR From o_orderdate) As o_year, l_extendedprice * (1 - l_discount) - ps_supplycost * l_quantity As amount From part, supplier, lineitem, partsupp, orders, nation Where p_name Like 1 ) As profit AND ps_partkey = l_partkey AND s_na...
tpch
select count(*) from comments as c, votes as v, badges as b, users as u where u.CreationDate >= '2010-07-20 01:27:29'::timestamp AND c.Score = 1 AND u.Id = b.UserId AND u.Id = c.UserId AND u.Id = v.UserId LIMIT 100;
stats
SELECT s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE l1.l_receiptdate > l1.l_commitdate AND 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 s_nationkey = n...
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 mc.note NOT LIKE '%(as Metro-Goldwy...
job
SELECT 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 WHERE i_manager_id = 13 AND d_year = 2001 AND d_moy = 12 GROUP BY i_brand, i_brand_id ORDER BY ext_price ASC, brand_id LIMIT 100;
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 t.production_year > 2005 AND t.id = mi.movie_id AND mk.movie_id = mi.movie_id AND mi.info in ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Denish', 'Norwegian', 'German') AND k.i...
job
SELECT COUNT(1) FROM comments AS c, postHistory AS ph, votes AS v, users AS u WHERE u.Id = v.UserId AND v.UserId = ph.UserId AND u.Views >= 0 AND u.DownVotes >= 0 AND u.UpVotes <= 123 AND ph.UserId = c.UserId
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.title Like '%Champion%' And it1.info = 'rating' And it1.id = mi_idx...
job
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 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 k.keyword ='character-name-In-title' And mc.movie_id = mk.movie_id And cn.country_code ='[de]' And cn.id = mc.company_id And mc.movie_id ...
job
WITH year_total AS ( SELECT d_year AS dyear, c_login AS customer_login, c_birth_country AS customer_birth_country, c_email_address AS customer_email_address, 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_preferred_cust_fl...
tpcds
SELECT l_returnflag, AVG(l_quantity) AS avg_qty, AVG(l_extendedprice) AS avg_price, AVG(l_discount) AS avg_disc, SUM(l_extendedprice) AS sum_base_price, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, COUNT(*) AS count_order, l_linestatus, ...
tpch
SELECT c_preferred_cust_flag, ss_ticket_number, cnt, c_first_name, 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 ...
tpcds
SELECT SUM(l_quantity), c_custkey, c_name, o_orderkey, o_totalprice, o_orderdate FROM customer, orders, lineitem WHERE o_orderkey IN ( SELECT l_orderkey FROM lineitem GROUP BY l_orderkey HAVING SUM(l_quantity) > 1 ) AND c_custkey = o_custkey AND o_orderkey = l_orderkey GROUP BY c_name, c_custkey, o_orderkey, o_orderdat...
tpch
SELECT MIN(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 NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND t.id = mi_idx.movie_id AND ct.kind = 'productio...
job
SELECT cc_manager AS manager, cc_call_center_id AS call_center, cc_name AS call_center_name, SUM(cr_net_loss) AS returns_loss FROM call_center INNER JOIN catalog_returns ON cr_call_center_sk = cc_call_center_sk INNER JOIN date_dim ON cr_returned_date_sk = d_date_sk INNER JOIN customer ON cr_returning_customer_sk = c_cu...
tpcds
SELECT MIN(an.name) AS cool_actor_pseudonym, MIN(t.title) AS series_named_after_char FROM aka_name AS an, cast_info AS ci, company_name AS cn, keyword AS k, movie_companies AS mc, movie_keyword AS mk, name AS n, title AS t WHERE an.person_id = n.id AND t.episode_nr >= 50 AND ci.movie_id = t.id AND t.id = mk.movie_id AN...
job
SELECT i_item_desc, SUM(ss_quantity) AS store_sales_quantity, SUM(cs_quantity) AS catalog_sales_quantity, SUM(sr_return_quantity) AS store_returns_quantity, s_store_name, s_store_id, 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 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 o_orderkey = l...
tpch
SELECT o_year, SUM( CASE WHEN nation = 1 THEN volume ELSE 0 END ) / SUM(volume) AS mkt_share FROM ( SELECT EXTRACT(YEAR FROM o_orderdate) AS o_year, l_extendedprice * (1 - l_discount) AS volume, n2.n_name AS nation FROM part, supplier, lineitem, orders, customer, nation n1, nation n2, region WHERE o_custkey = c_custkey...
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 ca_city, c_first_name, bought_city, extended_tax, ss_ticket_number, list_price, extended_price, 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
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 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 = 266 GROUP BY dt.d_yea...
tpcds
SELECT MIN(mi_idx.info) AS rating, MIN(t.title) AS northamerican_movie FROM aka_title AS at, company_name AS cn, info_type AS it1, info_type AS it2, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS mi_idx, title AS t WHERE t.id = mi_idx.movie_id AND mi_idx.info < '3.5' AND at.movie_id = mc.mo...
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 ci.role_id = rt.id AND it.id = mi.info_type_id AND n.id = ci.person_id AN...
job