text stringlengths 84 1.49k | benchmark stringclasses 4
values |
|---|---|
SELECT c_phone, n_name, c_address, c_custkey, c_name, c_acctbal, c_comment, SUM(l_extendedprice * (1 - l_discount)) AS revenue 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 s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE o_orderstatus = 'F' AND o_orderkey = l1.l_orderkey AND n_name = 1 AND l1.l_receiptdate > l1.l_commitdate AND s_nationkey = n_nationkey AND NOT EXISTS ( SELECT * FROM lineitem l3 WHERE l3.l_orderkey = l1.l_orderkey AND l3.l_suppkey <> l1... | tpch |
SELECT total, CAST(promotions AS DECIMAL(15, 4)) / CAST(total AS DECIMAL(15, 4)) * 100, promotions 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 ct.id = mc.company_type_id AND t.production_year > 2005 AND t.id = ci.movie_id AND ci.movie_id = mc.... | job |
SELECT n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, supplier, nation, region WHERE r_name = 1 AND c_custkey = o_custkey AND l_suppkey = s_suppkey AND c_nationkey = s_nationkey AND n_regionkey = r_regionkey AND o_orderdate < DATE 1 + INTERVAL '1' YEAR AND o_orderdate >= DAT... | tpch |
SELECT c_preferred_cust_flag, ss_ticket_number, cnt, c_first_name, c_salutation, c_last_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 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.production_year > 2000 AND ci.role_id =... | 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 miidx.movie_id = t.id AN... | 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 it2.id = mi.info_type_id AND ct.id = mc.company... | job |
SELECT COUNT(*) FROM comments AS c, posts AS p, votes AS v, users AS u WHERE u.Id = v.UserId AND u.Id = p.OwnerUserId AND p.Score >= 0 AND c.Score = 0 AND u.Id = c.UserId AND p.ViewCount >= 0 LIMIT 200; | stats |
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 count(*) from comments as c, posts as p, postLinks as pl, postHistory as ph, votes as v, users as u where p.Id = c.PostId and p.Id = ph.PostId and p.AnswerCount >= 0 and p.PostTypeId = 1 and p.Id = v.PostId and u.Id = p.OwnerUserId and p.Id = pl.PostId | stats |
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 = ci.person_id AND ci.note = '(voice: English version)' AND ci.movie_id = t.id AND n1.id = ci.per... | 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.movie_id = mi.movie_id AND t.id = mi.movie_id AND ct.id = mc.company_type_id AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND it.id = mi.info_type_id AND t.id = mc.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 n.name LIKE '%Downey%Robert%' AND k.keyword = 'marvel-cinematic-universe' AND k.id = mk.keyword_id AND t.production_year > 2010 AND n.id = ... | job |
SELECT MIN(t.title) AS movie_title FROM keyword AS k, movie_info AS mi, movie_keyword AS mk, title AS t WHERE t.id = mi.movie_id AND t.production_year > 2000 AND mk.movie_id = mi.movie_id AND t.id = mk.movie_id AND k.id = mk.keyword_id AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Danish', 'Norw... | job |
SELECT nation, o_year, SUM(amount) AS sum_profit FROM ( SELECT n_name AS nation, EXTRACT(YEAR FROM o_orderdate) AS o_year, l_extendedprice * (1 - l_discount) - ps_supplycost * l_quantity AS amount FROM part, supplier, lineitem, partsupp, orders, nation WHERE s_nationkey = n_nationkey AND p_partkey = l_partkey AND o_ord... | tpch |
Select Count(1) 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 And v.UserId = c.UserId And b.UserId = ph.UserId And u.UpVotes = 0 And u.Id = b.UserId | stats |
SELECT MIN(n.name) AS actor_name, MIN(t.title) AS marvel_movie, MIN(k.keyword) AS movie_keyword FROM cast_info AS ci, keyword AS k, movie_keyword AS mk, name AS n, title AS t WHERE ci.movie_id = mk.movie_id AND t.id = mk.movie_id AND k.keyword = 'marvel-cinematic-universe' AND n.id = ci.person_id AND k.id = mk.keyword_... | job |
Select l_returnflag, l_linestatus, Sum(l_quantity) As sum_qty, Sum(l_extendedprice) As sum_base_price, Sum(l_extendedprice * (1 - l_discount)) As sum_disc_price, Sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) As sum_charge, Avg(l_quantity) As avg_qty, Avg(l_extendedprice) As avg_price, Avg(l_discount) As avg_dis... | tpch |
SELECT o_orderdate, SUM(l_extendedprice * (1 - l_discount)) AS revenue, l_orderkey, o_shippriority FROM customer, orders, lineitem WHERE c_custkey = o_custkey AND c_mktsegment = 1 AND l_shipdate > DATE 1 AND l_orderkey = o_orderkey AND o_orderdate < DATE 1 GROUP BY l_orderkey, o_orderdate, o_shippriority ORDER BY reven... | tpch |
select COUNT(1) from comments as c, posts as p, postLinks as pl, postHistory as ph, votes as v where p.FavoriteCount >= 0 AND pl.LinkTypeId = 1 AND c.Score = 0 AND p.Id = v.PostId AND p.Id = ph.PostId AND p.Id = c.PostId AND p.Id = pl.PostId | stats |
SELECT CAST(promotions AS DECIMAL(15, 4)) / CAST(total AS DECIMAL(15, 4)) * 100, total, promotions FROM ( SELECT SUM(ss_ext_sales_price) AS promotions FROM store_sales INNER JOIN store ON ss_store_sk = s_store_sk INNER JOIN promotion ON ss_promo_sk = p_promo_sk INNER JOIN date_dim ON ss_sold_date_sk = d_date_sk INNER J... | tpcds |
Select o_orderkey, Sum(l_quantity), c_custkey, o_totalprice, o_orderdate, c_name 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(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 mk.movie_id = mc.movie_id AND k.id ... | job |
SELECT ss_ticket_number, c_preferred_cust_flag, c_last_name, c_first_name, c_salutation, 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(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 = mk.movie_id AND cn.id = mc.company_id AND cn.country_code ='[nl]' AND t.id = mk.movie_id AND mc.movie_id = t.id AND mk.keyword_id ... | job |
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 mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND mc.movie_id = mi_idx.movie_id AND it.id = mi_id... | job |
SELECT promotions, total, CAST(promotions AS DECIMAL(15, 4)) / CAST(total AS DECIMAL(15, 4)) * 100 FROM ( SELECT SUM(ss_ext_sales_price) AS promotions FROM store_sales JOIN store ON ss_store_sk = s_store_sk JOIN promotion ON ss_promo_sk = p_promo_sk JOIN date_dim ON ss_sold_date_sk = d_date_sk JOIN customer ON ss_custo... | tpcds |
SELECT MIN(mc.note) AS production_note, MIN(t.title) AS movie_title, MIN(t.production_year) AS movie_year FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info_idx AS mi_idx, title AS t WHERE ct.kind = 'production companies' AND t.id = mi_idx.movie_id AND it.info = 'top 250 rank' AND it.id = mi_id... | 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.ViewCount >= 0 AND u.Id = b.UserId AND u.Id = p.OwnerUserId AND p.Id = v.PostId AND p.Id = ph.PostId AND p.Score <= 192 AND p.Id = c.PostId | stats |
SELECT AVG(ss_sales_price) AS agg4, AVG(ss_quantity) AS agg1, AVG(ss_coupon_amt) AS agg3, AVG(ss_list_price) AS agg2, i_item_id FROM store_sales JOIN customer_demographics ON ss_cdemo_sk = cd_demo_sk JOIN date_dim ON ss_sold_date_sk = d_date_sk JOIN item ON ss_item_sk = i_item_sk JOIN promotion ON ss_promo_sk = p_promo... | tpcds |
SELECT COUNT(*) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v, badges AS b, users AS u WHERE pl.LinkTypeId = 1 AND p.Score <= 40 AND p.Id = pl.RelatedPostId AND b.UserId = u.Id AND c.UserId = u.Id AND p.Id = ph.PostId AND p.Id = v.PostId AND p.Id = c.PostId | stats |
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 t.production_year > 1950 AND k.keyw... | 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 = c.PostId AND p.Score <= 40 AND p.Id = v.PostId AND p.Id = ph.PostId AND pl.LinkTypeId = 1 AND p.Id = pl.RelatedPostId AND c.UserId = u.Id AND b.UserId = u.Id | stats |
SELECT n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, supplier, nation, region WHERE s_nationkey = n_nationkey AND c_custkey = o_custkey AND c_nationkey = s_nationkey AND o_orderdate < DATE 1 + INTERVAL '1' YEAR AND o_orderdate >= DATE 1 AND l_suppkey = s_suppkey AND l_order... | tpch |
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 l_suppkey = s_suppkey AND l_orderkey = o_orderkey AND s_nationkey = n_nationkey AND c_nationkey = s_nationkey AND r_nam... | 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 an.person_id = n.id AND ci.person_id = an.person_id AND ci.role_id = rt.i... | job |
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 Count(*) From comments As c, posts As p, postLinks As pl, postHistory As ph, votes As v Where pl.LinkTypeId = 1 AND p.Id = ph.PostId AND p.FavoriteCount >= 0 AND p.Id = v.PostId AND p.Id = c.PostId AND p.Id = pl.PostId AND c.Score = 0 | stats |
SELECT MIN(t.title) AS american_movie FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info AS mi, title AS t WHERE it.info = 'bottom 10 rank' AND it.id = mi.info_type_id AND (mc.note LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%') AND ct.id = mc.company_type_id AND mc.note NOT LIKE '%(as... | 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 = mk.movie_id AND cn.id = mc.company_id AND mk.keyword_id = k.id AND cn.country_code ='[sm]' AND t.id = mk.movie_id AND mc.movie_id ... | job |
SELECT AVG(cs_list_price) AS agg2, AVG(cs_quantity) AS agg1, 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 |
WITH _q AS ( SELECT COUNT(*) FROM comments AS c, posts AS p, users AS u WHERE c.UserId = u.Id AND u.Id = p.OwnerUserId AND c.CreationDate >= '2010-08-05 00:36:02'::timestamp AND p.ViewCount >= 0 AND p.CommentCount >= 0 AND p.FavoriteCount >= 0 LIMIT 500 ) 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 t.production_year > 2005 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.id = mk.movie_id AND t... | job |
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 mc.movie_id = t.id AND mc.movie_id = mk.movie_id ) SELECT * FROM _q AND t.id = mk.movie_id AND mk.keyword_id = k.id AND k.keyword ='character-name-in-title' AND cn.id = mc.... | 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 SUM(l_extendedprice) AS sum_base_price, COUNT(*) AS count_order, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, AVG(l_discount) AS avg_disc, AVG(l_quantity) AS avg_qty, l_linestatus, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, AVG(l_extendedprice) AS avg_price, l_returnflag, ... | tpch |
SELECT l_linestatus, SUM(l_quantity) AS sum_qty, AVG(l_extendedprice) AS avg_price, COUNT(*) AS count_order, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, SUM(l_extendedprice) AS sum_base_price, AVG(l_quantity) AS avg_qty, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, AVG(l_discount)... | tpch |
SELECT c_count, COUNT(1) 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 ASC, c_count ASC LIMIT 20; | 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 INNER JOIN store_returns ON store_sales.ss_customer_sk = store_returns.sr_customer_sk AND store_sales.ss_item_sk = store_... | 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.id = mi.movie_id AND k.keyword LIKE '%sequel%' AND t.id = mk.movie_id AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Denish', 'Norwegian', 'German') AND mk.movie_id = mi.movie_id AND k.... | job |
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 >= 70 AND ss_list_price <= 70 + 10 OR ss_coupon_amt BETWEEN 1715 AND 1715 + 1000 OR ss_wholesale_cost BETWEEN 64 AND 64 + 20) ) AS b3 AND ss_quantity BETWEEN... | tpcds |
SELECT i_brand AS brand, i_brand_id AS brand_id, SUM(ss_ext_sales_price) AS ext_price, i_manufact_id, i_manufact 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 COUNT(*) FROM postHistory AS ph, posts AS p, votes AS v, badges AS b, users AS u, comments AS c WHERE u.Id = b.UserId AND p.Id = ph.PostId AND p.Id = c.PostId AND u.Id = p.OwnerUserId AND p.Id = v.PostId AND p.Score <= 192 AND p.ViewCount >= 0 | stats |
SELECT SUM(amount) AS sum_profit, o_year, nation 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 s_suppkey = l_suppkey AND ps_suppkey = l_suppkey AND ps_partk... | tpch |
SELECT c_address, c_custkey, c_acctbal, c_phone, SUM(l_extendedprice * (1 - l_discount)) AS revenue, n_name, 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(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 t.id = ml.movie_id AND lt.link LIKE... | job |
SELECT AVG(ss_ext_wholesale_cost), SUM(ss_ext_wholesale_cost), AVG(ss_ext_sales_price), AVG(ss_quantity) FROM store_sales JOIN store ON s_store_sk = ss_store_sk JOIN customer_demographics ON cd_demo_sk = ss_cdemo_sk JOIN household_demographics ON hd_demo_sk = ss_hdemo_sk JOIN customer_address ON ca_address_sk = ss_addr... | tpcds |
SELECT MIN(mc.note) AS production_note, MIN(t.title) AS movie_title, MIN(t.production_year) AS movie_year FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info_idx AS mi_idx, title AS t WHERE it.id = mi_idx.info_type_id AND t.id = mc.movie_id AND t.id = mi_idx.movie_id AND it.info = 'top 250 rank'... | job |
select ps_partkey, sum(ps_supplycost * ps_availqty) as VALUE from partsupp, supplier, nation where n_name = 1 and s_nationkey = n_nationkey 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 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 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 = mi.movie_id AND (mc.note like '%(co-production)%' or mc.note like '%(presents)%') AND ct.kind = 'production companies' AND mc.movie_id = mi.movie_id AND ct.id = mc.company_typ... | job |
SELECT i_item_desc, s_store_id, s_store_name, MAX(cs_net_profit) AS catalog_sales_profit, MAX(sr_net_loss) AS store_returns_loss, MAX(ss_net_profit) AS store_sales_profit, i_item_id FROM store_sales JOIN store_returns ON store_sales.ss_customer_sk = store_returns.sr_customer_sk AND store_sales.ss_item_sk = store_return... | tpcds |
Select 100.00 * Sum( Case When p_type Like 'PROMO%' Then l_extendedprice * (1 - l_discount) Else 0 End ) / Sum(l_extendedprice * (1 - l_discount)) As promo_revenue From lineitem, part Where l_partkey = p_partkey And l_shipdate >= DATE 1 And l_shipdate < DATE 1 + INTERVAL '1' MONTH Limit 1000; | 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 k.keyword = 'marvel-cinematic-universe' AND n.name LIKE '%Downey%Robert%' AND t.production_year > 2010 AND k.id = mk.keyword_id AND n.id = ... | job |
SELECT MIN(t.title) AS movie_title FROM keyword AS k, movie_info AS mi, movie_keyword AS mk, title AS t WHERE k.keyword LIKE '%sequel%' AND mi.info = ANY(ARRAY['Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Danish', 'Norwegian', 'German']) AND k.id = mk.keyword_id AND t.production_year > 2000 AND t.id = mk.movie... | job |
SELECT COUNT(1) FROM votes AS v, posts AS p, badges AS b, users AS u WHERE u.Id = p.OwnerUserId AND p.Id = v.PostId AND u.Reputation >= 1 AND u.Id = b.UserId AND p.Score <= 22 LIMIT 200; | stats |
SELECT p_mfgr, n_name, s_name, s_phone, p_partkey, s_address, s_acctbal, s_comment FROM part, supplier, partsupp, nation, region WHERE s_nationkey = n_nationkey AND p_partkey = ps_partkey AND p_type LIKE 1 AND r_name = 1 AND p_size = 1 AND s_suppkey = ps_suppkey AND ps_supplycost = ( SELECT MIN(ps_supplycost) FROM part... | tpch |
SELECT MIN(t.title) AS western_sequel, MIN(lt.link) AS link_type, 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 k.keyword IN ('sequel', 'revenge', ... | job |
Select p_brand, Count(Distinct ps_suppkey) As supplier_cnt, p_type, p_size From partsupp, part Where p_partkey = ps_partkey And p_brand <> 1 And p_size In (1, 1, 1, 1, 1, 1, 1, 1) And p_type Not Like 1 And ps_suppkey Not In ( Select s_suppkey From supplier Where s_comment Like '%Customer%Complaints%' ) Group By p_brand... | tpch |
SELECT MIN(t.title) AS movie_title FROM keyword AS k, movie_info AS mi, movie_keyword AS mk, title AS t WHERE t.production_year > 2010 AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Danish', 'Swedish', 'Danish', 'Norwegian', 'German') AND mk.movie_id = mi.movie_id AND k.keyword LIKE '%sequel%' AND t.id = mk.movie_id A... | 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 kt.kind = 'movie' AND it1.id = mi_id... | job |
select min(t.title) as movie_title from company_name as cn, keyword as k, movie_companies as mc, movie_keyword as mk, title as t where mk.keyword_id = k.id and mc.movie_id = t.id and t.id = mk.movie_id and cn.country_code ='[nl]' and mc.movie_id = mk.movie_id and k.keyword ='character-name-in-title' and cn.id = mc.comp... | 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.movie_id = mc.movie_id AND ct.id... | 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 (n.gender = 'm' OR (n.gender = 'f' AND n.name LIKE 'B%')) AND pi.person_id = an.person_id AND n.id = an.person_id AND ... | job |
SELECT MIN(t.title) AS movie_title FROM keyword AS k, movie_info AS mi, movie_keyword AS mk, title AS t WHERE t.id = mk.movie_id AND mk.movie_id = mi.movie_id AND t.production_year > 2005 AND t.id = mi.movie_id AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Denish', 'Norwegian', 'German') 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.id = mk.keyword_id AND t.production_year > 2010 AND t.id = mk.movie_id AND mi.info in ('Sweden', 'Norway', 'Germany', 'Danish', 'Swedish', 'Danish', 'Norwegian', 'German') AND t.... | 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_shipmode In (1, 1) AND l_commitdate < l_re... | 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 mk.movie_id = mc.movie_id AND t.id = ci.movie_id AND ci.perso... | 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.title) AS movie_title FROM keyword AS k, movie_info AS mi, movie_keyword AS mk, title AS t WHERE k.keyword LIKE '%sequel%' AND mk.movie_id = mi.movie_id AND t.production_year > 2010 AND t.id = mi.movie_id AND mi.info = ANY(ARRAY['Sweden', 'Norway', 'Germany', 'Danish', 'Swedish', 'Danish', 'Norwegian', 'Ge... | job |
SELECT s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE 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 <> l1.l_suppkey AND l3.l_receiptda... | 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(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.id = mc.company_type_id AND (mc.note LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%') AND... | 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.id = mc.company_type_id AND ct.kind = 'production companies' AND t.id = mi.movie_id AND (mc.note LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%') AND mc.note NOT LIKE '%(a... | job |
SELECT s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE s_suppkey = l1.l_suppkey AND o_orderstatus = 'F' AND EXISTS ( SELECT * FROM lineitem l2 WHERE l2.l_orderkey = l1.l_orderkey AND l2.l_suppkey <> l1.l_suppkey ) AND l1.l_receiptdate > l1.l_commitdate AND s_nationkey = n_nationkey AND NOT ... | 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 it.info = 'top 250 rank' AND it.id = mi_idx.info_type_id AND (mc.note LIKE ... | 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 = mc.movie_id AND ct.kind = 'production companies' AND mc.movie_id = mi.movie_id AND t.id = mi.movie_id AND it.id = mi... | job |
SELECT c_last_name, c_first_name, c_salutation, c_preferred_cust_flag, ss_ticket_number, cnt FROM ( SELECT ss_ticket_number, ss_customer_sk, COUNT(*) AS cnt FROM store_sales 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 count(*) from comments as c, posts as p, votes as v, users as u where c.Score = 0 AND p.Score >= 0 AND u.Id = p.OwnerUserId AND u.Id = v.UserId AND p.ViewCount >= 0 AND u.Id = c.UserId | stats |
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 p.Id = ph.PostId and pl.LinkTypeId = 1 and p.Id = pl.RelatedPostId and p.Id = c.PostId and c.Score = 0 and b.UserId = c.UserId | 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 it2.info = 'release dates' AND t.id = mi_idx.movie_id AND kt.id = t.ki... | 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(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 it2.info = 'release dates' AND at.title Like '%Champion%' AND it1.info... | 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.country_code ='[de]' and mc.movie_id = t.id and cn.id = mc.company_id and mk.keyword_id = k.id and t.id = mk.movie_id and k.keyword ='character-name-in-title' and mc.movie_id = mk.mo... | job |
select count(*) from comments as c, posts as p, postLinks as pl, postHistory as ph, votes as v, badges as b, users as u where b.UserId = u.Id AND p.Id = ph.PostId AND p.Id = c.PostId AND p.Score <= 40 AND p.Id = pl.RelatedPostId AND c.UserId = u.Id AND pl.LinkTypeId = 1 AND p.Id = v.PostId | stats |
SELECT n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, supplier, nation, region WHERE l_suppkey = s_suppkey AND n_regionkey = r_regionkey AND o_orderdate < DATE 1 + INTERVAL '1' YEAR AND c_nationkey = s_nationkey AND o_orderdate >= DATE 1 AND c_custkey = o_custkey AND s_natio... | tpch |
Select Count(*) From users As u, posts As p Where u.Id = p.OwnerUserId And u.Reputation >= 1 Limit 100; | stats |
SELECT MIN(t.title) AS biography_movie, MIN(n.name) AS of_person FROM aka_name AS an, cast_info AS ci, info_type AS it, link_type AS lt, movie_link AS ml, name AS n, person_info AS pi, title AS t WHERE pi.person_id = an.person_id AND n.id = pi.person_id AND n.id = an.person_id AND it.id = pi.info_type_id AND lt.id = ml... | job |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.