text stringlengths 84 1.49k | benchmark stringclasses 4
values |
|---|---|
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 an.person_id = n.id AND t.id = ci.movie_id AND cn.country_cod... | job |
SELECT s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE o_orderstatus = 'F' 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 n_name = 1 AND EXISTS ( SELECT * FROM lineitem l2 WHERE l2.... | tpch |
select min(mi_idx.info) as rating, min(t.title) as movie_title from info_type as it, movie_info_idx as mi_idx, title as t where t.id = mi_idx.movie_id and it.info ='rating' and t.production_year between 2000 and 2005 and it.id = mi_idx.info_type_id and mi_idx.info > '8.0' | 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 = c.PostId AND c.Score = 0 AND p.Id = pl.RelatedPostId AND b.UserId = c.UserId AND p.Id = v.PostId AND p.Id = ph.PostId AND pl.LinkTypeId = 1 | 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 n.id = ci.person_id AND cn.id = mc.company_id AND it.id = mi.info_type_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_custkey = o_custkey AND s_nation... | 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 mi.movie_id = miidx.movie_id AND cn.id = mc.com... | 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 s_nationkey = n1.n_nationkey AND o... | tpch |
WITH _q AS ( SELECT s_name, s_address FROM supplier, nation WHERE s_suppkey IN ( SELECT ps_suppkey FROM partsupp WHERE ps_partkey IN ( SELECT p_partkey FROM part WHERE p_name LIKE 1 ) AND ps_availqty > ( SELECT 0.5 * SUM(l_quantity) FROM lineitem WHERE l_partkey = ps_partkey AND l_suppkey = ps_suppkey AND l_shipdate >=... | 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_shipmode In (1, 1) AND l_receiptdate >= DA... | tpch |
SELECT MIN(mc.note) AS production_note, MIN(t.title) AS movie_title, MIN(t.production_year) AS movie_year FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info_idx AS mi_idx, title AS t WHERE t.id = mi_idx.movie_id AND it.info = 'top 250 rank' AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Picture... | job |
With _q As ( Select Sum(l_extendedprice) / 7.0 As avg_yearly From lineitem, part Where p_container = 1 And l_quantity < ( Select 0.2 * Avg(l_quantity) From lineitem Where l_partkey = p_partkey ) And p_partkey = l_partkey ) Select * From _q And p_brand = 1 | tpch |
Select Count(*) From postHistory As ph, posts As p, votes As v, badges As b, users As u, comments As c Where p.ViewCount >= 0 AND p.Id = v.PostId AND p.Id = ph.PostId AND p.Score <= 192 AND p.Id = c.PostId AND u.Id = b.UserId AND u.Id = p.OwnerUserId | stats |
SELECT MIN(t.title) AS movie_title FROM company_name AS cn, keyword AS k, movie_companies AS mc, movie_keyword AS mk, title AS t WHERE mc.movie_id = t.id AND k.keyword ='character-name-in-title' AND mc.movie_id = mk.movie_id AND t.id = mk.movie_id AND cn.country_code ='[sm]' AND cn.id = mc.company_id AND mk.keyword_id ... | job |
select l_orderkey, sum(l_extendedprice * (1 - l_discount)) as revenue, o_orderdate, o_shippriority from customer, orders, lineitem where c_mktsegment = 1 and o_orderdate < DATE 1 and l_orderkey = o_orderkey and l_shipdate > DATE 1 and c_custkey = o_custkey 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 t.id = mi_idx.movie_id AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND it.info = 'top 250 r... | 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 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 n.id = pi.person_id And it.info = 'mini biography' And pi.note = 'Volker Boehm' And lt.id = ml.link_type_id And ci.mov... | 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.production_year > 2010 AND k.keyword = 'marvel-cinematic-universe' AND t.id = ci.movie_id AND n.name Like '%Hemsworth%Chris%' AND t.id = ... | job |
SELECT o_shippriority, l_orderkey, 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 c_mktsegment = 1 AND c_custkey = o_custkey AND l_orderkey = o_orderkey GROUP BY l_orderkey, o_orderdate, o_shippriority ORDER BY reven... | 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 t.id = mi_idx.movie_id AND it.id = mi_idx.info_type_id AND t.production_year >= 2000 AND t.production_year <= 2010 AND it.info ='rating' AND mi_idx.info > '7.0' | job |
SELECT MIN(mc.note) AS production_note, MIN(t.title) AS movie_title, MIN(t.production_year) AS movie_year FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info_idx AS mi_idx, title AS t WHERE t.id = mc.movie_id AND mc.movie_id = mi_idx.movie_id AND t.id = mi_idx.movie_id AND ct.id = mc.company_typ... | job |
SELECT AVG(l_quantity) AS avg_qty, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, AVG(l_extendedprice) AS avg_price, l_linestatus, l_returnflag, SUM(l_quantity) AS sum_qty, SUM(l_extendedprice) AS sum_base_price, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, AVG(l_discount) AS avg_dis... | 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 lt.link LIKE '%follow%' AND mc.note... | job |
SELECT s_acctbal, s_name, n_name, p_partkey, p_mfgr, s_address, s_phone, s_comment FROM part, supplier, partsupp, nation, region WHERE p_partkey = ps_partkey AND p_size = 1 AND s_nationkey = n_nationkey AND r_name = 1 AND p_type LIKE 1 AND s_suppkey = ps_suppkey AND ps_supplycost = ( SELECT MIN(ps_supplycost) FROM part... | tpch |
select count(*) from comments as c, posts as p, postLinks as pl, postHistory as ph, votes as v, users as u where p.PostTypeId = 1 and p.Id = c.PostId and p.Id = pl.PostId and p.AnswerCount >= 0 and p.Id = v.PostId and u.Id = p.OwnerUserId and p.Id = ph.PostId | stats |
SELECT COUNT(*) FROM comments AS c, posts AS p, postHistory AS ph, votes AS v, users AS u WHERE p.Score <= 13 AND ph.UserId = v.UserId AND u.Id = c.UserId AND c.UserId = p.OwnerUserId AND p.OwnerUserId = ph.UserId AND p.AnswerCount >= 0 LIMIT 500; | stats |
SELECT p_brand, p_type, p_size, COUNT(DISTINCT ps_suppkey) AS supplier_cnt FROM partsupp, part WHERE p_brand <> 1 AND NOT EXISTS (SELECT 1 FROM (SELECT s_suppkey FROM supplier WHERE s_comment LIKE '%Customer%Complaints%') AS _ne WHERE _ne.ps_suppkey = ps_suppkey) AND p_size IN (1, 1, 1, 1, 1, 1, 1, 1) AND p_partkey = p... | tpch |
SELECT AVG(ss_coupon_amt) AS agg3, AVG(ss_list_price) AS agg2, AVG(ss_sales_price) AS agg4, i_item_id, AVG(ss_quantity) AS agg1 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 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 count(*) from posts as p, postLinks as pl, users as u where p.Id = pl.PostId and p.OwnerUserId = u.Id and p.CommentCount <= 17 and u.CreationDate <= '2014-09-12 07:12:16'::timestamp limit 10 ) select * from _q; | stats |
SELECT c_name, c_address, c_comment, n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue, c_phone, c_custkey, c_acctbal FROM customer, orders, lineitem, nation WHERE c_custkey = o_custkey AND l_orderkey = o_orderkey AND o_orderdate >= DATE 1 AND o_orderdate < DATE 1 + INTERVAL '3' MONTH AND l_returnflag = 'R' AN... | tpch |
SELECT MIN(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 cn.country_code = '[us]' AND at.movie_id = mc.m... | job |
select count(1) from votes as v, posts as p, badges as b, users as u where u.Id = p.OwnerUserId and u.Id = b.UserId and p.Id = v.PostId and u.Reputation >= 1 and p.Score <= 22 | 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 mi.info in ('Sweden', 'Norway', 'Germany', 'Danish', 'Swedish', 'Danish', 'Norwegian', 'German') and t.production_year > 2010 and t.id = mk.movie_id and k.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 ci.movie_id = mc.movie_id AND t.episode_nr < 100 AND ci.movie_id = t.id AND n.id = ci.perso... | job |
select i_current_price, i_item_id, i_item_desc from item join inventory on i_item_sk = inv_item_sk join date_dim on d_date_sk = inv_date_sk join store_sales on ss_item_sk = i_item_sk where inv_quantity_on_hand between 100 and 500 and i_current_price between 73 and 73 + 30 and d_date between CAST('1998-01-15' as DATE) a... | 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 c_nationkey = n1.n_na... | tpch |
SELECT supp_nation, SUM(volume) AS revenue, cust_nation, l_year 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 o... | 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 ci.movie_id = mc.movie_id AND mc.company_id = cn.id AND mk.keyword_id = k.id AND ci.movie_i... | 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_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 Group By p_brand... | tpch |
with year_total as ( select d_year as dyear, c_email_address as customer_email_address, c_last_name as customer_last_name, c_login as customer_login, c_first_name as customer_first_name, 's' as sale_type, c_birth_country as customer_birth_country, sum(((ss_ext_list_price - ss_ext_wholesale_cost - ss_ext_discount_amt) +... | 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 it2.id = mi.info_type_id AND miidx.movie_id = t... | job |
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 |
Select Count(*) From comments As c, postHistory As ph, votes As v, users As u Where ph.UserId = c.UserId And v.UserId = ph.UserId And u.DownVotes >= 0 And u.Id = v.UserId And u.UpVotes <= 123 And u.Views >= 0 | stats |
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 cc_call_center_id as call_center, cc_name as call_center_name, cc_manager as manager, 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(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.country_code ='[de]' AND cn.id = mc.company_id AND k.keyword ='character-name-in-title' AND mk.keyword_id = k.id AND mc.movie_id = t.id AND mc.movie_id = mk.mo... | job |
SELECT MIN(n.name) AS of_person, MIN(t.title) AS biography_movie FROM aka_name AS an, cast_info AS ci, info_type AS it, link_type AS lt, movie_link AS ml, name AS n, person_info AS pi, title AS t WHERE an.person_id = ci.person_id AND pi.note = 'Volker Boehm' AND it.info = 'mini biography' AND n.id = an.person_id AND ml... | job |
select count(*) from postHistory as ph, posts as p, users as u, badges as b where p.OwnerUserId = u.Id and p.Score >= -7 and ph.UserId = u.Id and ph.PostHistoryTypeId = 3 and u.Id = b.UserId and u.Reputation >= 1 limit 50; | stats |
SELECT STDDEV_SAMP(cs_quantity) / AVG(cs_quantity) AS catalog_sales_quantitycov, i_item_id, AVG(cs_quantity) AS catalog_sales_quantityave, AVG(sr_return_quantity) AS store_returns_quantityave, STDDEV_SAMP(ss_quantity) / AVG(ss_quantity) AS store_sales_quantitycov, COUNT(sr_return_quantity) AS store_returns_quantitycoun... | 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, badges AS b, users AS u WHERE p.Id = v.PostId AND p.Id = c.PostId AND p.Id = ph.PostId AND p.Score <= 40 AND p.Id = pl.RelatedPostId AND pl.LinkTypeId = 1 AND b.UserId = u.Id AND c.UserId = u.Id | stats |
select count(*) from comments as c, posts as p, postLinks as pl, postHistory as ph, votes as v, users as u where u.Id = p.OwnerUserId and p.Id = c.PostId and p.PostTypeId = 1 and p.AnswerCount >= 0 and p.Id = pl.PostId and p.Id = ph.PostId and p.Id = v.PostId | 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 pi.person_id = ci.person_id AND pi.note = 'Volker Boehm' AND it.info = 'mini biography' AND an.name LIKE '%a%' AND ml.... | 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 LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%') AND t.id = ... | 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.Score <= 40 AND p.Id = v.PostId AND c.UserId = u.Id AND b.UserId = u.Id AND p.Id = ph.PostId AND p.Id = pl.RelatedPostId AND pl.LinkTypeId = 1 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 k.keyword LIKE '%sequel%' AND k.id = mk.keyword_id AND mk.movie_id = mi.movie_id AND t.production_year > 2005 AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Denish', 'Norwegian', 'German'... | job |
SELECT p_size, p_brand, p_type, COUNT(DISTINCT ps_suppkey) AS supplier_cnt FROM partsupp, part WHERE ps_suppkey NOT IN ( SELECT s_suppkey FROM supplier WHERE s_comment LIKE '%Customer%Complaints%' ) AND p_brand <> 1 AND p_size IN (1, 1, 1, 1, 1, 1, 1, 1) AND p_type NOT LIKE 1 AND p_partkey = ps_partkey GROUP BY p_brand... | tpch |
select min(t.title) as japanese_anime_movie, min(an.name) as acress_pseudonym 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.person_id = an.person_id AND ci.note like '%(voice: Englis... | 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 t.id = mc.movie_id AND it.info = 'bottom 10 rank' AND mc.movie_id = mi.movie_id AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND ct.id = mc.company_type_id AND ct.kind ... | 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 cn.id = mc.company_id and mi_idx.movie_id = mc.movie_id and t.id = mi.... | 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 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 INNER JOIN store_sales ON d_date_sk = ss_sold_date_sk INNER JOIN item ON ss_item_sk = i_item_sk INNER JOIN customer ON ss_customer_sk = c_customer_sk INNER JOIN customer_address ON c_current_ad... | tpcds |
SELECT AVG(ss_coupon_amt) AS agg3, AVG(ss_quantity) AS agg1, i_item_id, AVG(ss_list_price) AS agg2, AVG(ss_sales_price) AS agg4 FROM store_sales JOIN customer_demographics ON ss_cdemo_sk = cd_demo_sk JOIN date_dim ON ss_sold_date_sk = d_date_sk JOIN item ON ss_item_sk = i_item_sk JOIN promotion ON ss_promo_sk = p_promo... | tpcds |
SELECT MIN(t.title) AS movie_title FROM company_name AS cn, keyword AS k, movie_companies AS mc, movie_keyword AS mk, title AS t WHERE mc.movie_id = mk.movie_id AND mk.keyword_id = k.id AND cn.id = mc.company_id AND mc.movie_id = t.id AND t.id = mk.movie_id AND cn.country_code ='[sm]' AND k.keyword ='character-name-in-... | job |
SELECT MIN(cn.name) AS movie_company, MIN(mi_idx.info) AS rating, MIN(t.title) AS western_violent_movie FROM company_name AS cn, company_type AS ct, info_type AS it1, info_type AS it2, keyword AS k, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS mi_idx, movie_keyword AS mk, title AS t WHERE... | job |
SELECT MIN(k.keyword) AS movie_keyword, MIN(n.name) AS actor_name, MIN(t.title) AS marvel_movie FROM cast_info AS ci, keyword AS k, movie_keyword AS mk, name AS n, title AS t WHERE n.id = ci.person_id AND t.production_year > 2010 AND t.id = mk.movie_id AND ci.movie_id = mk.movie_id AND k.id = mk.keyword_id AND t.id = c... | job |
SELECT MIN(t.title) AS movie_title FROM company_name AS cn, keyword AS k, movie_companies AS mc, movie_keyword AS mk, title AS t WHERE mc.movie_id = mk.movie_id AND mk.keyword_id = k.id AND t.id = mk.movie_id AND cn.id = mc.company_id AND mc.movie_id = t.id AND cn.country_code ='[de]' AND k.keyword ='character-name-in-... | job |
SELECT i_item_id, AVG(ss_quantity) AS agg1, AVG(ss_list_price) AS agg2, AVG(ss_sales_price) AS agg4, AVG(ss_coupon_amt) AS agg3 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 a.ca_state AS state, COUNT(1) AS cnt FROM customer_address AS a JOIN customer AS c ON a.ca_address_sk = c.c_current_addr_sk JOIN store_sales AS s ON c.c_customer_sk = s.ss_customer_sk JOIN date_dim AS d ON s.ss_sold_date_sk = d.d_date_sk JOIN item AS i ON s.ss_item_sk = i.i_item_sk WHERE d.d_month_seq = ( SELECT... | 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 l_orderkey, Sum(l_extendedprice * (1 - l_discount)) As revenue, o_orderdate, o_shippriority From customer, orders, lineitem Where o_orderdate < DATE 1 AND l_shipdate > DATE 1 AND l_orderkey = o_orderkey AND c_mktsegment = 1 AND c_custkey = o_custkey Group By l_orderkey, o_orderdate, o_shippriority Order By reven... | tpch |
SELECT MAX(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', 'Danish', 'Norwegian', 'German') AND t.id = mk.movie_id AND t.id = mi.movie_id AND k.keyword LIKE '%sequel%' AND t.production_year > 2000 AND k.i... | job |
select sum(l_extendedprice * l_discount) as revenue from lineitem where l_shipdate < DATE 1 + INTERVAL '1' YEAR AND l_shipdate >= DATE 1 AND l_quantity < 1 AND l_discount BETWEEN 1 - 0.01 AND 1 + 0.01 limit 500; | tpch |
Select MAX(cn.name) As movie_company, MAX(mi_idx.info) As rating, MAX(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(k.keyword) AS movie_keyword, MIN(n.name) AS actor_name, MIN(t.title) AS marvel_movie FROM cast_info AS ci, keyword AS k, movie_keyword AS mk, name AS n, title AS t WHERE n.name LIKE '%Downey%Robert%' AND t.production_year > 2010 AND n.id = ci.person_id AND t.id = ci.movie_id AND k.id = mk.keyword_id AND ci.m... | job |
SELECT s_store_name, s_store_id, SUM(sr_return_quantity) AS store_returns_quantity, SUM(cs_quantity) AS catalog_sales_quantity, i_item_desc, i_item_id, SUM(ss_quantity) AS store_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(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 mi.info = ANY(ARRAY['Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Danish', 'Norwegian', 'German']) AND t.id = mk.movie_i... | job |
Select Min(k.keyword) As movie_keyword, Min(n.name) As actor_name, Min(t.title) As marvel_movie From cast_info As ci, keyword As k, movie_keyword As mk, name As n, title As t Where n.name Like '%Hemsworth%Chris%' And k.keyword = 'marvel-cinematic-universe' And t.production_year > 2010 And n.id = ci.person_id And ci.mov... | job |
select l_orderkey, sum(l_extendedprice * (1 - l_discount)) as revenue, o_orderdate, o_shippriority from customer, orders, lineitem where l_orderkey = o_orderkey and l_shipdate > DATE 1 and c_mktsegment = 1 and c_custkey = o_custkey and o_orderdate < DATE 1 group by l_orderkey, o_orderdate, o_shippriority order by reven... | tpch |
SELECT MIN(n.name) AS of_person, MIN(t.title) AS biography_movie FROM aka_name AS an, cast_info AS ci, info_type AS it, link_type AS lt, movie_link AS ml, name AS n, person_info AS pi, title AS t WHERE n.id = an.person_id AND n.id = pi.person_id AND it.info = 'mini biography' AND (n.gender = 'm' OR (n.gender = 'f' AND ... | job |
SELECT AVG(l_discount) AS avg_disc, SUM(l_extendedprice) AS sum_base_price, AVG(l_extendedprice) AS avg_price, l_returnflag, SUM(l_quantity) AS sum_qty, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, COUNT(*) AS count_order, l_linestatus, ... | tpch |
SELECT i_item_id, i_item_desc, s_store_id, s_store_name, MAX(ss_net_profit) AS store_sales_profit, MAX(sr_net_loss) AS store_returns_loss, MAX(cs_net_profit) AS catalog_sales_profit FROM store_sales JOIN store_returns ON store_sales.ss_customer_sk = store_returns.sr_customer_sk AND store_sales.ss_item_sk = store_return... | tpcds |
select i_item_id, avg(cs_coupon_amt) as agg3, avg(cs_quantity) as agg1, avg(cs_list_price) as agg2, avg(cs_sales_price) as agg4 from catalog_sales join customer_demographics on cs_bill_cdemo_sk = cd_demo_sk join date_dim on cs_sold_date_sk = d_date_sk join item on cs_item_sk = i_item_sk join promotion on cs_promo_sk = ... | tpcds |
SELECT i_item_desc, COUNT(ss_quantity) AS store_sales_quantitycount, AVG(cs_quantity) AS catalog_sales_quantityave, AVG(sr_return_quantity) AS store_returns_quantityave, STDDEV_SAMP(sr_return_quantity) / AVG(sr_return_quantity) AS store_returns_quantitycov, i_item_id, STDDEV_SAMP(ss_quantity) AS store_sales_quantitystd... | tpcds |
WITH _q AS ( SELECT SUM(l_extendedprice) / 7.0 AS avg_yearly FROM lineitem, part WHERE p_partkey = l_partkey AND p_brand = 1 AND p_container = 1 AND l_quantity < ( SELECT 0.2 * AVG(l_quantity) FROM lineitem WHERE l_partkey = p_partkey ) ) SELECT * FROM _q; | tpch |
SELECT c_custkey, c_name, o_totalprice, o_orderdate, SUM(l_quantity), o_orderkey 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 s_name, Count(*) As numwait From supplier, lineitem l1, orders, nation Where s_suppkey = l1.l_suppkey AND Exists ( Select * From lineitem l2 Where l2.l_orderkey = l1.l_orderkey And l2.l_suppkey <> l1.l_suppkey ) AND o_orderkey = l1.l_orderkey AND l1.l_receiptdate > l1.l_commitdate AND n_name = 1 AND Not Exists (... | 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_after, i_item_id, w_state, 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 ... | tpcds |
SELECT MIN(k.keyword) AS movie_keyword, MIN(n.name) AS actor_name, MIN(t.title) AS marvel_movie FROM cast_info AS ci, keyword AS k, movie_keyword AS mk, name AS n, title AS t WHERE t.id = ci.movie_id AND ci.movie_id = mk.movie_id AND n.id = ci.person_id AND t.production_year > 2010 AND k.id = mk.keyword_id AND n.name L... | job |
SELECT extended_price, ss_ticket_number, list_price, c_first_name, c_last_name, extended_tax, ca_city, bought_city FROM ( SELECT ss_ticket_number, ss_customer_sk, ca_city AS bought_city, SUM(ss_ext_sales_price) AS extended_price, SUM(ss_ext_list_price) AS list_price, SUM(ss_ext_tax) AS extended_tax FROM store_sales JOI... | tpcds |
SELECT MIN(t.title) AS movie_title, MIN(t.production_year) AS movie_year, MIN(mc.note) AS production_note 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 mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pic... | job |
SELECT p_partkey, p_mfgr, n_name, s_address, s_comment, s_phone, s_acctbal, s_name FROM part, supplier, partsupp, nation, region WHERE p_partkey = ps_partkey AND s_suppkey = ps_suppkey AND p_size = 1 AND p_type LIKE 1 AND s_nationkey = n_nationkey AND n_regionkey = r_regionkey AND r_name = 1 AND ps_supplycost = ( SELEC... | tpch |
select 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 k.id = mk.keyword_id and mk.movie_id = mi.movie_id and mi.info in ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Denish', 'Norwegian', 'German') and t... | 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 cn.id = mc.company_id AND cn.country_code ='[nl]' AND mc.movie_id = t.id AND mk.keyword_id = k.id AND mc.movie_id = mk.movie_id AND t.id = mk.mo... | 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 mk.movie_id = mc.movie_id AND mc.note LIKE '%(Japan)%' AND mk... | 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 rt.id = ci.role_id AND rt.role = 'actor' AND t.id = mc.movie_id AND t.i... | job |
SELECT MIN(mc.note) AS production_note, MIN(t.title) AS movie_title, MIN(t.production_year) AS movie_year FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info_idx AS mi_idx, title AS t WHERE mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND t.id = mc.movie_id AND t.id = mi_idx.movie_id A... | job |
SELECT COUNT(DISTINCT ps_suppkey) AS supplier_cnt, p_type, p_brand, p_size 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.