text stringlengths 84 1.49k | benchmark stringclasses 4
values |
|---|---|
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(mi_idx.info) AS rating, MIN(t.title) AS northamerican_movie FROM aka_title AS at, company_name AS cn, info_type AS it1, info_type AS it2, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS mi_idx, title AS t WHERE kt.kind = 'movie' AND at.movie_id = mi.movie_id AND at.title LIKE '%Ch... | job |
SELECT AVG(l_discount) AS avg_disc, l_linestatus, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, SUM(l_quantity) AS sum_qty, SUM(l_extendedprice) AS sum_base_price, AVG(l_quantity) AS avg_qty, AVG(l_extendedprice) AS avg_price, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, l_returnfla... | tpch |
SELECT MIN(an1.name) AS actress_pseudonym, MIN(t.title) AS japanese_movie_dubbed FROM aka_name AS an1, cast_info AS ci, company_name AS cn, movie_companies AS mc, name AS n1, role_type AS rt, title AS t WHERE n1.name LIKE '%Yo%' AND ci.movie_id = mc.movie_id AND ci.role_id = rt.id AND cn.country_code = '[jp]' AND an1.p... | job |
SELECT COUNT(1) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v, badges AS b WHERE pl.LinkTypeId = 1 AND p.Id = c.PostId AND b.UserId = c.UserId AND c.Score = 0 AND p.Id = pl.RelatedPostId AND p.Id = ph.PostId AND p.Id = v.PostId | stats |
select COUNT(1) from votes as v, posts as p, badges as b, users as u where p.Score <= 22 AND u.Id = p.OwnerUserId AND u.Id = b.UserId AND u.Reputation >= 1 AND p.Id = v.PostId | stats |
SELECT s_name, COUNT(1) AS numwait FROM supplier, lineitem l1, orders, nation WHERE s_suppkey = l1.l_suppkey AND o_orderkey = l1.l_orderkey AND o_orderstatus = 'F' AND l1.l_receiptdate > l1.l_commitdate AND EXISTS ( SELECT * FROM lineitem l2 WHERE l2.l_orderkey = l1.l_orderkey AND l2.l_suppkey != l1.l_suppkey ) AND NOT... | tpch |
SELECT extended_tax, bought_city, ca_city, extended_price, c_first_name, ss_ticket_number, c_last_name, list_price FROM ( SELECT ss_ticket_number, ss_customer_sk, ca_city AS bought_city, SUM(ss_ext_sales_price) AS extended_price, SUM(ss_ext_list_price) AS list_price, SUM(ss_ext_tax) AS extended_tax FROM store_sales JOI... | tpcds |
SELECT s_comment, s_address, n_name, s_name, s_phone, p_partkey, p_mfgr, s_acctbal FROM part, supplier, partsupp, nation, region WHERE p_type LIKE 1 AND s_nationkey = n_nationkey AND n_regionkey = r_regionkey AND r_name = 1 AND p_partkey = ps_partkey AND ps_supplycost = ( SELECT MIN(ps_supplycost) FROM partsupp, suppli... | tpch |
SELECT s_acctbal, s_name, n_name, p_partkey, p_mfgr, s_address, s_phone, s_comment FROM part, supplier, partsupp, nation, region WHERE p_type LIKE 1 AND p_size = 1 AND r_name = 1 AND s_suppkey = ps_suppkey AND s_nationkey = n_nationkey AND n_regionkey = r_regionkey AND p_partkey = ps_partkey AND ps_supplycost = ( SELEC... | tpch |
SELECT MIN(mc.note) AS production_note, MIN(t.title) AS movie_title, MIN(t.production_year) AS movie_year FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info_idx AS mi_idx, title AS t WHERE it.info = 'top 250 rank' AND ct.id = mc.company_type_id AND it.id = mi_idx.info_type_id AND mc.movie_id = ... | job |
SELECT MIN(cn.name) AS from_company, MIN(t.title) AS western_sequel, MIN(lt.link) AS link_type FROM company_name AS cn, company_type AS ct, info_type AS it, keyword AS k, link_type AS lt, movie_companies AS mc, movie_info AS mi, movie_keyword AS mk, movie_link AS ml, title AS t WHERE ml.movie_id = mc.movie_id AND cn.co... | 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 = mk.movie_id AND k.id = mk.keyword_id AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Danish', 'Swedish', 'Danish', 'Norwegian', 'German') AND k.keyword LIKE '%sequel%' AND t.production_year > 2010 AND mk... | job |
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', 'Danish', 'Norwegian', 'German') AND t.id = mi.movie_id AND t.production_year > 2000 AND k.id = mk.keyword_id AND k.keyword Like '%sequel%' AND t... | job |
SELECT i_item_id, COUNT(sr_return_quantity) AS store_returns_quantitycount, STDDEV_SAMP(ss_quantity) AS store_sales_quantitystdev, AVG(ss_quantity) AS store_sales_quantityave, COUNT(cs_quantity) AS catalog_sales_quantitycount, i_item_desc, COUNT(ss_quantity) AS store_sales_quantitycount, AVG(sr_return_quantity) AS stor... | tpcds |
SELECT MIN(t.title) AS voiced_movie, MIN(n.name) AS voicing_actress 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 ci.movie_id = mc.movie_id AND t.id = mc.movi... | job |
SELECT n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, supplier, nation, region WHERE c_custkey = o_custkey AND o_orderdate < DATE 1 + INTERVAL '1' YEAR AND s_nationkey = n_nationkey AND l_suppkey = s_suppkey AND o_orderdate >= DATE 1 AND n_regionkey = r_regionkey AND l_order... | 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 mk.keyword_id = k.id AND mc.movie_id = t.id AND t.id = mk.movie_id AND mc.movie_id = mk.movie_id AND cn.country_code ='[sm]' AND cn.id = mc.company_id AND k.keyword ='character-name-in-... | 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 t.id = mc.movie_id AND ct.kind = 'production companies' AND it.id = mi_idx.in... | job |
SELECT s_name, COUNT(DISTINCT s_name) AS numwait FROM supplier, lineitem l1, orders, nation WHERE 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 n_name = 1 AND l1.l_receiptdate > l1.l... | 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 l_orderkey = o_orderk... | 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 s_suppkey = l_suppkey... | tpch |
select min(n.name) as voicing_actress, min(t.title) as voiced_movie from aka_name as an, char_name as chn, cast_info as ci, company_name as cn, info_type as it, movie_companies as mc, movie_info as mi, name as n, role_type as rt, title as t where it.info = 'release dates' AND rt.role = 'actress' AND t.id = mc.movie_id ... | job |
SELECT COUNT(*) AS count_order, AVG(l_discount) AS avg_disc, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, l_returnflag, SUM(l_quantity) AS sum_qty, AVG(l_quantity) AS avg_qty, l_linestatus, AVG(l_extendedprice) AS avg_price, SUM(l_extendedprice) AS sum_base_price, SUM(l_extendedprice * (1 - l_discount) * ... | tpch |
SELECT l_orderkey, o_shippriority, SUM(l_extendedprice * (1 - l_discount)) AS revenue, o_orderdate FROM customer, orders, lineitem WHERE l_shipdate > DATE 1 AND c_custkey = o_custkey AND l_orderkey = o_orderkey AND o_orderdate < DATE 1 AND c_mktsegment = 1 GROUP BY l_orderkey, o_orderdate, o_shippriority ORDER BY reven... | tpch |
select count(*) from votes as v, posts as p, badges as b, users as u where p.Id = v.PostId AND u.Reputation >= 1 AND u.Id = b.UserId AND u.Id = p.OwnerUserId AND p.Score <= 22 | 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 r_name = 1 AND s_nati... | tpch |
SELECT p_partkey, s_acctbal, p_mfgr, s_name, s_comment, s_phone, s_address, n_name FROM part, supplier, partsupp, nation, region WHERE p_partkey = ps_partkey AND s_suppkey = ps_suppkey AND p_size = 1 AND p_type LIKE 1 AND s_nationkey = n_nationkey AND n_regionkey = r_regionkey AND r_name = 1 AND ps_supplycost = ( SELEC... | tpch |
SELECT 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 t.id = mc.movie_id AND t.episode_nr >= 50 AND k.keyword = 'character-name-in-title' AND cn.... | job |
SELECT SUM(l_quantity) AS sum_qty, l_returnflag, l_linestatus, COUNT(*) AS count_order, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, AVG(l_quantity) AS avg_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_disc, AVG(l_e... | tpch |
SELECT s_name, COUNT(DISTINCT s_name) AS numwait FROM supplier, lineitem l1, orders, nation WHERE n_name = 1 AND l1.l_receiptdate > l1.l_commitdate AND EXISTS ( SELECT * FROM lineitem l2 WHERE l2.l_orderkey = l1.l_orderkey AND l2.l_suppkey <> l1.l_suppkey ) AND s_nationkey = n_nationkey AND NOT EXISTS ( SELECT * FROM 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 mi.info LIKE 'USA:% 199%' AND t.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 mc.movie_id = t.id AND mk.keyword_id = k.id AND cn.country_code ='[nl]' AND t.id = mk.movie_id AND mc.movie_id = mk.movie_id AND k.keyword ='character-name-in-title' AND cn.id = mc.comp... | job |
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 it.info = 'rating' AND mi.movie_id = mc.movie_i... | 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 an1.person_id = n1.id AND ci.role_id = rt.id AND mc.company_id = cn.id AND t.id = mc.movie_id AND mc.note Like ... | job |
Select Min(k.keyword) As movie_keyword, Min(n.name) As actor_name, Min(t.title) As marvel_movie From cast_info As ci, keyword As k, movie_keyword As mk, name As n, title As t Where n.name Like '%Downey%Robert%' And k.id = mk.keyword_id And n.id = ci.person_id And t.id = mk.movie_id And ci.movie_id = mk.movie_id And t.i... | 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 o_orderkey = l... | 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.note NOT LIKE '%(AS Metro-Goldwyn-Mayer Pictures)%' AND ct.kind = 'production companies' AND it.info = ... | job |
SELECT s_store_id, i_item_desc, i_item_id, SUM(cs_quantity) AS catalog_sales_quantity, SUM(ss_quantity) AS store_sales_quantity, s_store_name, SUM(sr_return_quantity) AS store_returns_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 s_acctbal, s_name, n_name, p_partkey, p_mfgr, s_address, s_phone, s_comment FROM part, supplier, partsupp, nation, region WHERE p_type LIKE 1 AND ps_supplycost = ( SELECT MIN(ps_supplycost) FROM partsupp, supplier, nation, region WHERE p_partkey = ps_partkey AND s_suppkey = ps_suppkey AND s_nationkey = n_nationk... | tpch |
SELECT ss_ticket_number, c_first_name, c_last_name, extended_price, extended_tax, list_price, bought_city, ca_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 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 = t.id and k.keyword ='character-name-in-title' and cn.country_code ='[nl]' and mk.keyword_id = k.id and mc.movie_id = mk.mo... | job |
SELECT i_item_id, STDDEV_SAMP(ss_quantity) AS store_sales_quantitystdev, AVG(sr_return_quantity) AS store_returns_quantityave, COUNT(sr_return_quantity) AS store_returns_quantitycount, i_item_desc, AVG(ss_quantity) AS store_sales_quantityave, STDDEV_SAMP(ss_quantity) / AVG(ss_quantity) AS store_sales_quantitycov, COUNT... | tpcds |
SELECT o_shippriority, o_orderdate, SUM(l_extendedprice * (1 - l_discount)) AS revenue, l_orderkey FROM customer, orders, lineitem WHERE l_shipdate > DATE 1 AND c_mktsegment = 1 AND c_custkey = o_custkey AND l_orderkey = o_orderkey AND o_orderdate < DATE 1 GROUP BY l_orderkey, o_orderdate, o_shippriority ORDER BY reven... | 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 n.id = ci.person_id AND t.id = mk.movie_id AND ci.movie_id = t.id AND ci.movie_id = mk.movi... | job |
SELECT c_address, n_name, c_acctbal, c_custkey, SUM(l_extendedprice * (1 - l_discount)) AS revenue, c_phone, c_comment, c_name FROM customer, orders, lineitem, nation WHERE c_custkey = o_custkey AND l_orderkey = o_orderkey AND o_orderdate >= DATE 1 AND o_orderdate < DATE 1 + INTERVAL '3' MONTH AND l_returnflag = 'R' AN... | tpch |
SELECT MIN(t.title) AS 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 mi.info LIKE 'USA:%200%' AND it1.info = 'rating' AND at.movie_id = mi.... | job |
select sum(ss_ext_wholesale_cost), avg(ss_quantity), avg(ss_ext_wholesale_cost), avg(ss_ext_sales_price) 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 c_comment, SUM(l_extendedprice * (1 - l_discount)) AS revenue, c_acctbal, c_custkey, c_name, n_name, c_phone, c_address 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 c_last_name, c_salutation, ss_ticket_number, cnt, c_first_name, c_preferred_cust_flag 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_quantity), o_orderkey, c_custkey, c_name, o_totalprice, o_orderdate From customer, orders, lineitem Where o_orderkey In ( Select l_orderkey From lineitem Group By l_orderkey Having Sum(l_quantity) > 1 ) And c_custkey = o_custkey And o_orderkey = l_orderkey Group By c_name, c_custkey, o_orderkey, o_orderdat... | tpch |
SELECT SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, AVG(l_discount) AS avg_disc, l_returnflag, SUM(l_extendedprice) AS sum_base_price, AVG(l_quantity) AS avg_qty, COUNT(*) AS count_order, SUM(l_quantity) AS sum_qty, l_linestatus, AVG(l_e... | 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 ct.id = mc.company_type_id AND (mc.note LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%') AND mc.no... | job |
Select i_current_price, i_item_desc, i_item_id From item Join inventory On i_item_sk = inv_item_sk Join date_dim On d_date_sk = inv_date_sk Join catalog_sales On cs_item_sk = i_item_sk Where inv_quantity_on_hand BETWEEN 100 AND 500 AND d_date BETWEEN CAST('2000-05-01' As DATE) AND (CAST('2000-05-01' As DATE) + INTERVAL... | tpcds |
SELECT COUNT(1) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v WHERE pl.LinkTypeId = 1 AND p.Id = v.PostId AND c.Score = 0 AND p.Id = c.PostId AND p.FavoriteCount >= 0 AND p.Id = ph.PostId AND p.Id = pl.PostId | stats |
select o_totalprice, o_orderdate, c_name, o_orderkey, sum(l_quantity), c_custkey 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 COUNT(*) FROM postHistory AS ph, posts AS p, votes AS v, badges AS b, users AS u, comments AS c WHERE u.Id = p.OwnerUserId AND p.Id = v.PostId AND u.Id = b.UserId AND p.Score <= 192 AND p.ViewCount >= 0 AND p.Id = ph.PostId AND p.Id = c.PostId LIMIT 50; | stats |
SELECT MIN(mi_idx.info) AS rating, MIN(t.title) AS northamerican_movie FROM aka_title AS at, company_name AS cn, info_type AS it1, info_type AS it2, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS mi_idx, title AS t WHERE mi_idx.info < '3.5' AND it1.id = mi_idx.info_type_id AND cn.country_co... | 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 cn.id = mc.company_id AND ci.person_id = an.person_id AND cn.... | job |
SELECT promotions, total, CAST(promotions AS DECIMAL(15, 4)) / CAST(total AS DECIMAL(15, 4)) * 100 FROM ( SELECT SUM(ss_ext_sales_price) AS promotions FROM store_sales JOIN store ON ss_store_sk = s_store_sk JOIN promotion ON ss_promo_sk = p_promo_sk JOIN date_dim ON ss_sold_date_sk = d_date_sk JOIN customer ON ss_custo... | tpcds |
Select i_item_id, i_item_desc, i_current_price From item Join inventory On i_item_sk = inv_item_sk Join date_dim On d_date_sk = inv_date_sk Join store_sales On ss_item_sk = i_item_sk Where i_manufact_id In (301, 227, 392, 436) And i_current_price Between 93 And 93 + 30 And inv_quantity_on_hand Between 100 And 500 And d... | tpcds |
SELECT i_item_id, AVG(ss_sales_price) AS agg4, AVG(ss_list_price) AS agg2, AVG(ss_coupon_amt) AS agg3, 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 c_custkey, c_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue, c_acctbal, n_name, c_address, c_phone, c_comment FROM customer, orders, lineitem, nation WHERE c_nationkey = n_nationkey AND o_orderdate < DATE 1 + INTERVAL '3' MONTH AND l_orderkey = o_orderkey AND l_returnflag = 'R' AND o_orderdate >= DATE ... | tpch |
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 = mc.movie_id AND ct.kind = 'production companies' AND (mc.note LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%... | 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 t.production_year > 2000 and at.movie_id = mi_idx.movie_id and kt.id =... | job |
SELECT COUNT(*) FROM comments AS c, postHistory AS ph, badges AS b, votes AS v, users AS u WHERE ph.UserId = v.UserId AND b.UserId = ph.UserId AND u.UpVotes = 0 AND ph.PostHistoryTypeId = 12 AND v.UserId = c.UserId AND u.Id = b.UserId LIMIT 1000; | stats |
SELECT MIN(t.production_year) AS movie_year, MIN(t.title) AS movie_title, 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.id = mc.company_type_id AND it.id = mi_idx.info_type_id AND (mc.note LIKE '%(co-production)%' OR mc.not... | job |
SELECT COUNT(1) 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 = c.PostId AND p.Id = v.PostId AND p.Id = pl.RelatedPostId AND b.UserId = c.UserId AND p.Id = ph.PostId AND pl.LinkTypeId = 1 | stats |
SELECT s_store_id, s_store_name, i_item_desc, SUM(ss_quantity) AS store_sales_quantity, SUM(sr_return_quantity) AS store_returns_quantity, SUM(cs_quantity) AS catalog_sales_quantity, i_item_id 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 n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, supplier, nation, region WHERE r_name = 1 AND l_suppkey = s_suppkey AND c_custkey = o_custkey AND l_orderkey = o_orderkey AND c_nationkey = s_nationkey AND o_orderdate < DATE 1 + INTERVAL '1' YEAR AND n_regionkey = r_regi... | tpch |
SELECT SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, SUM(l_extendedprice) AS sum_base_price, SUM(l_quantity) AS sum_qty, COUNT(*) AS count_order, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, AVG(l_extendedprice) AS avg_price, l_returnflag, AVG(l_quantity) AS avg_qty, AVG(l_discount)... | tpch |
SELECT MIN(k.keyword) AS movie_keyword, MIN(t.title) AS marvel_movie, MIN(n.name) AS actor_name FROM cast_info AS ci, keyword AS k, movie_keyword AS mk, name AS n, title AS t WHERE k.keyword = 'marvel-cinematic-universe' AND n.id = ci.person_id AND k.id = mk.keyword_id AND t.production_year > 2010 AND ci.movie_id = mk.... | job |
SELECT MIN(k.keyword) AS movie_keyword, MIN(n.name) AS actor_name, MIN(t.title) AS marvel_movie FROM cast_info AS ci, keyword AS k, movie_keyword AS mk, name AS n, title AS t WHERE k.keyword = 'marvel-cinematic-universe' AND t.production_year > 2010 AND n.name LIKE '%Hemsworth%Chris%' AND t.id = mk.movie_id AND k.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 mc.movie_id = t.id AND cn.id = mc.company_id AND mc.movie_id = mk.movie_id AND cn.country_code ='[nl]' AND t.id = mk.movie_id AND k.keyword ='character-name-in-title' AND mk.keyword_id ... | job |
WITH _q AS ( SELECT i_brand_id AS brand_id, i_brand AS brand, SUM(ss_ext_sales_price) AS ext_price FROM date_dim JOIN store_sales ON d_date_sk = ss_sold_date_sk JOIN item ON ss_item_sk = i_item_sk WHERE i_manager_id = 84 AND d_moy = 11 AND d_year = 2000 GROUP BY i_brand, i_brand_id ORDER BY ext_price ASC, brand_id ) SE... | tpcds |
SELECT MIN(mc.note) AS production_note, MIN(t.title) AS movie_title, MIN(t.production_year) AS movie_year FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info_idx AS mi_idx, title AS t WHERE t.id = mi_idx.movie_id AND it.info = 'top 250 rank' AND ct.id = mc.company_type_id AND t.id = mc.movie_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 ct.kind = 'production companies' AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND it.id = mi... | job |
SELECT c_last_name, c_salutation, ss_ticket_number, c_preferred_cust_flag, cnt, c_first_name 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 c_acctbal, c_phone, c_custkey, c_name, c_comment, c_address, n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, nation WHERE o_orderdate < DATE 1 + INTERVAL '3' MONTH AND l_orderkey = o_orderkey AND c_custkey = o_custkey AND c_nationkey = n_nationkey AND l_returnflag = 'R... | tpch |
SELECT n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, supplier, nation, region WHERE l_orderkey = o_orderkey AND n_regionkey = r_regionkey AND r_name = 1 AND c_nationkey = s_nationkey AND o_orderdate < DATE 1 + INTERVAL '1' YEAR AND o_orderdate >= DATE 1 AND s_nationkey = n_... | tpch |
SELECT MAX(sr_net_loss) AS store_returns_loss, s_store_name, MAX(ss_net_profit) AS store_sales_profit, MAX(cs_net_profit) AS catalog_sales_profit, i_item_id, s_store_id, i_item_desc FROM store_sales JOIN store_returns ON store_sales.ss_customer_sk = store_returns.sr_customer_sk AND store_sales.ss_item_sk = store_return... | tpcds |
SELECT s_store_id, s_store_name, i_item_id, SUM(sr_return_quantity) AS store_returns_quantity, i_item_desc, SUM(cs_quantity) AS catalog_sales_quantity, 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(an.name) AS acress_pseudonym, MIN(t.title) AS japanese_anime_movie FROM aka_name AS an, cast_info AS ci, company_name AS cn, company_type AS ct, keyword AS k, movie_companies AS mc, movie_keyword AS mk, name AS n, role_type AS rt, title AS t WHERE mc.note NOT LIKE '%(USA)%' AND rt.role = 'actress' AND ci.rol... | 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 o_orderkey = l... | tpch |
SELECT s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE s_nationkey = n_nationkey AND l1.l_receiptdate > l1.l_commitdate AND EXISTS ( SELECT * FROM lineitem l2 WHERE l2.l_orderkey = l1.l_orderkey AND l2.l_suppkey <> l1.l_suppkey ) AND o_orderkey = l1.l_orderkey AND s_suppkey = l1.l_suppkey A... | tpch |
SELECT MIN(n.name) AS voicing_actress, MIN(t.title) AS voiced_movie FROM aka_name AS an, char_name AS chn, cast_info AS ci, company_name AS cn, info_type AS it, movie_companies AS mc, movie_info AS mi, name AS n, role_type AS rt, title AS t WHERE ci.person_id = an.person_id AND t.id = mi.movie_id AND cn.id = mc.company... | job |
select max(t.title) as japanese_anime_movie, max(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 n.id = ci.person_id and cn.id = mc.company_id and ci.note lik... | 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 mi.movie_id = mc.movie_id AND ct.kind = 'produc... | job |
SELECT n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, supplier, nation, region WHERE c_custkey = o_custkey AND l_orderkey = o_orderkey AND s_nationkey = n_nationkey AND c_nationkey = s_nationkey AND o_orderdate >= DATE 1 AND r_name = 1 AND n_regionkey = r_regionkey AND l_sup... | 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 it.info = 'rating' AND mi.movie_id = miidx.movi... | job |
Select Min(k.keyword) As movie_keyword, Min(n.name) As actor_name, Min(t.title) As marvel_movie From cast_info As ci, keyword As k, movie_keyword As mk, name As n, title As t Where t.id = mk.movie_id And n.id = ci.person_id And k.id = mk.keyword_id And n.name Like '%Hemsworth%Chris%' And ci.movie_id = mk.movie_id And k... | job |
SELECT promotions, total, CAST(promotions AS DECIMAL(15, 4)) / CAST(total AS DECIMAL(15, 4)) * 100 FROM ( SELECT SUM(ss_ext_sales_price) AS promotions FROM store_sales JOIN store ON ss_store_sk = s_store_sk JOIN promotion ON ss_promo_sk = p_promo_sk JOIN date_dim ON ss_sold_date_sk = d_date_sk JOIN customer ON ss_custo... | tpcds |
SELECT i_manufact_id, SUM(ss_ext_sales_price) AS ext_price, i_manufact, i_brand AS brand, i_brand_id AS brand_id FROM date_dim JOIN store_sales ON d_date_sk = ss_sold_date_sk JOIN item ON ss_item_sk = i_item_sk JOIN customer ON ss_customer_sk = c_customer_sk JOIN customer_address ON c_current_addr_sk = ca_address_sk JO... | tpcds |
SELECT l_shipmode, SUM( CASE WHEN o_orderpriority = '1-URGENT' OR o_orderpriority = '2-HIGH' THEN 1 ELSE 0 END ) AS high_line_count, SUM( CASE WHEN o_orderpriority != '1-URGENT' AND o_orderpriority != '2-HIGH' THEN 1 ELSE 0 END ) AS low_line_count FROM orders, lineitem WHERE o_orderkey = l_orderkey AND l_shipmode IN (1... | tpch |
SELECT COUNT(ss_quantity) AS store_sales_quantitycount, AVG(ss_quantity) AS store_sales_quantityave, AVG(cs_quantity) AS catalog_sales_quantityave, STDDEV_SAMP(sr_return_quantity) / AVG(sr_return_quantity) AS store_returns_quantitycov, i_item_id, AVG(sr_return_quantity) AS store_returns_quantityave, i_item_desc, COUNT(... | tpcds |
SELECT s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE s_nationkey = n_nationkey AND l1.l_receiptdate > l1.l_commitdate AND o_orderkey = l1.l_orderkey AND 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 ) A... | 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_commitdate < l_receiptdate AND o_orderkey ... | tpch |
select min(t.title) as movie_title from keyword as k, movie_info as mi, movie_keyword as mk, title as t where t.id = mk.movie_id AND t.id = mi.movie_id AND mk.movie_id = mi.movie_id AND k.keyword like '%sequel%' AND mi.info in ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Danish', 'Norwegian', 'German') AND t.... | 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 cn.country_code = '[jp]' AND t.id = mc.movie_id AND n.gender ... | job |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.