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 mi.info In ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Denish', 'Norwegian', 'German') 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 ... | 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 = t.id AND cn.country_code ='[sm]' AND k.keyword ='character-name-in-title' AND mc.movie_id = mk.movie_id AND cn.id = mc.company_id AND mk.keyword_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.id = mk.movie_id AND mc.company_id = cn.id AND t.episode_nr < 100 AND t.id = mc.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 t.id = mk.movie_id and cn.id = mc.company_id and mc.movie_id = mk.movie_id and mk.keyword_id = k.id and k.keyword ='character-name-in-title' and cn.country_code ='[de]' and mc.movie_id ... | job |
SELECT MIN(t.production_year) AS movie_year, MIN(mc.note) AS production_note, MIN(t.title) AS movie_title 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 t.id... | job |
SELECT MIN(mi_idx.info) AS rating, MIN(t.title) AS northamerican_movie FROM aka_title AS at, company_name AS cn, info_type AS it1, info_type AS it2, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS mi_idx, title AS t WHERE at.movie_id = mi_idx.movie_id AND t.id = mi.movie_id AND it1.info = 'r... | job |
SELECT SUM(l_extendedprice * l_discount) AS revenue FROM lineitem WHERE l_shipdate < DATE 1 + INTERVAL '1' YEAR AND l_discount BETWEEN 1 - 0.01 AND 1 + 0.01 AND l_shipdate >= DATE 1 AND l_quantity < 1 LIMIT 500; | 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 c_nationkey = n2.n_nationkey AND s... | tpch |
SELECT SUM(l_extendedprice * (1 - l_discount)) AS revenue, c_phone, n_name, c_custkey, c_comment, c_name, c_acctbal, c_address FROM customer, orders, lineitem, nation WHERE c_nationkey = n_nationkey AND o_orderdate < DATE 1 + INTERVAL '3' MONTH AND l_returnflag = 'R' AND o_orderdate >= DATE 1 AND c_custkey = o_custkey ... | tpch |
Select p_brand, p_size, Count(Distinct ps_suppkey) As supplier_cnt, p_type 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 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_suppkey = l_suppkey AND s_su... | tpch |
SELECT AVG(cs_quantity) AS agg1, AVG(cs_list_price) AS agg2, AVG(cs_sales_price) AS agg4, i_item_id, AVG(cs_coupon_amt) AS agg3 FROM catalog_sales JOIN customer_demographics ON cs_bill_cdemo_sk = cd_demo_sk JOIN date_dim ON cs_sold_date_sk = d_date_sk JOIN item ON cs_item_sk = i_item_sk JOIN promotion ON cs_promo_sk = ... | tpcds |
Select Min(t.title) As movie_title From keyword As k, movie_info As mi, movie_keyword As mk, title As t Where k.id = mk.keyword_id And mi.info In ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Denish', 'Norwegian', 'German') And t.id = mi.movie_id And t.id = mk.movie_id And mk.movie_id = mi.movie_id And t.produ... | job |
SELECT COUNT(1) FROM postHistory AS ph, posts AS p, votes AS v, badges AS b, users AS u, comments AS c WHERE p.Id = v.PostId AND u.Id = b.UserId AND p.Id = ph.PostId AND p.Score <= 192 AND u.Id = p.OwnerUserId AND p.Id = c.PostId AND p.ViewCount >= 0 | stats |
SELECT COUNT(sr_return_quantity) AS store_returns_quantitycount, i_item_desc, STDDEV_SAMP(cs_quantity) / AVG(cs_quantity) AS catalog_sales_quantitycov, s_state, STDDEV_SAMP(sr_return_quantity) / AVG(sr_return_quantity) AS store_returns_quantitycov, COUNT(ss_quantity) AS store_sales_quantitycount, AVG(cs_quantity) AS ca... | 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.id = mc.company_type_id AND ct.kind = 'production companies' AND (mc.note LIKE '... | job |
SELECT COUNT(*) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v, users AS u WHERE p.Id = pl.PostId AND p.PostTypeId = 1 AND p.AnswerCount >= 0 AND u.Id = p.OwnerUserId AND p.Id = c.PostId AND p.Id = ph.PostId AND p.Id = v.PostId | stats |
SELECT * FROM ( SELECT AVG(ss_list_price) AS b1_lp, COUNT(ss_list_price) AS b1_cnt, COUNT(DISTINCT ss_list_price) AS b1_cntd FROM store_sales WHERE (ss_list_price >= 16 AND ss_list_price <= 16 + 10 OR ss_coupon_amt BETWEEN 665 AND 665 + 1000 OR ss_wholesale_cost BETWEEN 67 AND 67 + 20) ) AS b1, ( SELECT AVG(ss_list_pri... | tpcds |
SELECT MAX(mi.info) AS release_date, MAX(miidx.info) AS rating, MAX(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 it.id = miidx.info_type_id AND kt.kind = 'movie... | 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 = mk.movie_id and mc.movie_id = t.id and cn.country_code ='[nl]' and k.keyword ='character-name-in-title' and t.id = mk.movie_id and cn.id = mc.comp... | job |
SELECT MIN(an1.name) AS actress_pseudonym, MIN(t.title) AS japanese_movie_dubbed FROM aka_name AS an1, cast_info AS ci, company_name AS cn, movie_companies AS mc, name AS n1, role_type AS rt, title AS t WHERE ci.note = '(voice: English version)' AND ci.movie_id = t.id AND n1.id = ci.person_id AND mc.company_id = cn.id ... | job |
select min(mc.note) as production_note, min(t.title) as movie_title, min(t.production_year) as movie_year from company_type as ct, info_type as it, movie_companies as mc, movie_info_idx as mi_idx, title as t where it.info = 'top 250 rank' and mc.note not like '%(as Metro-Goldwyn-Mayer Pictures)%' and t.id = mc.movie_id... | 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 c_nationkey = n2.n_nationkey AND s... | 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 ct.id = mc.company_type_id AND cn.country_code = '[jp]' AND m... | 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 ci.movie_id = mk.movie_id AND k.keyword = 'marvel-cinematic-universe' AND n.name LIKE '%Hemsworth%Chris%' AND k.id = mk.keyword_id AND t.pr... | job |
SELECT s_name, COUNT(1) AS numwait FROM supplier, lineitem l1, orders, nation WHERE s_nationkey = n_nationkey AND EXISTS ( SELECT * FROM lineitem l2 WHERE l2.l_orderkey = l1.l_orderkey AND l2.l_suppkey <> l1.l_suppkey ) AND NOT EXISTS ( SELECT * FROM lineitem l3 WHERE l3.l_orderkey = l1.l_orderkey AND l3.l_suppkey <> l... | tpch |
SELECT SUM(CASE WHEN (CAST(d_date AS DATE) < CAST('2000-03-11' AS DATE)) THEN cs_sales_price - COALESCE(cr_refunded_cash, 0) ELSE 0 END) AS sales_before, w_state, i_item_id, SUM(CASE WHEN (CAST(d_date AS DATE) >= CAST('2000-03-11' AS DATE)) THEN cs_sales_price - COALESCE(cr_refunded_cash, 0) ELSE 0 END) AS sales_after ... | tpcds |
SELECT MIN(n.name) AS voicing_actress, MIN(t.title) AS voiced_movie FROM aka_name AS an, char_name AS chn, cast_info AS ci, company_name AS cn, info_type AS it, movie_companies AS mc, movie_info AS mi, name AS n, role_type AS rt, title AS t WHERE t.production_year > 2000 AND it.id = mi.info_type_id AND mi.movie_id = ci... | 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 NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND it.id = mi_idx.info_type_id AND ct.id = mc.comp... | job |
Select cntrycode, Count(*) As numcust, Sum(c_acctbal) As totacctbal From ( Select SUBSTRING(c_phone From 1 FOR 2) As cntrycode, c_acctbal From customer Where SUBSTRING(c_phone From 1 FOR 2) In (1, 1, 1, 1, 1, 1, 1) And c_acctbal > ( Select Avg(c_acctbal) From customer Where c_acctbal > 0.00 And SUBSTRING(c_phone From 1... | tpch |
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 it.info ='rating' and it.id = mi_idx.info_type_id and t.production_year between 2000 and 2010 and mi_idx.info > '7.0' and t.id = mi_idx.movie_id | job |
SELECT ps_partkey, SUM(ps_supplycost * ps_availqty) AS VALUE FROM partsupp, supplier, nation WHERE s_nationkey = n_nationkey AND ps_suppkey = s_suppkey AND n_name = 1 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 SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, AVG(l_quantity) AS avg_qty, l_linestatus, COUNT(*) AS count_order, l_returnflag, SUM(l_extendedprice) AS sum_base_price, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, SUM(l_quantity) AS sum_qty, AVG(l_discount) AS avg_disc, AVG(l_e... | 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 b.UserId = u.Id AND c.UserId = u.Id AND p.Id = pl.RelatedPostId AND p.Id = ph.PostId AND p.Score <= 40 AND p.Id = c.PostId AND p.Id = v.PostId AND pl.LinkTypeId = 1 | stats |
SELECT MIN(mi_idx.info) AS rating, MIN(cn.name) AS movie_company, MIN(t.title) AS western_violent_movie FROM company_name AS cn, company_type AS ct, info_type AS it1, info_type AS it2, keyword AS k, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS mi_idx, movie_keyword AS mk, title AS t WHERE... | job |
select min(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 n.id = ci.person_id and ci.movie_id = mk.movie_id and t.episode_nr... | job |
Select Min(t.title) As movie_title From keyword As k, movie_info As mi, movie_keyword As mk, title As t Where k.id = mk.keyword_id And k.keyword Like '%sequel%' And t.id = mk.movie_id And t.id = mi.movie_id And mi.info In ('Sweden', 'Norway', 'Germany', 'Danish', 'Swedish', 'Danish', 'Norwegian', 'German') And mk.movie... | 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 > 2005 AND t.id = mi.movie_id AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Denish', 'Norwegian', 'German') AND mk.movie_id = mi.movie_id AND t.id = mk.movie_id AND k.i... | job |
WITH _q AS ( select count(*) from comments as c, posts as p, postLinks as pl where p.CreationDate >= '2010-07-23 07:27:31'::timestamp and c.UserId = p.OwnerUserId and p.CreationDate <= '2014-09-09 01:43:00'::timestamp and p.CommentCount <= 18 and p.Id = pl.PostId ) SELECT * FROM _q; | stats |
select min(t.title) as movie_title from keyword as k, movie_info as mi, movie_keyword as mk, title as t where k.id = mk.keyword_id AND mi.info in ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Denish', 'Norwegian', 'German') AND mk.movie_id = mi.movie_id AND k.keyword like '%sequel%' AND t.id = mi.movie_id AND ... | job |
with year_total as ( select c_email_address as customer_email_address, 's' as sale_type, c_customer_id as customer_id, c_last_name as customer_last_name, c_login as customer_login, c_preferred_cust_flag as customer_preferred_cust_flag, c_birth_country as customer_birth_country, c_first_name as customer_first_name, sum(... | tpcds |
select count(*) from comments as c, posts as p, postHistory as ph, votes as v, users as u where p.Score <= 13 AND p.AnswerCount >= 0 AND p.OwnerUserId = ph.UserId AND ph.UserId = v.UserId AND u.Id = c.UserId AND c.UserId = p.OwnerUserId | stats |
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 chn.id = ci.person_role_id AND cn.id = mc.company_id AND ct.id = mc.company_type_id AND cn.country_c... | 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 n1.n_regionkey = r_re... | tpch |
SELECT MIN(lt.link) AS link_type, MIN(t.title) AS western_sequel, MIN(cn.name) AS from_company FROM company_name AS cn, company_type AS ct, info_type AS it, keyword AS k, link_type AS lt, movie_companies AS mc, movie_info AS mi, movie_keyword AS mk, movie_link AS ml, title AS t WHERE t.id = ml.movie_id AND t.production... | job |
Select i_brand_id As brand_id, i_brand As brand, i_manufact_id, Sum(ss_ext_sales_price) As ext_price, i_manufact 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 MIN(t.production_year) AS movie_year, MIN(mc.note) AS production_note, MIN(t.title) AS movie_title 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 (mc.note LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%') AND mc.note... | 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 t.production_year > 2005 AND ct.id = mc.company_type_id AND rt.role = 'actor' AND t.id = mc.movie_id... | job |
WITH _q AS ( SELECT COUNT(*) FROM comments AS c, postHistory AS ph, badges AS b, votes AS v, users AS u WHERE ph.UserId = v.UserId AND ph.PostHistoryTypeId = 12 ) SELECT * FROM _q AND b.UserId = ph.UserId AND u.UpVotes = 0 AND v.UserId = c.UserId AND u.Id = b.UserId | stats |
SELECT COUNT(1) FROM comments AS c, posts AS p, postLinks AS pl WHERE p.CommentCount <= 18 AND p.CreationDate <= '2014-09-09 01:43:00'::timestamp AND p.Id = pl.PostId AND c.UserId = p.OwnerUserId AND p.CreationDate >= '2010-07-23 07:27:31'::timestamp LIMIT 50; | stats |
SELECT MIN(mi.info) AS release_date, MIN(miidx.info) AS rating, MIN(t.title) AS german_movie FROM company_name AS cn, company_type AS ct, info_type AS it, info_type AS it2, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS miidx, title AS t WHERE miidx.movie_id = t.id AND it2.info = 'release d... | job |
SELECT MIN(t.title) AS movie_title, MIN(mc.note) AS production_note, MIN(t.production_year) AS movie_year FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info_idx AS mi_idx, title AS t WHERE ct.kind = 'production companies' AND mc.movie_id = mi_idx.movie_id AND it.info = 'top 250 rank' AND it.id ... | job |
SELECT extended_tax, c_first_name, bought_city, ca_city, c_last_name, ss_ticket_number, extended_price, 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 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 = mc.movie_id AND ct.id = mc.company_type_id AND (mc.note LIKE '%(c... | 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(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 chn.id = ci.person_role_id AND rt.role = 'actor' AND ci.movie_id = mc.movie_id AND t.id = mc.movie_i... | job |
SELECT i_item_id, COUNT(ss_quantity) AS store_sales_quantitycount, AVG(sr_return_quantity) AS store_returns_quantityave, STDDEV_SAMP(cs_quantity) / AVG(cs_quantity) AS catalog_sales_quantitycov, STDDEV_SAMP(ss_quantity) / AVG(ss_quantity) AS store_sales_quantitycov, STDDEV_SAMP(sr_return_quantity) / AVG(sr_return_quant... | 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 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 MIN(an.name) AS cool_actor_pseudonym, MIN(t.title) AS series_named_after_char FROM aka_name AS an, cast_info AS ci, company_name AS cn, keyword AS k, movie_companies AS mc, movie_keyword AS mk, name AS n, title AS t WHERE cn.country_code = '[us]' AND an.person_id = ci.person_id AND ci.movie_id = mc.movie_id AND ... | job |
Select Avg(ss_quantity) As store_sales_quantityave, Count(cs_quantity) As catalog_sales_quantitycount, i_item_id, STDDEV_SAMP(sr_return_quantity) / Avg(sr_return_quantity) As store_returns_quantitycov, Count(sr_return_quantity) As store_returns_quantitycount, Count(ss_quantity) As store_sales_quantitycount, Avg(cs_quan... | 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 (mc.note LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%') AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND it.info = 'bottom 10 ra... | job |
WITH _q AS ( SELECT c_count, COUNT(*) AS custdist FROM ( SELECT c_custkey, COUNT(o_orderkey) AS c_count FROM customer LEFT OUTER 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 200 ) SELECT * FROM _q; | 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 t.production_year > 2010 AND n.name LIKE '%Downey%Robert%' AND k.id = mk.keyword_id AND k.ke... | job |
with _q as ( select cntrycode, count(*) as numcust, sum(c_acctbal) as totacctbal from ( select SUBSTRING(c_phone from 1 FOR 2) as cntrycode, c_acctbal from customer where SUBSTRING(c_phone from 1 FOR 2) in (1, 1, 1, 1, 1, 1, 1) and c_acctbal > ( select avg(c_acctbal) from customer where c_acctbal > 0.00 and SUBSTRING(c... | tpch |
SELECT n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, supplier, nation, region WHERE l_suppkey = s_suppkey AND c_nationkey = s_nationkey AND o_orderdate < DATE 1 + INTERVAL '1' YEAR AND n_regionkey = r_regionkey AND s_nationkey = n_nationkey AND c_custkey = o_custkey AND r_n... | tpch |
WITH _q AS ( SELECT i_brand_id AS brand_id, i_brand AS brand, i_manufact_id, i_manufact, 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_... | 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 rt.role = 'actress' AND mi.movie_id = mc.movie_id AND ci.note IN ('(voice... | job |
SELECT l_orderkey, o_shippriority, SUM(l_extendedprice * (1 - l_discount)) AS revenue, o_orderdate FROM customer, orders, lineitem WHERE o_orderdate < DATE 1 AND l_shipdate > DATE 1 AND l_orderkey = o_orderkey AND c_custkey = o_custkey AND c_mktsegment = 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 mk.movie_id = mi.movie_id AND t.production_year > 2005 AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Denish', 'Norwegian', 'German') AND t.id = mi.movie_id AND t.id = mk.movie_id AND k.k... | job |
Select Min(t.title) As movie_title From keyword As k, movie_info As mi, movie_keyword As mk, title As t Where mk.movie_id = mi.movie_id And k.keyword Like '%sequel%' And t.id = mi.movie_id And t.production_year > 2010 And t.id = mk.movie_id And k.id = mk.keyword_id And mi.info In ('Sweden', 'Norway', 'Germany', 'Danish... | job |
WITH _q AS ( SELECT SUM(ss_ext_sales_price) AS ext_price, i_manufact_id, i_brand_id AS brand_id, i_manufact, i_brand AS brand 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_... | 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 = t.id AND mk.keyword_id = k.id AND mc.movie_id = mk.mo... | job |
SELECT MAX(n.name) AS of_person, MAX(t.title) AS biography_movie FROM aka_name AS an, cast_info AS ci, info_type AS it, link_type AS lt, movie_link AS ml, name AS n, person_info AS pi, title AS t WHERE lt.link = 'features' AND n.id = pi.person_id AND it.id = pi.info_type_id AND lt.id = ml.link_type_id AND pi.note = 'Vo... | job |
SELECT MIN(t.title) AS american_movie FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info AS mi, title AS t WHERE mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND t.id = mi.movie_id AND it.id = mi.info_type_id AND ct.id = mc.company_type_id AND ct.kind = 'production companies' AND it.i... | job |
SELECT MIN(mi_idx.info) AS rating, MIN(t.title) AS western_violent_movie, 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 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 DA... | tpch |
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 cn.country_code ='[de]' AND mk.keyword_id = k.id AND t.id = mk.movie_id AND mc.movie_id = t.id AND cn.id = mc.company_id AND mc.movie_id = mk.movie_id AND k.keyword ='chara... | 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 t.id = mk.movie_id and cn.country_code ='[sm]' and k.keyword ='character-name-in-title' and mc.movie_id = mk.movie_id and mc.movie_id = t.id and mk.keyword_id ... | job |
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 JOIN store_returns ON ss_customer_sk = sr_customer_sk AND ss_item_sk = sr_item_sk AND ss_ticket_number = sr_ti... | tpcds |
SELECT MIN(an.name) AS cool_actor_pseudonym, MIN(t.title) AS series_named_after_char FROM aka_name AS an, cast_info AS ci, company_name AS cn, keyword AS k, movie_companies AS mc, movie_keyword AS mk, name AS n, title AS t WHERE n.id = ci.person_id AND t.episode_nr < 100 AND an.person_id = n.id AND t.episode_nr >= 50 A... | job |
Select i_brand_id As brand_id, Sum(ss_ext_sales_price) As ext_price, i_brand As brand From date_dim Join store_sales On d_date_sk = ss_sold_date_sk Join item On ss_item_sk = i_item_sk Where d_year = 2001 AND i_manager_id = 1 AND d_moy = 11 Group By i_brand, i_brand_id Order By ext_price Desc, brand_id Limit 100; | 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 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 ci.person_id = an.person_id AN... | 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 b.UserId = u.Id AND c.UserId = u.Id AND p.Score <= 40 AND pl.LinkTypeId = 1 AND p.Id = pl.RelatedPostId AND p.Id = c.PostId | stats |
Select Sum(cr_net_loss) As returns_loss, cc_manager As manager, cc_call_center_id As call_center, 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 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 mi.info IN ('Sweden', 'Norway', 'Germany', 'Danish', 'Swedish', 'Danish', 'Norwe... | job |
SELECT COUNT(1) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v, badges AS b WHERE p.Id = v.PostId AND p.Id = pl.RelatedPostId AND p.Id = ph.PostId AND pl.LinkTypeId = 1 AND b.UserId = c.UserId AND c.Score = 0 AND p.Id = c.PostId | 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 o_custkey = c_custkey... | 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 t.id = mk.movie_id AND mc.movie_id = t.id AND k.keyword ='character-name-in-title' AND mc.movie_id = mk.movie_id AND cn.id = mc.company_id AND cn.country_code ='[sm]' AND mk.keyword_id ... | job |
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 it2.id = mi.info_type_id AND cn.country_code = ... | job |
SELECT MIN(t.title) AS american_movie FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info AS mi, title AS t WHERE ct.kind = 'production companies' AND ct.id = mc.company_type_id AND t.id = mi.movie_id AND t.id = mc.movie_id AND mc.movie_id = mi.movie_id AND mc.note NOT LIKE '%(as Metro-Goldwyn-M... | job |
SELECT c_custkey, c_name, o_totalprice, o_orderkey, o_orderdate, SUM(l_quantity) 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(t.production_year) AS movie_year, MIN(mc.note) AS production_note, MIN(t.title) AS movie_title 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 t.id = mc.movie_id AND ct.id = mc.company_type_id AND t.id = mi_idx.movie_... | 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 mc.movie_id = t.id AND cn.country_code ='[sm]' AND t.id = mk.movie_id AND mc.movie_id = mk.movie_id AND cn.id = mc.company_id AND mk.keyword_id ... | job |
SELECT p_brand, p_type, p_size, COUNT(DISTINCT ps_suppkey) AS supplier_cnt FROM partsupp, part WHERE p_brand <> 1 AND p_size = ANY(ARRAY[1, 1, 1, 1, 1, 1, 1, 1]) AND ps_suppkey NOT IN ( SELECT s_suppkey FROM supplier WHERE s_comment LIKE '%Customer%Complaints%' ) AND p_type NOT LIKE 1 AND p_partkey = ps_partkey GROUP B... | 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.country_code ='[nl]' AND cn.id = mc.company_id AND mc.movie_id = t.id AND mk.keyword_id = k.id AND t.id = mk.movie_id AND mc.movie_id = mk.movie_id AND k.keyword ='character-name-IN-... | 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 = v.PostId AND b.UserId = c.UserId AND pl.LinkTypeId = 1 AND p.Id = pl.RelatedPostId AND c.Score = 0 AND p.Id = ph.PostId AND p.Id = c.PostId | stats |
SELECT s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE l1.l_receiptdate > l1.l_commitdate AND o_orderstatus = 'F' AND o_orderkey = l1.l_orderkey AND EXISTS ( SELECT * FROM lineitem l2 WHERE l2.l_orderkey = l1.l_orderkey AND l2.l_suppkey <> l1.l_suppkey ) AND NOT EXISTS ( SELECT * FROM linei... | tpch |
SELECT AVG(ss_quantity), AVG(ss_ext_sales_price), AVG(ss_ext_wholesale_cost), SUM(ss_ext_wholesale_cost) FROM store_sales JOIN store ON s_store_sk = ss_store_sk JOIN customer_demographics ON cd_demo_sk = ss_cdemo_sk JOIN household_demographics ON hd_demo_sk = ss_hdemo_sk JOIN customer_address ON ca_address_sk = ss_addr... | tpcds |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.