text stringlengths 84 1.49k | benchmark stringclasses 4
values |
|---|---|
SELECT MIN(an.name) AS cool_actor_pseudonym, MIN(t.title) AS series_named_after_char FROM aka_name AS an, cast_info AS ci, company_name AS cn, keyword AS k, movie_companies AS mc, movie_keyword AS mk, name AS n, title AS t WHERE ci.movie_id = t.id AND mc.movie_id = mk.movie_id AND t.id = mk.movie_id AND an.person_id = ... | job |
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_brand <> 1 and p_type not like 1 and p_partkey = ps_partkey group by p_brand... | 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 = mi.movie_id AND mk.movie_id = mi.movie_id AND t.id = mk.movie_id AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Denish', 'Norwegian', 'German') AND k.id = mk.keyword_id AND k.keywo... | 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 cn.country_code = '[us]' AND an.person_id = n.id AND mc.company_id = cn.id AND ci.movie_id ... | 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 mc.movie_id = mk.movie_id AND k.keyword ='character-name-IN-title' AND t.id = mk.movie_id AND cn.country_code ='[de]' AND cn.id = mc.comp... | job |
Select Sum(l_quantity) As sum_qty, Avg(l_discount) As avg_disc, Sum(l_extendedprice * (1 - l_discount)) As sum_disc_price, l_linestatus, Count(*) As count_order, Avg(l_quantity) As avg_qty, l_returnflag, Avg(l_extendedprice) As avg_price, Sum(l_extendedprice) As sum_base_price, Sum(l_extendedprice * (1 - l_discount) * ... | tpch |
select c_last_name, c_first_name, c_salutation, c_preferred_cust_flag, ss_ticket_number, cnt from ( select ss_ticket_number, ss_customer_sk, count(*) as cnt from store_sales INNER JOIN date_dim on ss_sold_date_sk = d_date_sk INNER JOIN store on ss_store_sk = s_store_sk INNER JOIN household_demographics on ss_hdemo_sk =... | tpcds |
Select 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 |
Select Count(*) From badges As b, users As u Where b.UserId = u.Id And u.UpVotes >= 0 LIMIT 500; | stats |
SELECT AVG(ss_coupon_amt) AS agg3, AVG(ss_sales_price) AS agg4, AVG(ss_quantity) AS agg1, 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.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 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 count(*) 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 = pl.RelatedPostId AND p.Id = v.PostId AND c.Score = 0 AND pl.LinkTypeId = 1 AND p.Id = ph.PostId AND p.Id = c.PostId | 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 = mk.movie_id AND k.keyword LIKE '%sequel%' AND mi.info = ANY(ARRAY['Sweden', 'Norway', 'Germany', 'Danish', 'Swedish', 'Danish', 'Norwegian', 'German']) AND k.id = mk.keyword_id AND t.id = mi.movie_id AND... | 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 o_orderkey = l_orderkey AND p_p... | 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 n1.n_regionkey = r_re... | tpch |
SELECT MIN(k.keyword) AS movie_keyword, MIN(n.name) AS actor_name, MIN(t.title) AS marvel_movie FROM cast_info AS ci, keyword AS k, movie_keyword AS mk, name AS n, title AS t WHERE t.production_year > 2010 AND n.id = ci.person_id AND ci.movie_id = mk.movie_id AND t.id = mk.movie_id AND k.id = mk.keyword_id AND t.id = c... | job |
Select s_phone, total_revenue, s_address, s_suppkey, s_name From supplier, revenue0 Where s_suppkey = supplier_no And total_revenue = ( Select Max(total_revenue) From revenue0 ) Order By s_suppkey | tpch |
SELECT SUM(ss_ext_sales_price) AS ext_price, item.i_brand AS brand, item.i_brand_id AS brand_id, dt.d_year FROM date_dim AS dt INNER JOIN store_sales ON dt.d_date_sk = store_sales.ss_sold_date_sk INNER JOIN item ON store_sales.ss_item_sk = item.i_item_sk WHERE dt.d_moy = 11 AND item.i_manager_id = 67 AND dt.d_year = 19... | 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 pi.person_id = ci.person_id AND it.id = pi.info_type_id AND pi.person_id = an.person_id AND it.info = 'mini biography'... | 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 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 t.id = mi_idx.movie_id AND (mc.note LIKE '%(co... | job |
SELECT MAX(cs_net_profit) AS catalog_sales_profit, MAX(ss_net_profit) AS store_sales_profit, i_item_id, MAX(sr_net_loss) AS store_returns_loss, i_item_desc, 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 i_item_id, Avg(cs_quantity) As agg1, Avg(cs_list_price) As agg2, Avg(cs_coupon_amt) As agg3, 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 |
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 Count(*) From comments As c, posts As p, postLinks As pl, postHistory As ph, votes As v Where p.Id = c.PostId AND p.Id = v.PostId AND p.FavoriteCount >= 0 AND c.Score = 0 AND pl.LinkTypeId = 1 AND p.Id = pl.PostId AND p.Id = ph.PostId | stats |
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 s_nationkey = n_nationkey AND ps_supplycost = ( SELECT MIN(ps_supplycost) FROM partsupp, supplier, nation, region WHERE p_partkey = ps_partkey AND s_suppke... | tpch |
Select s_store_id, Max(cs_net_profit) As catalog_sales_profit, i_item_id, Max(ss_net_profit) As store_sales_profit, i_item_desc, Max(sr_net_loss) As store_returns_loss, s_store_name 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 Count(*) From comments As c, posts As p, postLinks As pl, postHistory As ph, votes As v, users As u Where p.Id = v.PostId And p.AnswerCount >= 0 And p.PostTypeId = 1 And p.Id = pl.PostId And u.Id = p.OwnerUserId And p.Id = ph.PostId And p.Id = c.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.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND it.info = 'top 250 rank' AND mc.movie_id = mi_i... | job |
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 cn.id = mc.company_id AND kt.id = t.kind_id AND kt.kind = 'movie' 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 k.keyword LIKE '%sequel%' AND mk.movie_id = mi.movie_id AND t.id = mi.movie_id AND mi.info = ANY(ARRAY['Sweden', 'Norway', 'Germany', 'Danish', 'Swedish', 'Danish', 'Norwegian', 'German']) AND k.id = mk.keyword... | job |
SELECT MIN(n.name) AS of_person, MIN(t.title) AS biography_movie FROM aka_name AS an, cast_info AS ci, info_type AS it, link_type AS lt, movie_link AS ml, name AS n, person_info AS pi, title AS t WHERE t.id = ci.movie_id AND (n.gender = 'm' OR (n.gender = 'f' AND n.name LIKE 'B%')) AND ml.linked_movie_id = t.id AND it.... | 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 t.production_year > 2010 AND n.name LIKE '%Downey%Robert%' AND k.keyword = 'marvel-cinemati... | 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 MIN(t.title) AS movie_title FROM company_name AS cn, keyword AS k, movie_companies AS mc, movie_keyword AS mk, title AS t WHERE mc.movie_id = mk.movie_id AND 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 ... | 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 COUNT(*) FROM comments AS c, postHistory AS ph, votes AS v, users AS u WHERE u.UpVotes <= 123 AND u.Views >= 0 AND u.Id = v.UserId AND u.DownVotes >= 0 AND ph.UserId = c.UserId AND v.UserId = ph.UserId | stats |
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 rt.role = 'actress' AND it.info = 'release dates' AND an.person_id = n.id... | job |
Select Count(*) From comments As c, votes As v, users As u Where u.Id = v.UserId And u.Id = c.UserId And c.CreationDate >= '2010-08-10 17:55:45'::timestamp And u.Reputation >= 1 Limit 1000; | stats |
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 ct.id = mc.company_type_id AND it2.info = 'rele... | job |
SELECT MIN(t.title) AS marvel_movie, MIN(n.name) AS actor_name, MIN(k.keyword) AS movie_keyword 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 t.production_year > 2010 AND t.id = ci.movie_id AND k.keyword = 'marvel-cinematic-universe' AND k.id = mk... | job |
SELECT MIN(t.title) AS american_movie FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info AS mi, title AS t WHERE (mc.note LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%') AND t.id = mi.movie_id AND ct.id = mc.company_type_id AND t.id = mc.movie_id AND it.info = 'bottom 10 rank' AND mc.n... | job |
SELECT s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE 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 o_orderstatus = 'F' AND s_nationkey = n_nationkey AND n_name = 1 AND EXISTS ( SELEC... | tpch |
SELECT c_last_name, c_first_name, c_salutation, c_preferred_cust_flag, ss_ticket_number, cnt FROM ( SELECT ss_ticket_number, ss_customer_sk, COUNT(*) AS cnt FROM store_sales INNER JOIN date_dim ON ss_sold_date_sk = d_date_sk INNER JOIN store ON ss_store_sk = s_store_sk INNER JOIN household_demographics ON ss_hdemo_sk =... | tpcds |
SELECT i_item_id, i_item_desc, s_store_id, s_store_name, SUM(ss_quantity) AS store_sales_quantity, SUM(sr_return_quantity) AS store_returns_quantity, SUM(cs_quantity) AS catalog_sales_quantity FROM store_sales INNER JOIN store_returns ON ss_customer_sk = sr_customer_sk AND ss_item_sk = sr_item_sk AND ss_ticket_number =... | tpcds |
SELECT MIN(an.name) AS acress_pseudonym, MIN(t.title) AS japanese_anime_movie FROM aka_name AS an, cast_info AS ci, company_name AS cn, company_type AS ct, keyword AS k, movie_companies AS mc, movie_keyword AS mk, name AS n, role_type AS rt, title AS t WHERE t.id = mk.movie_id AND n.gender = 'f' AND ci.movie_id = mc.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 o_orderkey = l_orderkey AND l_commitdate < l... | tpch |
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.production_year > 2010 And t.id = mi.movie_id And mk.movie_id = mi.movie_id And mi.info In ('Sweden', 'Norway', 'Germany', 'Danish... | 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 (mc.note LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%') AND it.id = mi_idx.info_type_id AND mc.n... | job |
SELECT total, promotions, 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(t.title) AS american_movie FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info AS mi, title AS t WHERE mc.movie_id = mi.movie_id AND t.id = mi.movie_id AND (mc.note LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%') AND ct.id = mc.company_type_id AND mc.note NOT LIKE '%(as Metro... | job |
SELECT SUM(l_extendedprice * (1 - l_discount)) AS revenue, n_name FROM customer, orders, lineitem, supplier, nation, region WHERE c_custkey = o_custkey AND l_suppkey = s_suppkey AND o_orderdate < DATE 1 + INTERVAL '1' YEAR AND n_regionkey = r_regionkey AND o_orderdate >= DATE 1 AND s_nationkey = n_nationkey AND l_order... | tpch |
Select cc_name As call_center_name, cc_call_center_id As call_center, Sum(cr_net_loss) As returns_loss, cc_manager As manager 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 l_orderkey, SUM(l_extendedprice * (1 - l_discount)) AS revenue, o_shippriority, o_orderdate FROM customer, orders, lineitem WHERE c_mktsegment = 1 AND c_custkey = o_custkey AND l_orderkey = o_orderkey AND o_orderdate < DATE 1 AND l_shipdate > DATE 1 GROUP BY l_orderkey, o_orderdate, o_shippriority ORDER BY reven... | 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 t.id = mi_idx.movie_id AND it.id = mi_idx.info_type_id AND t.id = mc.mov... | 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 MAX(an.name) As cool_actor_pseudonym, MAX(t.title) As series_named_after_char From aka_name As an, cast_info As ci, company_name As cn, keyword As k, movie_companies As mc, movie_keyword As mk, name As n, title As t Where k.keyword = 'character-name-In-title' AND t.id = mc.movie_id AND n.id = ci.person_id AND mk... | job |
SELECT c_last_name, c_first_name, ca_city, bought_city, ss_ticket_number, extended_price, extended_tax, 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 c_count, COUNT(*) AS custdist FROM ( SELECT c_custkey, COUNT(o_orderkey) AS c_count FROM customer LEFT JOIN orders ON c_custkey = o_custkey AND o_comment NOT LIKE 1 GROUP BY c_custkey ) AS c_orders GROUP BY c_count ORDER BY custdist DESC, c_count DESC LIMIT 1000; | tpch |
SELECT COUNT(*) FROM postHistory AS ph, posts AS p, votes AS v, badges AS b, users AS u, comments AS c WHERE p.Score <= 192 AND p.Id = ph.PostId AND p.Id = v.PostId AND p.ViewCount >= 0 AND u.Id = b.UserId AND u.Id = p.OwnerUserId AND p.Id = c.PostId LIMIT 500; | stats |
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(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 ci.movie_id = mk.movie_id AND k.keyword = 'marvel-cinematic-universe' AND t.id = ci.movie_id AND n.id = ci.person_id... | job |
SELECT p_brand, COUNT(DISTINCT ps_suppkey) AS supplier_cnt, p_type, p_size FROM partsupp, part WHERE p_type NOT LIKE 1 AND p_brand <> 1 AND p_size IN (1, 1, 1, 1, 1, 1, 1, 1) AND p_partkey = ps_partkey AND ps_suppkey NOT IN ( SELECT s_suppkey FROM supplier WHERE s_comment LIKE '%Customer%Complaints%' ) GROUP BY p_brand... | tpch |
SELECT MIN(t.title) AS series_named_after_char, MIN(an.name) AS cool_actor_pseudonym 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 = mc.movie_id AND n.id = ci.person_id AND ci.movie_id = mc.movie_id AND mc.movie_id = ... | job |
SELECT p_size, p_type, COUNT(DISTINCT ps_suppkey) AS supplier_cnt, p_brand FROM partsupp, part WHERE p_partkey = ps_partkey AND p_brand <> 1 AND p_type NOT LIKE 1 AND p_size IN (1, 1, 1, 1, 1, 1, 1, 1) AND ps_suppkey NOT IN ( SELECT s_suppkey FROM supplier WHERE s_comment LIKE '%Customer%Complaints%' ) GROUP BY p_brand... | tpch |
Select Min(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 = mc.movie_id And t.id = mi_idx.movie_id And mi.movie_id = mc.mov... | job |
SELECT MAX(an.name) AS acress_pseudonym, MAX(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 an.person_id = n.id AND t.id = mk.movie_id AND ci.person_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 t.id = mi.movie_id and k.id = mk.keyword_id and t.production_year > 2000 and k.keyword like '%sequel%' and t.id = mk.movie_id and mi.info in ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Danish', 'Norw... | job |
WITH year_total AS ( SELECT d_year AS dyear, c_preferred_cust_flag AS customer_preferred_cust_flag, c_last_name AS customer_last_name, 's' AS sale_type, c_email_address AS customer_email_address, c_customer_id AS customer_id, c_login AS customer_login, SUM(((ss_ext_list_price - ss_ext_wholesale_cost - ss_ext_discount_a... | 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 n.id = an.person_id AND t.production_year BETWEEN 1980 AND 1995 AND ml.linked_movie_id = t.id AND ci.movie_id = ml.lin... | job |
SELECT s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE n_name = 1 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 AND l3.l_receiptdate > l3.l_commitdate ) AND o_orderstatus = 'F' AND l1.l_receiptd... | tpch |
SELECT MIN(chn.name) AS uncredited_voiced_character, MIN(t.title) AS russian_movie FROM char_name AS chn, cast_info AS ci, company_name AS cn, company_type AS ct, movie_companies AS mc, role_type AS rt, title AS t WHERE rt.id = ci.role_id AND cn.id = mc.company_id AND t.production_year > 2005 AND chn.id = ci.person_rol... | job |
SELECT AVG(l_extendedprice) AS avg_price, COUNT(*) AS count_order, AVG(l_quantity) AS avg_qty, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, SUM(l_quantity) AS sum_qty, SUM(l_extendedprice) AS sum_base_price, l_linestatus, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, AVG(l_discount)... | tpch |
Select l_orderkey, Sum(l_extendedprice * (1 - l_discount)) As revenue, o_orderdate, o_shippriority From customer, orders, lineitem Where o_orderdate < DATE 1 And c_custkey = o_custkey And c_mktsegment = 1 And l_shipdate > DATE 1 And l_orderkey = o_orderkey Group By l_orderkey, o_orderdate, o_shippriority Order By reven... | tpch |
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 pi.note = 'Volker Boehm' AND pi.person_id = an.person_id AND ci.person_id = n.id AND lt.id = ml.link_type_id AND n.id ... | 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 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 ci.movie_id = mk.movie_id AND ci.movie_id = t.id AND cn.country_cod... | 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.id = ci.person_id AND t.id = mk.movie_id AND t.id = ci.movie_id AND ci.movie_id = mk.movie_id AND n.name LIKE '%Downey%Robert%' AND k.key... | 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 ci.note LIKE '%(voice: English version)%' AND an.person_id = ... | job |
SELECT p_type, p_size, p_brand, COUNT(DISTINCT ps_suppkey) AS supplier_cnt FROM partsupp, part WHERE p_brand <> 1 AND ps_suppkey NOT IN ( SELECT s_suppkey FROM supplier WHERE s_comment LIKE '%Customer%Complaints%' ) AND p_partkey = ps_partkey AND p_size IN (1, 1, 1, 1, 1, 1, 1, 1) AND p_type NOT LIKE 1 GROUP BY p_brand... | 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_commitdate < l... | 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 it.id = mi.info_type_id AND ml.movi... | job |
SELECT MIN(chn.name) AS uncredited_voiced_character, MIN(t.title) AS russian_movie FROM char_name AS chn, cast_info AS ci, company_name AS cn, company_type AS ct, movie_companies AS mc, role_type AS rt, title AS t WHERE cn.country_code = '[ru]' AND ci.note LIKE '%(voice)%' AND rt.role = 'actor' AND ci.movie_id = mc.mov... | job |
SELECT bought_city, extended_tax, ss_ticket_number, ca_city, list_price, c_first_name, 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 |
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 c.UserId = u.Id AND p.Id = v.PostId AND p.Score <= 40 AND p.Id = c.PostId AND p.Id = ph.PostId AND p.Id = pl.RelatedPostId AND b.UserId = u.Id AND pl.LinkTypeId = 1 | stats |
SELECT COUNT(*) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v, badges AS b WHERE c.Score = 0 AND p.Id = v.PostId AND p.Id = c.PostId AND p.Id = pl.RelatedPostId AND p.Id = ph.PostId AND pl.LinkTypeId = 1 AND b.UserId = c.UserId LIMIT 500; | stats |
select c_last_name, c_first_name, ca_city, bought_city, ss_ticket_number, extended_price, extended_tax, 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 c_count, Count(1) As custdist From ( Select c_custkey, Count(o_orderkey) As c_count From customer Left Join orders On c_custkey = o_custkey And o_comment Not Like 1 Group By c_custkey ) As c_orders Group By c_count Order By custdist Desc, c_count Desc | tpch |
SELECT MIN(k.keyword) AS movie_keyword, MIN(n.name) AS actor_name, MIN(t.title) AS marvel_movie FROM cast_info AS ci, keyword AS k, movie_keyword AS mk, name AS n, title AS t WHERE t.id = ci.movie_id AND n.id = ci.person_id AND n.name LIKE '%Downey%Robert%' AND t.id = mk.movie_id AND t.production_year > 2010 AND ci.mov... | 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 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_receiptdate ... | tpch |
SELECT c_last_name, c_first_name, c_salutation, c_preferred_cust_flag, ss_ticket_number, cnt FROM ( SELECT ss_ticket_number, ss_customer_sk, COUNT(*) AS cnt FROM store_sales JOIN date_dim ON ss_sold_date_sk = d_date_sk JOIN store ON ss_store_sk = s_store_sk JOIN household_demographics ON ss_hdemo_sk = hd_demo_sk WHERE ... | tpcds |
SELECT SUM(l_extendedprice) AS sum_base_price, l_linestatus, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, SUM(l_quantity) AS sum_qty, l_returnflag, AVG(l_discount) AS avg_disc, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, COUNT(*) AS count_order, AVG(l_quantity) AS avg_qty, AVG(l_e... | tpch |
SELECT COUNT(*) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v, users AS u WHERE p.Id = c.PostId AND p.PostTypeId = 1 AND p.Id = ph.PostId AND u.Id = p.OwnerUserId AND p.Id = v.PostId AND p.Id = pl.PostId AND p.AnswerCount >= 0 LIMIT 20; | 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 t.id = ci.movie_id AND ci.movie_id = mk.movie_id AND n.name LIKE '%Downey%Robert%' AND t.id = mk.movie_id AND k.id = mk.keyword_id AND k.ke... | 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 it.info = 'mini biography' AND n.name_pcode_cf BETWEEN 'A' AND 'F' AND pi.person_id = ci.person_id AND ml.linked_movie... | job |
SELECT c_last_name, c_first_name, c_salutation, c_preferred_cust_flag, ss_ticket_number, cnt FROM ( SELECT ss_ticket_number, ss_customer_sk, COUNT(*) AS cnt FROM store_sales INNER JOIN date_dim ON ss_sold_date_sk = d_date_sk INNER JOIN store ON ss_store_sk = s_store_sk INNER JOIN household_demographics ON ss_hdemo_sk =... | tpcds |
SELECT 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.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 ct.kind = 'production companies' AND ct.id = mc... | job |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.