text stringlengths 84 1.49k | benchmark stringclasses 4
values |
|---|---|
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.note IN ('(voice)', '(voice: Japanese version)', '(voice) (uncredited)... | job |
select i_brand_id as brand_id, i_manufact_id, i_manufact, 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 join customer on ss_customer_sk = c_customer_sk join customer_address on c_current_addr_sk = ca_address_sk jo... | 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 t.production_year > 1990 AND c... | job |
select count(*) from comments as c, postHistory as ph, badges as b, votes as v, users as u where u.UpVotes = 0 AND v.UserId = c.UserId AND u.Id = b.UserId AND b.UserId = ph.UserId AND ph.UserId = v.UserId AND ph.PostHistoryTypeId = 12 | 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 t.id = mc.movie_id AND it.id = mi.info_type_id AND mc.movie_id = mi.movie_id AND ct.id = mc.company_type_id AND (mc.note like '%(co-production)%' or mc.note like '%(presents)%') AND ... | job |
SELECT COUNT(1) FROM comments AS c, postHistory AS ph, badges AS b, votes AS v, users AS u WHERE u.Id = b.UserId AND ph.PostHistoryTypeId = 12 AND u.UpVotes = 0 AND ph.UserId = v.UserId AND v.UserId = c.UserId AND b.UserId = ph.UserId | stats |
SELECT p_brand, p_type, p_size, COUNT(DISTINCT ps_suppkey) AS supplier_cnt FROM partsupp, part WHERE p_size = ANY(ARRAY[1, 1, 1, 1, 1, 1, 1, 1]) AND p_type NOT LIKE 1 AND p_brand <> 1 AND p_partkey = ps_partkey AND ps_suppkey NOT IN ( SELECT s_suppkey FROM supplier WHERE s_comment LIKE '%Customer%Complaints%' ) GROUP B... | 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 it.id = mi.info_type_id AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND ct.id = mc.company_type_id AND t.id = mi.movie_id AND mc.movie_id = mi.movie_id AND it.info = '... | 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 t.id = mi.movie_id AND mk.movie_id = mi.movie_id AND mi.info = ANY(ARRAY['Sweden', 'Norway', 'Germany', 'Danish', 'Swedish', 'Danish', 'Norwegian', 'German']) AND... | 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 r_name = 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_nationkey ... | tpch |
SELECT COUNT(*) FROM comments AS c, posts AS p, votes AS v, users AS u WHERE p.Score >= 0 AND u.Id = p.OwnerUserId AND u.Id = c.UserId AND p.ViewCount >= 0 AND u.Id = v.UserId AND c.Score = 0 LIMIT 500; | stats |
select i_item_id, avg(ss_quantity) as agg1, avg(ss_list_price) as agg2, avg(ss_coupon_amt) as agg3, 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 s_acctbal, s_name, n_name, p_partkey, p_mfgr, s_address, s_phone, s_comment FROM part, supplier, partsupp, nation, region WHERE r_name = 1 AND p_partkey = ps_partkey AND ps_supplycost = ( SELECT MIN(ps_supplycost) FROM partsupp, supplier, nation, region WHERE p_partkey = ps_partkey AND s_suppkey = ps_suppkey AND... | tpch |
select o_orderpriority, count(*) as order_count from orders where o_orderdate < DATE 1 + INTERVAL '3' MONTH AND o_orderdate >= DATE 1 AND exists ( select * from lineitem where l_orderkey = o_orderkey and l_commitdate < l_receiptdate ) group by o_orderpriority order by o_orderpriority LIMIT 1000; | 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 s_phone, total_revenue, s_address, s_suppkey, s_name FROM supplier, revenue0 WHERE total_revenue = ( SELECT MAX(total_revenue) FROM revenue0 ) AND s_suppkey = supplier_no ORDER BY s_suppkey | tpch |
SELECT nation, SUM(amount) AS sum_profit, o_year FROM ( SELECT n_name AS nation, EXTRACT(YEAR FROM o_orderdate) AS o_year, l_extendedprice * (1 - l_discount) - ps_supplycost * l_quantity AS amount FROM part, supplier, lineitem, partsupp, orders, nation WHERE p_partkey = l_partkey AND ps_suppkey = l_suppkey AND ps_partk... | tpch |
Select extended_tax, bought_city, c_first_name, extended_price, c_last_name, list_price, ss_ticket_number, 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 promotions, total, CAST(promotions AS DECIMAL(15, 4)) / CAST(total AS DECIMAL(15, 4)) * 100 FROM ( SELECT SUM(ss_ext_sales_price) AS promotions FROM store_sales JOIN store ON ss_store_sk = s_store_sk JOIN promotion ON ss_promo_sk = p_promo_sk JOIN date_dim ON ss_sold_date_sk = d_date_sk JOIN customer ON ss_custo... | tpcds |
SELECT MIN(t.title) AS movie_title FROM keyword AS k, movie_info AS mi, movie_keyword AS mk, title AS t WHERE k.id = mk.keyword_id AND k.keyword LIKE '%sequel%' AND t.id = mk.movie_id AND t.production_year > 2005 AND mk.movie_id = mi.movie_id AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Denish'... | job |
SELECT c_first_name, list_price, c_last_name, extended_tax, extended_price, ss_ticket_number, 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 w_state, i_item_id, sum(case when (CAST(d_date as DATE) < CAST('2000-03-11' as DATE)) then cs_sales_price - COALESCE(cr_refunded_cash, 0) else 0 end) as sales_before, sum(case when (CAST(d_date as DATE) >= CAST('2000-03-11' as DATE)) then cs_sales_price - COALESCE(cr_refunded_cash, 0) else 0 end) as sales_after ... | tpcds |
Select Min(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 mk.movie_id = mi.movie_id And t.id = mi.movie_id And t.id = mk.movie_id And k.id = mk.keyword_id And k.keyword Like '%sequel%' And mi.info In ('Sweden', 'Norway', 'Germany', 'Danish... | job |
Select o_shippriority, Sum(l_extendedprice * (1 - l_discount)) As revenue, o_orderdate, l_orderkey From customer, orders, lineitem Where l_shipdate > DATE 1 And o_orderdate < DATE 1 And c_mktsegment = 1 And l_orderkey = o_orderkey And c_custkey = o_custkey Group By l_orderkey, o_orderdate, o_shippriority Order By reven... | tpch |
WITH year_total AS ( SELECT c_email_address AS customer_email_address, c_customer_id AS customer_id, c_login AS customer_login, SUM(((ss_ext_list_price - ss_ext_wholesale_cost - ss_ext_discount_amt) + ss_ext_sales_price) / 2) AS year_total, 's' AS sale_type, c_birth_country AS customer_birth_country, c_first_name AS cu... | tpcds |
SELECT AVG(sr_return_quantity) AS store_returns_quantityave, STDDEV_SAMP(sr_return_quantity) AS store_returns_quantitystdev, COUNT(cs_quantity) AS catalog_sales_quantitycount, STDDEV_SAMP(sr_return_quantity) / AVG(sr_return_quantity) AS store_returns_quantitycov, s_state, COUNT(sr_return_quantity) AS store_returns_quan... | tpcds |
SELECT SUM(ss_ext_wholesale_cost), AVG(ss_ext_wholesale_cost), AVG(ss_quantity), AVG(ss_ext_sales_price) FROM store_sales INNER JOIN store ON s_store_sk = ss_store_sk INNER JOIN customer_demographics ON cd_demo_sk = ss_cdemo_sk INNER JOIN household_demographics ON hd_demo_sk = ss_hdemo_sk INNER JOIN customer_address ON... | 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.Score <= 40 AND c.UserId = u.Id AND p.Id = pl.RelatedPostId AND p.Id = ph.PostId AND p.Id = c.PostId AND pl.LinkTypeId = 1 AND p.Id = v.PostId AND b.UserId = u.Id | stats |
SELECT c_custkey, n_name, c_comment, SUM(l_extendedprice * (1 - l_discount)) AS revenue, c_name, c_acctbal, c_address, c_phone 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 cntrycode, COUNT(1) AS numcust, SUM(c_acctbal) AS totacctbal FROM ( SELECT SUBSTRING(c_phone FROM 1 FOR 2) AS cntrycode, c_acctbal FROM customer WHERE SUBSTRING(c_phone FROM 1 FOR 2) IN (1, 1, 1, 1, 1, 1, 1) AND c_acctbal > ( SELECT AVG(c_acctbal) FROM customer WHERE c_acctbal > 0.00 AND SUBSTRING(c_phone FROM 1... | tpch |
SELECT MIN(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 t.id = m... | job |
SELECT MIN(t.title) AS western_violent_movie, MIN(cn.name) AS movie_company, MIN(mi_idx.info) AS rating 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(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 t.id = mk.movie_id AND cn.country_code ='[nl]' AND mc.movie_id = t.id AND cn.id = mc.company_id AND mk.keyword_id = k.id AND mc.movie_id = mk.mo... | job |
WITH year_total AS ( SELECT c_customer_id AS customer_id, c_first_name AS customer_first_name, c_preferred_cust_flag AS customer_preferred_cust_flag, SUM(((ss_ext_list_price - ss_ext_wholesale_cost - ss_ext_discount_amt) + ss_ext_sales_price) / 2) AS year_total, 's' AS sale_type, d_year AS dyear, c_email_address AS cus... | 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 mc.movie_id = mk.movie_id AND ci.movie_id = t.id AND t.episode_nr < 100 AND t.id = mk.movie... | job |
SELECT promotions, CAST(promotions AS DECIMAL(15, 4)) / CAST(total AS DECIMAL(15, 4)) * 100, total 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(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 mi.movie_id = mc.movie_id AND it.id = mi.info_type_id AND t.id = mi.movie... | job |
SELECT MAX(t.title) AS russian_movie, MAX(chn.name) AS uncredited_voiced_character 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.id = ci.movie_id AND ci.note LIKE '%(voice)%' AND chn.id = ci.person_role_id AND ci.movie_id = mc.... | job |
SELECT p_brand, p_type, p_size, COUNT(DISTINCT ps_suppkey) AS supplier_cnt FROM partsupp, part WHERE p_partkey = ps_partkey AND p_type NOT LIKE 1 AND p_size IN (1, 1, 1, 1, 1, 1, 1, 1) AND p_brand <> 1 AND ps_suppkey NOT IN ( SELECT s_suppkey FROM supplier WHERE s_comment LIKE '%Customer%Complaints%' ) GROUP BY p_brand... | 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 t.id = mc.movie_id AND (mc.note LIKE '%(co-prod... | job |
SELECT MIN(t.title) AS movie_title FROM company_name AS cn, keyword AS k, movie_companies AS mc, movie_keyword AS mk, title AS t WHERE cn.id = mc.company_id AND t.id = mk.movie_id AND k.keyword ='character-name-in-title' AND cn.country_code ='[de]' AND mk.keyword_id = k.id AND mc.movie_id = t.id AND mc.movie_id = mk.mo... | job |
Select Count(*) From postHistory As ph, posts As p, users As u, badges As b Where u.Reputation >= 1 And u.Id = b.UserId And p.Score >= -7 And ph.PostHistoryTypeId = 3 And ph.UserId = u.Id And p.OwnerUserId = u.Id | stats |
SELECT MAX(an1.name) AS actress_pseudonym, MAX(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 t.id = mc.movie_id AND ci.role_id = rt.id AND n1.name LIKE '%Yo%' AND n1.name NOT LIK... | 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 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 ps_suppkey = l_suppkey AND ps_partkey = l_partkey AND s_natio... | tpch |
SELECT COUNT(*) FROM comments AS c, posts AS p, postHistory AS ph, votes AS v, users AS u WHERE ph.UserId = v.UserId AND p.AnswerCount >= 0 AND p.OwnerUserId = ph.UserId AND p.Score <= 13 AND c.UserId = p.OwnerUserId AND u.Id = c.UserId LIMIT 100; | 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 n.id = pi.person_id AND an.name LIKE '%a%' AND n.name_pcode_cf BETWEEN 'A' AND 'F' AND... | job |
SELECT c_name, c_acctbal, SUM(l_extendedprice * (1 - l_discount)) AS revenue, c_address, c_comment, c_phone, n_name, c_custkey 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.info) AS release_date, MIN(t.title) AS german_movie, MIN(miidx.info) AS rating FROM company_name AS cn, company_type AS ct, info_type AS it, info_type AS it2, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS miidx, title AS t WHERE it2.info = 'release dates' AND it2.id = mi.info... | job |
SELECT n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, supplier, nation, region WHERE o_orderdate < DATE 1 + INTERVAL '1' YEAR AND o_orderdate >= DATE 1 AND c_nationkey = s_nationkey AND l_suppkey = s_suppkey AND c_custkey = o_custkey AND l_orderkey = o_orderkey AND r_name = ... | tpch |
SELECT SUM(l_extendedprice * (1 - l_discount)) AS revenue, o_orderdate, o_shippriority, l_orderkey FROM customer, orders, lineitem WHERE l_orderkey = o_orderkey AND l_shipdate > DATE 1 AND c_custkey = o_custkey AND c_mktsegment = 1 AND o_orderdate < DATE 1 GROUP BY l_orderkey, o_orderdate, o_shippriority ORDER BY reven... | 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 chn.id = ci.person_role_id AND t.id = mc.movie_id AND ci.note IN ('(voice... | 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 t.id = ci.movie_id AND cn.country_code = '[jp]' AND mc.note L... | job |
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 = ph.PostId AND u.Id = p.OwnerUserId AND p.Id = v.PostId AND p.Id = c.PostId AND p.Id = pl.PostId AND p.AnswerCount >= 0 LIMIT 100; | stats |
SELECT MIN(t.title) AS german_movie, MIN(miidx.info) AS rating, MIN(mi.info) AS release_date FROM company_name AS cn, company_type AS ct, info_type AS it, info_type AS it2, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS miidx, title AS t WHERE mc.movie_id = t.id AND mi.movie_id = miidx.movi... | job |
Select Min(t.title) As movie_title From keyword As k, movie_info As mi, movie_keyword As mk, title As t Where t.production_year > 2000 AND k.keyword Like '%sequel%' 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'... | 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 (mc.note LIKE '%(co-production)%' OR mc.note LIKE... | 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_suppkey = l_suppkey AND c_nation... | tpch |
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 l_orderkey = o_orderkey AND c_nationkey = n_nationkey AND l_returnflag = 'R' AND o_orderdate >= DATE 1 AND c_custkey = o_custkey AND o_orderdate < ... | tpch |
select ss_ticket_number, c_salutation, c_preferred_cust_flag, c_last_name, c_first_name, 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 keyword as k, movie_info as mi, movie_keyword as mk, title as t where t.production_year > 2010 and t.id = mk.movie_id and mi.info in ('Sweden', 'Norway', 'Germany', 'Danish', 'Swedish', 'Danish', 'Norwegian', 'German') and mk.movie_id = mi.movie_id and k.keyword like '%sequel%' a... | 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.keyword = 'marvel-cinematic-universe' AND ci.movie_id = mk.movie_id AND k.id = mk.keyword_... | job |
SELECT COUNT(*) FROM comments AS c, posts AS p, users AS u WHERE p.CommentCount >= 0 AND p.FavoriteCount >= 0 AND c.UserId = u.Id AND u.Id = p.OwnerUserId AND p.ViewCount >= 0 AND c.CreationDate >= '2010-08-05 00:36:02'::timestamp LIMIT 20; | stats |
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 pl.LinkTypeId = 1 AND p.Id = c.PostId AND p.Id = v.PostId AND p.Id = pl.RelatedPostId AND p.Score <= 40 AND p.Id = ph.PostId AND c.UserId = u.Id | stats |
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 total_revenue, s_suppkey, s_name, s_phone, s_address FROM supplier, revenue0 WHERE s_suppkey = supplier_no AND total_revenue = ( SELECT MAX(total_revenue) FROM revenue0 ) ORDER BY s_suppkey LIMIT 10; | tpch |
select count(1) from comments as c, posts as p, postHistory as ph, votes as v, users as u where p.AnswerCount >= 0 AND ph.UserId = v.UserId AND u.Id = c.UserId AND p.OwnerUserId = ph.UserId AND p.Score <= 13 AND c.UserId = p.OwnerUserId | stats |
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 mc.movie_id = mk.movie_id AND ci.movie_id = mk.movie_id AND k.keyword = 'character-name-in-... | job |
SELECT c_first_name, c_salutation, c_preferred_cust_flag, cnt, c_last_name, ss_ticket_number 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(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 t.id = mk.movie_id AND t.production_year > 2010 AND ci.movie_id = mk.movie_id AND n.id = ci.person_id AND k.id = mk.keyword_id AND n.name l... | job |
SELECT MAX(ss_net_profit) AS store_sales_profit, i_item_desc, i_item_id, s_store_id, MAX(sr_net_loss) AS store_returns_loss, MAX(cs_net_profit) AS catalog_sales_profit, s_store_name FROM store_sales JOIN store_returns ON store_sales.ss_customer_sk = store_returns.sr_customer_sk AND store_sales.ss_item_sk = store_return... | tpcds |
SELECT p_mfgr, s_address, s_acctbal, n_name, s_comment, p_partkey, s_phone, 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 SUM(l_extendedprice) / 7.0 AS avg_yearly FROM lineitem, part WHERE l_quantity < ( SELECT 0.2 * AVG(l_quantity) FROM lineitem WHERE l_partkey = p_partkey ) AND p_container = 1 AND p_brand = 1 AND p_partkey = l_partkey LIMIT 100; | 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 i_brand_id as brand_id, i_brand as brand, i_manufact_id, i_manufact, sum(ss_ext_sales_price) as ext_price from date_dim join store_sales on d_date_sk = ss_sold_date_sk join item on ss_item_sk = i_item_sk join customer on ss_customer_sk = c_customer_sk join customer_address on c_current_addr_sk = ca_address_sk jo... | 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 mi.info in ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Denish', 'Norwegian', 'German') and mk.movie_id = mi.movie_id and k.id = mk.keyword_id and t.production_year > 2005 and t... | 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 p.Id = c.PostId AND p.Id = pl.RelatedPostId AND b.UserId = u.Id AND pl.LinkTypeId = 1 AND p.Id = ph.PostId AND c.UserId = u.Id LIMIT 50; | stats |
WITH _q AS ( Select Count(*) From posts As p, postLinks As pl, users As u Where u.CreationDate <= '2014-09-12 07:12:16'::timestamp And p.CommentCount <= 17 And p.Id = pl.PostId And p.OwnerUserId = u.Id ) SELECT * FROM _q; | stats |
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 s_suppkey = l1.l_suppkey and o_orderkey = l1.l_orderkey and n_name = 1 and o_orderstatus = 'F' and s_nationkey = n_nationkey a... | tpch |
SELECT COUNT(sr_return_quantity) AS store_returns_quantitycount, s_state, i_item_id, AVG(sr_return_quantity) AS store_returns_quantityave, AVG(ss_quantity) AS store_sales_quantityave, COUNT(cs_quantity) AS catalog_sales_quantitycount, STDDEV_SAMP(ss_quantity) / AVG(ss_quantity) AS store_sales_quantitycov, COUNT(ss_quan... | 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 mi.info LIKE 'USA:%200%' AND it1.id = mi_idx.info_type_id AND kt.kind ... | job |
Select Count(*) From comments As c, posts As p, postLinks As pl, postHistory As ph, votes As v, badges As b Where c.Score = 0 And p.Id = v.PostId And b.UserId = c.UserId And p.Id = pl.RelatedPostId And p.Id = c.PostId And pl.LinkTypeId = 1 And p.Id = ph.PostId | stats |
SELECT c_last_name, cnt, c_first_name, ss_ticket_number, c_salutation, 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 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_suppkey = l_suppkey AND c_nation... | tpch |
select COUNT(1) as count_order, sum(l_extendedprice) as sum_base_price, sum(l_quantity) as sum_qty, avg(l_quantity) as avg_qty, l_returnflag, sum(l_extendedprice * (1 - l_discount)) as sum_disc_price, l_linestatus, avg(l_discount) as avg_disc, sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) as sum_charge, avg(l_e... | tpch |
SELECT COUNT(1) FROM comments AS c, posts AS p, postHistory AS ph, votes AS v, users AS u WHERE p.Score <= 13 AND p.AnswerCount >= 0 AND c.UserId = p.OwnerUserId AND p.OwnerUserId = ph.UserId AND ph.UserId = v.UserId AND u.Id = c.UserId | stats |
SELECT supp_nation, cust_nation, l_year, SUM(volume) AS revenue FROM ( SELECT n1.n_name AS supp_nation, n2.n_name AS cust_nation, EXTRACT(YEAR FROM l_shipdate) AS l_year, l_extendedprice * (1 - l_discount) AS volume FROM supplier, lineitem, orders, customer, nation n1, nation n2 WHERE l_shipdate BETWEEN DATE '1995-01-0... | tpch |
SELECT 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 o_cust... | tpch |
Select Count(*) From comments As c, postHistory As ph Where ph.PostHistoryTypeId = 1 AND c.Score = 0 AND c.UserId = ph.UserId Limit 200; | stats |
SELECT i_item_id, i_item_desc, i_current_price FROM item INNER JOIN inventory ON i_item_sk = inv_item_sk INNER JOIN date_dim ON d_date_sk = inv_date_sk INNER JOIN store_sales ON ss_item_sk = i_item_sk WHERE d_date BETWEEN CAST('2002-01-23' AS DATE) AND (CAST('2002-01-23' AS DATE) + INTERVAL '60 days') AND i_manufact_id... | tpcds |
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(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 t.production_year > 2000 AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Danish', 'Norwegian', 'German') AND t.id = mi.movie_id AND mk.movie... | job |
Select COUNT(1) From comments As c, posts As p, votes As v Where c.PostId = p.Id AND v.VoteTypeId = 2 AND p.Id = v.PostId AND c.Score = 0 | stats |
select min(mi.info) as release_date, min(miidx.info) as rating, min(t.title) as german_movie from company_name as cn, company_type as ct, info_type as it, info_type as it2, kind_type as kt, movie_companies as mc, movie_info as mi, movie_info_idx as miidx, title as t where kt.id = t.kind_id AND cn.country_code = '[de]' ... | job |
Select o_orderpriority, Count(*) As order_count From orders Where o_orderdate < DATE 1 + INTERVAL '3' MONTH And o_orderdate >= DATE 1 And Exists ( Select * From lineitem Where l_orderkey = o_orderkey And l_commitdate < l_receiptdate ) Group By o_orderpriority Order By o_orderpriority LIMIT 100; | tpch |
Select Min(mc.note) As production_note, Min(t.title) As movie_title, Min(t.production_year) As movie_year From company_type As ct, info_type As it, movie_companies As mc, movie_info_idx As mi_idx, title As t Where mc.movie_id = mi_idx.movie_id AND ct.kind = 'production companies' AND t.id = mi_idx.movie_id AND it.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 mi.info IN ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Denish', 'Norwegian', 'German') AND t.id = mk.movie_id AND k.id = mk.keyword_id AND mk.movie_id = mi.movie_id AND t.production_year > 2005 AND k... | 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 it.id =... | 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 t.id = ci.movie_id AND t.id = mk.movie_id AND k.id = mk.keyword_id AND n.id ... | job |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.