text
stringlengths
84
1.49k
benchmark
stringclasses
4 values
SELECT s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE l1.l_receiptdate > l1.l_commitdate 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_sup...
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.id = mi_idx.info_type_id AND it.info = 'top 250 rank' AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pi...
job
SELECT promotions, total, CAST(promotions AS DECIMAL(15, 4)) / CAST(total AS DECIMAL(15, 4)) * 100 FROM ( SELECT SUM(ss_ext_sales_price) AS promotions FROM store_sales 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 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 t.id = mk.movie_id AND cn.id = mc.company_id AND mk.keyword_id = k.id AND mc.movie_id = t.id AND cn.country_code ='[nl]' AND mc.movie_id = mk.movie_id AND k.keyword ='character-name-in-...
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 mk.keyword_id = k.id And mc.movie_id = t.id And k.keyword ='character-name-In-title' And cn.country_code ='[sm]' And t.id = mk.movie_id And cn.id = mc.company_id And mc.movie_id = mk.mo...
job
Select i_item_id, i_item_desc, s_store_id, s_store_name, Max(ss_net_profit) As store_sales_profit, Max(sr_net_loss) As store_returns_loss, Max(cs_net_profit) As catalog_sales_profit From store_sales Inner Join store_returns On store_sales.ss_customer_sk = store_returns.sr_customer_sk And store_sales.ss_item_sk = store_...
tpcds
SELECT 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 t.id = mc.movie_id AND ct.id = mc.company_type_id AND (mc.note LIKE '...
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 ps_partk...
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 + INTERVAL '1' YEAR A...
tpch
SELECT COUNT(*) FROM comments AS c, posts AS p, users AS u WHERE p.ViewCount >= 0 AND p.FavoriteCount >= 0 AND c.CreationDate >= '2010-08-05 00:36:02'::timestamp AND c.UserId = u.Id AND u.Id = p.OwnerUserId AND p.CommentCount >= 0 LIMIT 200;
stats
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 k.ke...
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 p_brand <> 1 AND p_partkey = ps_partkey AND ps_suppkey not in ( select s_suppkey from supplier where s_comment like '%Customer%Complaints%' ) AND p_type not like 1 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 n.name LIKE '%Downey%Robert%' AND k.id = mk.keyword_id AND ci.movie_id = mk.movie_id A...
job
Select i_manufact_id, i_brand_id As brand_id, i_manufact, 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 ps_partkey, SUM(ps_supplycost * ps_availqty) AS VALUE FROM partsupp, supplier, nation WHERE ps_suppkey = s_suppkey AND n_name = 1 AND s_nationkey = n_nationkey GROUP BY ps_partkey HAVING SUM(ps_supplycost * ps_availqty) > ( SELECT SUM(ps_supplycost * ps_availqty) * 1 FROM partsupp, supplier, nation WHERE ps_supp...
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 c_nati...
tpch
SELECT AVG(sr_return_quantity) AS store_returns_quantityave, STDDEV_SAMP(cs_quantity) / AVG(cs_quantity) AS catalog_sales_quantitycov, COUNT(ss_quantity) AS store_sales_quantitycount, STDDEV_SAMP(ss_quantity) AS store_sales_quantitystdev, STDDEV_SAMP(ss_quantity) / AVG(ss_quantity) AS store_sales_quantitycov, COUNT(cs_...
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 t.id = mi_idx.movie_id AND ct.kind = 'production companies' AND it.id = mi_idx.info_type_id AND it.info = ...
job
WITH year_total AS ( SELECT c_first_name AS customer_first_name, c_birth_country AS customer_birth_country, c_customer_id AS customer_id, c_last_name AS customer_last_name, 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 yea...
tpcds
SELECT MIN(t.title) AS biography_movie, MIN(n.name) AS of_person 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 pi.person_id = an.person_i...
job
SELECT p_type, p_size, COUNT(DISTINCT ps_suppkey) AS supplier_cnt, p_brand FROM partsupp, part WHERE p_type NOT LIKE 1 AND p_partkey = ps_partkey AND p_size IN (1, 1, 1, 1, 1, 1, 1, 1) AND p_brand <> 1 AND ps_suppkey NOT IN ( SELECT s_suppkey FROM supplier WHERE s_comment LIKE '%Customer%Complaints%' ) GROUP BY p_brand...
tpch
SELECT n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, supplier, nation, region WHERE r_name = 1 AND l_suppkey = s_suppkey AND c_custkey = o_custkey AND c_nationkey = s_nationkey AND n_regionkey = r_regionkey AND o_orderdate >= DATE 1 AND s_nationkey = n_nationkey AND l_order...
tpch
SELECT MAX(t.title) AS movie_title FROM keyword AS k, movie_info AS mi, movie_keyword AS mk, title AS t WHERE t.id = mi.movie_id AND k.id = mk.keyword_id AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Denish', 'Norwegian', 'German') AND t.production_year > 2005 AND k.keyword LIKE '%sequel%' AND t...
job
SELECT COUNT(*) FROM postHistory AS ph, posts AS p, votes AS v, badges AS b, users AS u, comments AS c WHERE p.Id = c.PostId AND p.ViewCount >= 0 AND p.Id = ph.PostId AND u.Id = b.UserId AND u.Id = p.OwnerUserId AND p.Id = v.PostId AND p.Score <= 192
stats
SELECT COUNT(*) FROM postHistory AS ph, posts AS p, votes AS v, badges AS b, users AS u, comments AS c WHERE u.Id = b.UserId AND p.Id = v.PostId AND p.Id = c.PostId AND p.ViewCount >= 0 AND u.Id = p.OwnerUserId AND p.Score <= 192 AND p.Id = ph.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_shipdate < l_commitdate AND o_orderkey = l...
tpch
SELECT extended_price, c_last_name, bought_city, list_price, c_first_name, ca_city, ss_ticket_number, extended_tax 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 INN...
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.id = mk.keyword_id AND k.keyword = 'marvel-cinematic-universe' AND t.id = mk.movie_id AND n.id = ci.person_id AND ci.movie_id = mk.movie_...
job
select sum(l_extendedprice) / 7.0 as avg_yearly from lineitem, part where p_container = 1 AND p_partkey = l_partkey AND p_brand = 1 AND l_quantity < ( select 0.2 * avg(l_quantity) from lineitem where l_partkey = p_partkey )
tpch
SELECT MIN(t.title) AS northamerican_movie, MIN(mi_idx.info) AS rating 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 kt.kind = 'movie' AND at.movie_id = mc.movie_id AND mi.movie_id = mc.m...
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 t.id = mk.movie_id AND mc.movie_id = mk.movie_id AND cn.country_code ='[de]' AND k.keyword ='character-name-IN-title' AND mk.keyword_id = k.id AND cn.id = mc.company_id AND mc.movie_id ...
job
Select Min(chn.name) As uncredited_voiced_character, Min(t.title) As russian_movie From char_name As chn, cast_info As ci, company_name As cn, company_type As ct, movie_companies As mc, role_type As rt, title As t Where cn.id = mc.company_id AND rt.role = 'actor' AND cn.country_code = '[ru]' AND ci.note Like '%(voice)%...
job
SELECT l_linestatus, 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, COUNT(*) AS count_order, AVG(l_extendedprice) AS avg_price, l_returnflag, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, AVG(l_discount) AS avg_disc, ...
tpch
SELECT i_item_id, i_item_desc, s_store_id, s_store_name, MIN(ss_net_profit) AS store_sales_profit, MIN(sr_net_loss) AS store_returns_loss, MIN(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(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 ct.kind = 'production companies' AND (mc.note ...
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_returnflag = 'R' AND c_nationkey = n_nationkey AND o_orderdate >= DATE 1 AND o_orderdate < DATE 1 + INTERVAL '3' MONTH AND l_orderkey = o_orderke...
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 mi.movie_id = mc.movie_id AND ci.movie_id = mc.movie_id AND rt.role = 'ac...
job
SELECT MAX(sr_net_loss) AS store_returns_loss, MAX(ss_net_profit) AS store_sales_profit, s_store_id, i_item_id, s_store_name, MAX(cs_net_profit) AS catalog_sales_profit, i_item_desc 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 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 s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE EXISTS ( SELECT * FROM lineitem l2 WHERE l2.l_orderkey = l1.l_orderkey AND l2.l_suppkey <> l1.l_suppkey ) AND s_nationkey = n_nationkey AND o_orderstatus = 'F' AND l1.l_receiptdate > l1.l_commitdate AND s_suppkey = l1.l_suppkey AND n_na...
tpch
SELECT MIN(an1.name) AS actress_pseudonym, MIN(t.title) AS japanese_movie_dubbed FROM aka_name AS an1, cast_info AS ci, company_name AS cn, movie_companies AS mc, name AS n1, role_type AS rt, title AS t WHERE cn.country_code = '[jp]' AND rt.role = 'actress' AND an1.person_id = n1.id AND ci.movie_id = t.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 t.id = mc.movie_id AND ct.kind = 'production companies' AND ct.id = mc.company_type_id AND mc.movie_id = m...
job
WITH _q AS ( Select o_year, Sum( Case When nation = 1 Then volume Else 0 End ) / Sum(volume) As mkt_share From ( Select EXTRACT(YEAR From o_orderdate) As o_year, l_extendedprice * (1 - l_discount) As volume, n2.n_name As nation From part, supplier, lineitem, orders, customer, nation n1, nation n2, region Where s_nation...
tpch
SELECT COUNT(*) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v WHERE c.Score = 0 AND p.Id = ph.PostId AND p.Id = pl.PostId AND p.Id = v.PostId AND pl.LinkTypeId = 1 AND p.Id = c.PostId AND p.FavoriteCount >= 0
stats
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_size = ANY(ARRAY[1, 1, 1, 1, 1, 1, 1, 1]) AND p_type NOT LIKE 1 AND p_partkey = ps_partkey AND p_brand <> 1 GROUP B...
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 p_partkey = l_partkey...
tpch
SELECT s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE n_name = 1 AND EXISTS ( SELECT * FROM lineitem l2 WHERE l2.l_orderkey = l1.l_orderkey AND l2.l_suppkey <> l1.l_suppkey ) AND o_orderstatus = 'F' AND s_suppkey = l1.l_suppkey AND s_nationkey = n_nationkey AND l1.l_receiptdate > l1.l_comm...
tpch
SELECT MIN(t.title) AS western_sequel, MIN(cn.name) AS from_company, MIN(lt.link) AS link_type FROM company_name AS cn, company_type AS ct, info_type AS it, keyword AS k, link_type AS lt, movie_companies AS mc, movie_info AS mi, movie_keyword AS mk, movie_link AS ml, title AS t WHERE mc.note NOT LIKE '%(as Metro-Goldwy...
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 pl.LinkTypeId = 1 AND p.Id = v.PostId AND b.UserId = c.UserId AND p.Id = c.PostId AND c.Score = 0
stats
SELECT s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE s_suppkey = l1.l_suppkey AND o_orderkey = l1.l_orderkey 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 NOT EXISTS ( SELECT * FROM lineitem l3 WHE...
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 t.id = mc.movie_id AND t.id = mi_idx.movie_id AND ct.id = mc.company_type_id AND it.info = 'top 250 rank' ...
job
WITH _q AS ( Select Count(*) From posts As p, tags As t Where p.CommentCount >= 0 ) SELECT * FROM _q AND p.Id = t.ExcerptPostId
stats
SELECT i_brand AS brand, 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 WHERE i_manager_id = 1 AND d_moy = 11 AND d_year = 2001 GROUP BY i_brand, i_brand_id ORDER BY ext_price DESC, brand_id LIMIT 100;
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 n.name LIKE '%Hemsworth%Chris%' AND t.production_year > 2010 AND t.id = mk.movie_id AND ci.movi...
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.id = mk.keyword_id and n.id = ci.person_id and n.name like '%Hemsworth%Chris%' and k.keyword = 'marvel-cinematic-universe' and t.id = ci....
job
SELECT MIN(t.title) AS movie_title FROM keyword AS k, movie_info AS mi, movie_keyword AS mk, title AS t WHERE k.keyword LIKE '%sequel%' AND mi.info = ANY(ARRAY['Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Denish', 'Norwegian', 'German']) AND t.id = mi.movie_id AND t.id = mk.movie_id AND t.production_year > 200...
job
SELECT o_orderkey, c_custkey, SUM(l_quantity), o_totalprice, c_name, 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(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.id = ci.person_id and t.id = ci.movie_id and ci.movie_id = mk.movie_...
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.production_year > 1990 AND mc.note NOT LIKE '%(USA)%' AND c...
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 k.keyword = 'marvel-cinematic-universe' AND n.id = ci.person_id AND ci.movie_id = mk.movie_id AND t.id = ...
job
Select Min(t.title) As movie_title From keyword As k, movie_info As mi, movie_keyword As mk, title As t Where k.keyword Like '%sequel%' And t.production_year > 2010 And mk.movie_id = mi.movie_id And k.id = mk.keyword_id And t.id = mk.movie_id And mi.info In ('Sweden', 'Norway', 'Germany', 'Danish', 'Swedish', 'Danish',...
job
SELECT i_item_desc, STDDEV_SAMP(ss_quantity) / AVG(ss_quantity) AS store_sales_quantitycov, COUNT(ss_quantity) AS store_sales_quantitycount, STDDEV_SAMP(cs_quantity) / AVG(cs_quantity) AS catalog_sales_quantitycov, STDDEV_SAMP(sr_return_quantity) / AVG(sr_return_quantity) AS store_returns_quantitycov, STDDEV_SAMP(sr_re...
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 mi.movie_id = ci.movie_id AND t.id = ci.movie_id AND mi.movie_id = mc.mov...
job
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 k.id = mk.keyword_id AND ci.movie_id = mk.movie_id AND n.id = ci.person_id AND n.name LIKE '%Downey%Robert%' AND t.id = ci.movie_id AND t.i...
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 t.id = mc.movie_id AND it.info = 'top 250 rank' AND ct.id = mc.company_type_id AND (mc.note LIKE '%(co-pro...
job
SELECT c_first_name, extended_price, ca_city, bought_city, extended_tax, ss_ticket_number, c_last_name, 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 p_brand, p_type, p_size, Count(Distinct ps_suppkey) As supplier_cnt From partsupp, part Where 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 AND p_size In (1, 1, 1, 1, 1, 1, 1, 1) Group By p_brand...
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 store_sales On ss_item_sk = i_item_sk Where d_date Between CAST('2002-01-23' As DATE) And (CAST('2002-01-23' As DATE) + INTERVAL '60 days') And i_manufact_id...
tpcds
select ca_city, bought_city, c_last_name, ss_ticket_number, extended_price, list_price, c_first_name, extended_tax 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 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 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 AVG(l_extendedprice) AS avg_price, COUNT(*) AS count_order, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, SUM(l_quantity) AS sum_qty, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, l_returnflag, AVG(l_quantity) AS avg_qty, SUM(l_extendedprice) AS sum_base_price, AVG(l_discount)...
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 cn.id = mc.company_id AND t.id = mk.movie_id AND cn.country_code ='[sm]' AND mc.movie_id = t.id AND mk.keyword_id = k.id AND mc.movie_id = mk.mo...
job
with ss as ( select i_manufact_id, sum(ss_ext_sales_price) as total_sales from store_sales join date_dim on ss_sold_date_sk = d_date_sk join customer_address on ss_addr_sk = ca_address_sk join item on ss_item_sk = i_item_sk where d_moy = 2 AND i_category in ('Electronics') AND ca_gmt_offset = -5 AND d_year = 2000 group...
tpcds
SELECT COUNT(*) FROM postHistory AS ph, posts AS p, votes AS v, badges AS b, users AS u, comments AS c WHERE u.Id = b.UserId AND p.Id = ph.PostId AND p.ViewCount >= 0 AND p.Id = c.PostId AND p.Id = v.PostId AND p.Score <= 192 AND u.Id = p.OwnerUserId
stats
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_type NOT LIKE 1 AND ps_suppkey NOT IN ( SELECT s_suppkey FROM supplier WHERE s_comment LIKE '%Customer%Complaints%' ) AND p_partkey = ps_partkey AND p_brand <> 1 GROUP BY p_brand...
tpch
SELECT o_orderkey, o_orderdate, SUM(l_quantity), c_custkey, o_totalprice, c_name FROM customer, orders, lineitem WHERE o_orderkey IN ( SELECT l_orderkey FROM lineitem GROUP BY l_orderkey HAVING SUM(l_quantity) > 1 ) AND c_custkey = o_custkey AND o_orderkey = l_orderkey GROUP BY c_name, c_custkey, o_orderkey, o_orderdat...
tpch
SELECT 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.gender = 'f' AND ci.role_id = rt.id AND mi.movie_id = mc.movie_id AND c...
job
SELECT c_custkey, c_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue, c_phone, c_address, c_comment, n_name, 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 keyword AS k, movie_info AS mi, movie_keyword AS mk, title AS t WHERE t.production_year > 2005 AND t.id = mk.movie_id AND k.id = mk.keyword_id AND mk.movie_id = mi.movie_id AND t.id = mi.movie_id AND k.keyword LIKE '%sequel%' AND mi.info = ANY(ARRAY['Sweden', 'Norway', 'Germany',...
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 s_nationkey = n_nationkey AND p_type LIKE 1 AND n_regionkey = r_regionkey AND p_size = 1 AND s_suppkey = ps_suppkey AND p_partkey = ps_partkey AND r_name = 1 AND ps_supplycost = ( SELEC...
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_size IN (1, 1, 1, 1, 1, 1, 1, 1) AND p_partkey = ps_partkey AND p_brand <> 1 AND p_type NOT LIKE 1 GROUP BY p_brand...
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 n.name LIKE '%Downey%Robert%' AND n.id = ci.person_id AND ci.movie_id = mk.movie_id AND k.keyword = 'marvel-ci...
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 = t.id AND mk.keyword_id = k.id AND t.id = mk.movie_id AND cn.country_code ='[nl]' AND k.keyword ='character-name-in-title' AND cn.id = mc.company_id AND mc.movie_id = mk.mo...
job
Select Sum(cr_net_loss) As returns_loss, cc_call_center_id As call_center, cc_manager As manager, cc_name As call_center_name 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 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 o_orderkey = l_orderkey AND p_n...
tpch
SELECT s_phone, s_comment, s_acctbal, s_address, p_partkey, s_name, p_mfgr, 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 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 = c.PostId and p.Id = ph.PostId and b.UserId = u.Id and c.UserId = u.Id and p.Id = v.PostId and p.Id = pl.RelatedPostId and p.Score <= 40 and pl.LinkTypeId = 1
stats
SELECT MIN(k.keyword) AS movie_keyword, MIN(n.name) AS actor_name, MIN(t.title) AS marvel_movie FROM cast_info AS ci, keyword AS k, movie_keyword AS mk, name AS n, title AS t WHERE ci.movie_id = mk.movie_id AND n.id = ci.person_id AND t.id = ci.movie_id AND t.production_year > 2010 AND n.name LIKE '%Downey%Robert%' AND...
job
SELECT COUNT(1) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v, badges AS b WHERE b.UserId = c.UserId AND p.Id = v.PostId AND p.Id = pl.RelatedPostId AND p.Id = ph.PostId AND pl.LinkTypeId = 1 AND p.Id = c.PostId AND c.Score = 0
stats
SELECT ss_ticket_number, list_price, extended_tax, c_first_name, extended_price, ca_city, c_last_name, bought_city 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 promotions, total, CAST(promotions AS DECIMAL(15, 4)) / CAST(total AS DECIMAL(15, 4)) * 100 FROM ( SELECT SUM(ss_ext_sales_price) AS promotions FROM store_sales JOIN store ON ss_store_sk = s_store_sk JOIN promotion ON ss_promo_sk = p_promo_sk JOIN date_dim ON ss_sold_date_sk = d_date_sk JOIN customer ON ss_custo...
tpcds
SELECT MIN(cs_net_profit) AS catalog_sales_profit, i_item_desc, MIN(sr_net_loss) AS store_returns_loss, i_item_id, MIN(ss_net_profit) AS store_sales_profit, s_store_name, s_store_id FROM store_sales JOIN store_returns ON store_sales.ss_customer_sk = store_returns.sr_customer_sk AND store_sales.ss_item_sk = store_return...
tpcds
SELECT MIN(t.title) AS movie_title FROM keyword AS k, movie_info AS mi, movie_keyword AS mk, title AS t WHERE t.id = mi.movie_id AND t.id = mk.movie_id AND k.id = mk.keyword_id AND t.production_year > 2005 AND mk.movie_id = mi.movie_id AND k.keyword LIKE '%sequel%' AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Denmar...
job
WITH _q AS ( SELECT MIN(t.title) AS movie_title FROM company_name AS cn, keyword AS k, movie_companies AS mc, movie_keyword AS mk, title AS t WHERE mc.movie_id = mk.movie_id ) SELECT * FROM _q AND k.keyword ='character-name-in-title' AND t.id = mk.movie_id AND mk.keyword_id = k.id AND cn.id = mc.company_id AND mc.movie...
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_name LIKE 1 ) AS profit AND ps_partkey = l_partkey AND s_na...
tpch
select sum(case when (CAST(d_date as DATE) >= CAST('1998-01-01' as DATE)) then cs_sales_price - COALESCE(cr_refunded_cash, 0) else 0 end) as sales_after, w_state, i_item_id, sum(case when (CAST(d_date as DATE) < CAST('1998-01-01' as DATE)) then cs_sales_price - COALESCE(cr_refunded_cash, 0) else 0 end) as sales_before ...
tpcds
SELECT c_custkey, SUM(l_quantity), o_orderdate, c_name, o_orderkey, o_totalprice FROM customer, orders, lineitem WHERE o_orderkey IN ( SELECT l_orderkey FROM lineitem GROUP BY l_orderkey HAVING SUM(l_quantity) > 1 ) AND c_custkey = o_custkey AND o_orderkey = l_orderkey GROUP BY c_name, c_custkey, o_orderkey, o_orderdat...
tpch
Select cust_nation, l_year, supp_nation, 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 s_nation...
tpch
SELECT AVG(cs_coupon_amt) AS agg3, AVG(cs_quantity) AS agg1, i_item_id, AVG(cs_list_price) AS agg2, AVG(cs_sales_price) AS agg4 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