text
stringlengths
84
1.49k
benchmark
stringclasses
4 values
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 k.id = mk.keyword_id AND t.id = mk.movie_id AND t.id = mi.movie_id AND t.production_year > 2005 AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Denish', 'Norw...
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 k.keyword = 'marvel-cinematic-universe' AND k.id = mk.keyword_id AND n.id = ci.person_id AND ...
job
WITH year_total AS ( SELECT d_year AS dyear, 's' AS sale_type, c_login AS customer_login, c_first_name AS customer_first_name, c_birth_country AS customer_birth_country, SUM(((ss_ext_list_price - ss_ext_wholesale_cost - ss_ext_discount_amt) + ss_ext_sales_price) / 2) AS year_total, c_customer_id AS customer_id, c_email...
tpcds
SELECT SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, AVG(l_extendedprice) AS avg_price, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, SUM(l_quantity) AS sum_qty, l_returnflag, l_linestatus, SUM(l_extendedprice) AS sum_base_price, COUNT(*) AS count_order, AVG(l_discount) AS avg_disc, ...
tpch
SELECT l_orderkey, o_shippriority, SUM(l_extendedprice * (1 - l_discount)) AS revenue, o_orderdate FROM customer, orders, lineitem WHERE l_orderkey = o_orderkey AND c_custkey = o_custkey AND c_mktsegment = 1 AND o_orderdate < DATE 1 AND l_shipdate > DATE 1 GROUP BY l_orderkey, o_orderdate, o_shippriority ORDER BY reven...
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.id = mk.movie_id AND k.keyword Like '%sequel%' AND mk.movie_id = mi.movie_id AND k.id = mk.keyword_id AND t.production_year > 2005 AND t.id = mi.movie_id AND mi.info In ('Sweden', 'Norway', 'Germany', 'Denmar...
job
select cc_manager as manager, cc_name as call_center_name, cc_call_center_id as call_center, sum(cr_net_loss) as returns_loss 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(k.keyword) AS movie_keyword, MIN(t.title) AS marvel_movie, MIN(n.name) AS actor_name FROM cast_info AS ci, keyword AS k, movie_keyword AS mk, name AS n, title AS t WHERE t.id = mk.movie_id AND ci.movie_id = mk.movie_id AND k.id = mk.keyword_id AND t.production_year > 2010 AND n.id = ci.person_id AND t.id = c...
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 l_returnflag = 'R' AND o_orderdate < DATE 1 + INTERVAL '3' MONTH AND c_custkey = o_custkey AND o_orderdate >= DATE 1 AN...
tpch
SELECT AVG(cs_sales_price) AS agg4, AVG(cs_quantity) AS agg1, AVG(cs_list_price) AS agg2, AVG(cs_coupon_amt) AS agg3, 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
WITH year_total AS ( SELECT SUM(((ss_ext_list_price - ss_ext_wholesale_cost - ss_ext_discount_amt) + ss_ext_sales_price) / 2) AS year_total, c_first_name AS customer_first_name, 's' AS sale_type, c_birth_country AS customer_birth_country, c_customer_id AS customer_id, d_year AS dyear, c_email_address AS customer_email_...
tpcds
Select Count(*) From comments As c, posts As p, users As u Where c.UserId = u.Id AND c.CreationDate >= '2010-08-05 00:36:02'::timestamp AND p.FavoriteCount >= 0 AND p.CommentCount >= 0 AND u.Id = p.OwnerUserId AND p.ViewCount >= 0
stats
Select Avg(cs_coupon_amt) As agg3, Avg(cs_sales_price) As agg4, Avg(cs_list_price) As agg2, i_item_id, Avg(cs_quantity) As agg1 From catalog_sales Inner Join customer_demographics On cs_bill_cdemo_sk = cd_demo_sk Inner Join date_dim On cs_sold_date_sk = d_date_sk Inner Join item On cs_item_sk = i_item_sk Inner Join pro...
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 kt.kind = 'movie' AND t.id = mc.movie_id AND kt.id = t.kind_id AND it1...
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 ct.id = mc.company_type_id AND cn.country_code = '[jp]' AND c...
job
SELECT COUNT(DISTINCT ps_suppkey) AS supplier_cnt, p_size, p_type, p_brand FROM partsupp, part WHERE ps_suppkey NOT IN ( SELECT s_suppkey FROM supplier WHERE s_comment LIKE '%Customer%Complaints%' ) AND p_type NOT LIKE 1 AND p_size IN (1, 1, 1, 1, 1, 1, 1, 1) AND p_partkey = ps_partkey AND p_brand <> 1 GROUP BY p_brand...
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 b.UserId = u.Id and p.Score <= 40 and p.Id = pl.RelatedPostId and c.UserId = u.Id and pl.LinkTypeId = 1 and p.Id = c.PostId and p.Id = ph.PostId
stats
SELECT 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, l_shipmode FROM orders, lineitem WHERE o_orderkey = l_orderkey AND l_shipmode IN (1...
tpch
SELECT c_name, c_custkey, SUM(l_quantity), o_orderkey, o_orderdate, 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 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 o_orderkey = l_orderkey AND l_shipmode In (1...
tpch
With year_total As ( Select c_login As customer_login, c_email_address As customer_email_address, c_last_name As customer_last_name, c_first_name As customer_first_name, 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, d_year ...
tpcds
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 ca_gmt_offset = -5 And d_year = 2000 And i_category In ('Electronics') And d_moy = 2 Group...
tpcds
SELECT l_year, SUM(volume) AS revenue, cust_nation, supp_nation FROM ( SELECT n1.n_name AS supp_nation, n2.n_name AS cust_nation, EXTRACT(YEAR FROM l_shipdate) AS l_year, l_extendedprice * (1 - l_discount) AS volume FROM supplier, lineitem, orders, customer, nation n1, nation n2 WHERE l_shipdate BETWEEN DATE '1995-01-0...
tpch
select count(1) from store_sales join household_demographics on ss_hdemo_sk = hd_demo_sk join time_dim on ss_sold_time_sk = t_time_sk join store on ss_store_sk = s_store_sk where hd_dep_count = 2 AND t_hour = 10 AND s_store_name = 'ation' AND t_minute >= 35 order by count(1) desc limit 100;
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 = mc.movie_id AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND it.id = mi_idx.info_type...
job
SELECT AVG(ss_ext_wholesale_cost), AVG(ss_quantity), AVG(ss_ext_sales_price), SUM(ss_ext_wholesale_cost) FROM store_sales JOIN store ON s_store_sk = ss_store_sk JOIN customer_demographics ON cd_demo_sk = ss_cdemo_sk JOIN household_demographics ON hd_demo_sk = ss_hdemo_sk JOIN customer_address ON ca_address_sk = ss_addr...
tpcds
SELECT SUM(l_quantity) AS sum_qty, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, AVG(l_extendedprice) AS avg_price, AVG(l_quantity) AS avg_qty, l_returnflag, COUNT(*) AS count_order, SUM(l_extendedprice) AS sum_base_price, AVG(l_discount) AS avg_disc, l_linestatus, SUM(l_extendedprice * (1 - l_discount) * ...
tpch
SELECT p_brand, p_type, p_size, COUNT(DISTINCT ps_suppkey) AS supplier_cnt FROM partsupp, part WHERE p_brand <> 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_size IN (1, 1, 1, 1, 1, 1, 1, 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 mc.note LIKE '%(USA)%' AND it.id = mi.info_type_id AND ci.note IN ('(voic...
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 t.id = mc.movie_id AND it.id = mi_idx.info_type_id AND (mc.note LIKE ...
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 mc.note LIKE '%(Japan)%' AND rt.role = 'actress' AND t.id = m...
job
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 mi_idx.info > '8.0' AND t.id = mi_idx.movie_id AND it.id = mi_idx.info_type_id AND t.production_year >= 2000 AND t.production_year <= 2005 AND it.info ='rating' LIMIT 100;
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 mc.movie_id = mk.movie_id AND mk.keyword_id = k.id AND t.id = mk.movie_id AND mc.movie_id = t.id AND cn.country_code ='[de]' AND k.keyword ='character-name-in-...
job
SELECT i_item_desc, AVG(sr_return_quantity) AS store_returns_quantityave, AVG(cs_quantity) AS catalog_sales_quantityave, AVG(ss_quantity) AS store_sales_quantityave, s_state, COUNT(cs_quantity) AS catalog_sales_quantitycount, STDDEV_SAMP(sr_return_quantity) / AVG(sr_return_quantity) AS store_returns_quantitycov, STDDEV...
tpcds
SELECT n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue, c_custkey, c_name, c_phone, c_acctbal, c_address, c_comment FROM customer, orders, lineitem, nation WHERE c_custkey = o_custkey AND l_orderkey = o_orderkey AND o_orderdate >= DATE 1 AND o_orderdate < DATE 1 + INTERVAL '3' MONTH AND l_returnflag = 'R' AN...
tpch
SELECT MIN(an.name) AS cool_actor_pseudonym, MIN(t.title) AS series_named_after_char FROM aka_name AS an, cast_info AS ci, company_name AS cn, keyword AS k, movie_companies AS mc, movie_keyword AS mk, name AS n, title AS t WHERE mc.company_id = cn.id AND ci.movie_id = mk.movie_id AND t.episode_nr >= 50 AND t.id = mk.mo...
job
SELECT l_shipmode, SUM( CASE WHEN o_orderpriority = '1-URGENT' OR o_orderpriority = '2-HIGH' THEN 1 ELSE 0 END ) AS high_line_count, SUM( CASE WHEN o_orderpriority != '1-URGENT' AND o_orderpriority != '2-HIGH' THEN 1 ELSE 0 END ) AS low_line_count FROM orders, lineitem WHERE l_receiptdate < DATE 1 + INTERVAL '1' YEAR A...
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.production_year > 2000 AND t.id = mi.movie_id AND t.id = mk.movie_id AND mk.movie_id = mi.movie_id AND k.keyword LIKE '%sequel%' AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Danish', ...
job
SELECT i_manufact, i_brand AS brand, i_manufact_id, SUM(ss_ext_sales_price) AS ext_price, i_brand_id AS brand_id FROM date_dim JOIN store_sales ON d_date_sk = ss_sold_date_sk JOIN item ON ss_item_sk = i_item_sk JOIN customer ON ss_customer_sk = c_customer_sk JOIN customer_address ON c_current_addr_sk = ca_address_sk JO...
tpcds
Select ps_partkey, Sum(ps_supplycost * ps_availqty) As VALUE From partsupp, supplier, nation Where s_nationkey = n_nationkey AND n_name = 1 AND ps_suppkey = s_suppkey Group By ps_partkey Having Sum(ps_supplycost * ps_availqty) > ( Select Sum(ps_supplycost * ps_availqty) * 1 From partsupp, supplier, nation Where ps_supp...
tpch
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_size = 1 AND r_name = 1 AND n_regionkey = r_regionkey AND ps_supplycost = ( SELECT MIN(ps_supplycost) FROM partsupp, supplier, nation, region WHERE p_par...
tpch
SELECT MIN(an.name) AS acress_pseudonym, MIN(t.title) AS japanese_anime_movie FROM aka_name AS an, cast_info AS ci, company_name AS cn, company_type AS ct, keyword AS k, movie_companies AS mc, movie_keyword AS mk, name AS n, role_type AS rt, title AS t WHERE ci.role_id = rt.id AND ci.movie_id = mc.movie_id AND mk.movie...
job
SELECT s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE s_suppkey = l1.l_suppkey AND s_nationkey = n_nationkey AND 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 n_name = 1 AND NOT EXISTS ( ...
tpch
SELECT COUNT(1) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v, badges AS b, users AS u WHERE p.Score <= 40 AND p.Id = c.PostId AND b.UserId = u.Id AND pl.LinkTypeId = 1 AND c.UserId = u.Id AND p.Id = pl.RelatedPostId AND p.Id = ph.PostId AND p.Id = v.PostId
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 mc.movie_id = mi_idx.movie_id and ct.kind = 'production companies' and ct.id = mc.company_type_id and it.i...
job
SELECT p_size, p_type, COUNT(DISTINCT ps_suppkey) AS supplier_cnt, p_brand FROM partsupp, part WHERE p_type NOT LIKE 1 AND 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_brand <> 1 AND p_partkey = ps_partkey GROUP BY p_brand...
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_idx.info < '3.5' AND mi.movie_id = mi_idx.movie_id AND cn.country_c...
job
select s_acctbal, s_name, s_phone, s_comment, s_address, p_mfgr, n_name, p_partkey 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 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 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 p_partkey = ps_partkey AND p_brand <> 1 AND NOT EXISTS (SELECT 1 FROM (SELECT s_suppkey FROM supplier WHERE s_comment LIKE '%Customer%Complaints%') AS _ne WHE...
tpch
SELECT s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE o_orderstatus = 'F' AND n_name = 1 AND s_suppkey = l1.l_suppkey AND s_nationkey = n_nationkey AND o_orderkey = l1.l_orderkey AND NOT EXISTS ( SELECT * FROM lineitem l3 WHERE l3.l_orderkey = l1.l_orderkey AND l3.l_suppkey <> l1.l_suppkey...
tpch
SELECT p_brand, p_type, p_size, COUNT(DISTINCT ps_suppkey) AS supplier_cnt FROM partsupp, part WHERE p_partkey = ps_partkey AND p_size IN (1, 1, 1, 1, 1, 1, 1, 1) AND p_type NOT LIKE 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 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 n_regionkey = r_regionkey And s_suppkey = ps_suppkey And ps_supplycost = ( Select Min(ps_supplycost) From partsupp, supplier, nation, region Where p_partke...
tpch
SELECT AVG(ss_ext_sales_price), AVG(ss_ext_wholesale_cost), AVG(ss_quantity), 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(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 = mi_idx.movie_id AND it.id = mi_idx.info_type_id AND ct.id = mc...
job
SELECT i_item_id, STDDEV_SAMP(ss_quantity) / AVG(ss_quantity) AS store_sales_quantitycov, AVG(cs_quantity) AS catalog_sales_quantityave, i_item_desc, STDDEV_SAMP(cs_quantity) / AVG(cs_quantity) AS catalog_sales_quantitycov, COUNT(cs_quantity) AS catalog_sales_quantitycount, STDDEV_SAMP(sr_return_quantity) AS store_retu...
tpcds
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 ml.linked_movie_id = t.id AND an.person_id = ci.person_id AND ci.movie_id = ml.linked_movie_id AND (n.gender = 'm' OR ...
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.id = mc.company_type_id AND t.id = mc.movie_id AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)...
job
select count(1) from comments as c, posts as p, postLinks as pl where p.CreationDate >= '2010-07-23 07:27:31'::timestamp AND p.CommentCount <= 18 AND p.CreationDate <= '2014-09-09 01:43:00'::timestamp AND p.Id = pl.PostId AND c.UserId = p.OwnerUserId
stats
SELECT MIN(n.name) AS of_person, MIN(t.title) AS biography_movie FROM aka_name AS an, cast_info AS ci, info_type AS it, link_type AS lt, movie_link AS ml, name AS n, person_info AS pi, title AS t WHERE (n.gender = 'm' OR (n.gender = 'f' AND n.name LIKE 'B%')) AND lt.id = ml.link_type_id AND ci.person_id = n.id AND t.id...
job
SELECT MIN(an.name) AS cool_actor_pseudonym, MIN(t.title) AS series_named_after_char FROM aka_name AS an, cast_info AS ci, company_name AS cn, keyword AS k, movie_companies AS mc, movie_keyword AS mk, name AS n, title AS t WHERE t.episode_nr < 100 AND an.person_id = ci.person_id AND ci.movie_id = mk.movie_id AND n.id =...
job
SELECT AVG(ss_sales_price) AS agg4, AVG(ss_quantity) AS agg1, AVG(ss_coupon_amt) AS agg3, AVG(ss_list_price) AS agg2, i_item_id 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(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.movie_id = mc.movie_id AND t.id = mc.movie_id AND t.id = mi_idx...
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 = pl.RelatedPostId AND p.Id = v.PostId AND c.Score = 0 AND b.UserId = c.UserId AND p.Id = ph.PostId AND p.Id = c.PostId AND pl.LinkTypeId = 1 LIMIT 100;
stats
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 k.keyword Like '%sequel%' And k.id = mk.keyword_id And mk.movie_id = mi.movie_id And t.production_year > 2000 And mi.info In ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Danish'...
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 cn.country_code ='[nl]' AND mk.keyword_id = k.id AND mc.movie_id = t.id AND mc.movie_id = mk.movie_id AND t.id = mk.movie_id AND k.keyword ='character-name-In-...
job
SELECT promotions, total, CAST(promotions AS DECIMAL(15, 4)) / CAST(total AS DECIMAL(15, 4)) * 100 FROM ( SELECT SUM(ss_ext_sales_price) AS promotions FROM store_sales JOIN store ON ss_store_sk = s_store_sk JOIN promotion ON ss_promo_sk = p_promo_sk JOIN date_dim ON ss_sold_date_sk = d_date_sk JOIN customer ON ss_custo...
tpcds
WITH _q AS ( 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_d...
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 kt.id = t.kind_id AND it...
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 ml.movie_id = mc.movie_id AND mi.mo...
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 k.keyword ='character-name-in-title' AND mk.keyword_id = k.id AND cn.id = mc.company_id AND t.id = mk.movie_id AND mc.movie_id = t.id AND cn.country_code ='[sm]' AND mc.movie_id = mk.mo...
job
SELECT COUNT(*) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v, badges AS b, users AS u WHERE p.Id = ph.PostId AND p.Id = v.PostId AND pl.LinkTypeId = 1 AND p.Id = c.PostId AND p.Id = pl.RelatedPostId AND b.UserId = u.Id AND p.Score <= 40 AND c.UserId = u.Id
stats
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', 'Danish', 'Swedish', 'Danish', 'Norwegian', 'German') AND t.id = mk.movie_id AND mk.movie_id = mi.movie_id AND t.produc...
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.production_year > 2000 AND k.keyword LIKE '%sequel%' AND t.id = mi.movie_id AND k.id = mk.keyword_id AND mk.movie_id = mi.movie_id AND t.id = mk.movie_id AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Denmar...
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 american_movie FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info AS mi, title AS t WHERE it.info = 'bottom 10 rank' AND t.id = mc.movie_id AND mc.movie_id = mi.movie_id AND ct.kind = 'production companies' AND (mc.note LIKE '%(co-production)%' OR mc.note LIKE '%(presents...
job
SELECT promotions, total, CAST(promotions AS DECIMAL(15, 4)) / CAST(total AS DECIMAL(15, 4)) * 100 FROM ( SELECT SUM(ss_ext_sales_price) AS promotions FROM store_sales JOIN store ON ss_store_sk = s_store_sk JOIN promotion ON ss_promo_sk = p_promo_sk JOIN date_dim ON ss_sold_date_sk = d_date_sk JOIN customer ON ss_custo...
tpcds
Select i_item_desc, i_item_id, i_current_price 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 75 And 75 + 30 And inv_quantity_on_hand Between 100 And 500 And d_date Between CAST('2000-05-01' As DATE)...
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 cn.id = mc.company_id And t.id = mk.movie_id And mc.movie_id = t.id And mc.movie_id = mk.movie_id And cn.country_code ='[de]' And k.keyword ='character-name-In-...
job
select s_suppkey, s_name, total_revenue, s_address, s_phone from supplier, revenue0 where s_suppkey = supplier_no and total_revenue = ( select max(total_revenue) from revenue0 ) order by s_suppkey
tpch
SELECT supp_nation, cust_nation, l_year, SUM(volume) AS revenue FROM ( SELECT n1.n_name AS supp_nation, n2.n_name AS cust_nation, EXTRACT(YEAR FROM l_shipdate) AS l_year, l_extendedprice * (1 - l_discount) AS volume FROM supplier, lineitem, orders, customer, nation n1, nation n2 WHERE ( (n1.n_name = 1 AND n2.n_name = 1...
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 s_nationkey = n1.n_nationkey AND (...
tpch
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 p_mfgr, p_partkey, n_name, s_address, s_name, s_acctbal, s_phone, s_comment 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 s_name, COUNT(1) AS numwait FROM supplier, lineitem l1, orders, nation WHERE s_suppkey = l1.l_suppkey AND o_orderstatus = 'F' AND n_name = 1 AND 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 NOT EXISTS ( SELECT * FROM l...
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 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 INNER JOIN customer_demographics ON ss_cdemo_sk = cd_demo_sk INNER JOIN date_dim ON ss_sold_date_sk = d_date_sk INNER JOIN item ON ss_item_sk = i_item_sk INNER JOIN promotion ...
tpcds
SELECT s_acctbal, s_name, n_name, p_partkey, p_mfgr, s_address, s_phone, s_comment FROM part, supplier, partsupp, nation, region WHERE ps_supplycost = ( SELECT MIN(ps_supplycost) FROM partsupp, supplier, nation, region WHERE p_partkey = ps_partkey AND s_suppkey = ps_suppkey AND s_nationkey = n_nationkey AND n_regionkey...
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 cn.id = mc.company_id and cn.country_code ='[nl]' and k.keyword ='character-name-in-title' and mc.movie_id = mk.movie_id and mk.keyword_id = k.id and t.id = mk.movie_id and mc.movie_id ...
job
SELECT MIN(an.name) AS cool_actor_pseudonym, MIN(t.title) AS series_named_after_char FROM aka_name AS an, cast_info AS ci, company_name AS cn, keyword AS k, movie_companies AS mc, movie_keyword AS mk, name AS n, title AS t WHERE mk.keyword_id = k.id AND an.person_id = n.id AND ci.movie_id = mc.movie_id AND t.episode_nr...
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 l_orderkey = o_orderk...
tpch
Select Min(mi.info) As release_date, Min(t.title) As german_movie, Min(miidx.info) As rating 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 mi.movie_id = miidx.movie_id AND kt.kind = 'mov...
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 ct.kind = 'production companies' AND (mc.note LIKE '%(co-production)%' OR ...
job
SELECT AVG(l_quantity) AS avg_qty, AVG(l_discount) AS avg_disc, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, SUM(l_extendedprice) AS sum_base_price, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, COUNT(*) AS count_order, l_linestatus, AVG(l_extendedprice) AS avg_price, l_returnflag, ...
tpch
SELECT n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, supplier, nation, region WHERE l_orderkey = o_orderkey AND n_regionkey = r_regionkey AND s_nationkey = n_nationkey AND c_nationkey = s_nationkey AND o_orderdate < DATE 1 + INTERVAL '1' YEAR AND r_name = 1 AND c_custkey = ...
tpch
SELECT l_shipmode, SUM( CASE WHEN o_orderpriority = '1-URGENT' OR o_orderpriority = '2-HIGH' THEN 1 ELSE 0 END ) AS high_line_count, SUM( CASE WHEN o_orderpriority <> '1-URGENT' AND o_orderpriority <> '2-HIGH' THEN 1 ELSE 0 END ) AS low_line_count FROM orders, lineitem WHERE l_receiptdate >= DATE 1 AND l_receiptdate < ...
tpch
select c_name, n_name, c_phone, c_acctbal, c_custkey, c_comment, sum(l_extendedprice * (1 - l_discount)) as revenue, c_address from customer, orders, lineitem, nation where c_custkey = o_custkey AND o_orderdate < DATE 1 + INTERVAL '3' MONTH AND l_returnflag = 'R' AND c_nationkey = n_nationkey AND o_orderdate >= DATE 1 ...
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 an.person_id = n.id AND cn.country_code = '[us]' AND t.episode_nr >=...
job
SELECT MIN(t.title) AS western_violent_movie, MIN(mi_idx.info) AS rating, MIN(cn.name) AS movie_company FROM company_name AS cn, company_type AS ct, info_type AS it1, info_type AS it2, keyword AS k, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS mi_idx, movie_keyword AS mk, title AS t WHERE...
job
With _q As ( Select Count(*) From badges As b, users As u, posts As p Where u.Reputation >= 1 And u.Id = b.UserId And u.Id = p.OwnerUserId And p.PostTypeId = 1 ) Select * From _q;
stats