text stringlengths 84 1.49k | benchmark stringclasses 4
values |
|---|---|
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 ct.kind = 'production companies' AND mc.movie_id = mi_idx.movie_id AND ct.... | job |
SELECT MIN(an.name) AS cool_actor_pseudonym, MIN(t.title) AS series_named_after_char FROM aka_name AS an, cast_info AS ci, company_name AS cn, keyword AS k, movie_companies AS mc, movie_keyword AS mk, name AS n, title AS t WHERE ci.movie_id = mc.movie_id AND ci.movie_id = mk.movie_id AND mc.movie_id = mk.movie_id AND n... | job |
SELECT i_manufact_id, i_manufact, SUM(ss_ext_sales_price) AS ext_price, 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 Avg(ss_quantity), Avg(ss_ext_sales_price), Avg(ss_ext_wholesale_cost), Sum(ss_ext_wholesale_cost) From store_sales Join store On s_store_sk = ss_store_sk Join customer_demographics On cd_demo_sk = ss_cdemo_sk Join household_demographics On hd_demo_sk = ss_hdemo_sk Join customer_address On ca_address_sk = ss_addr... | tpcds |
SELECT cc_name AS call_center_name, SUM(cr_net_loss) AS returns_loss, cc_manager AS manager, cc_call_center_id AS call_center 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 |
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 k.keyword ='character-name-in-title' AND mk.keyword_id = k.id AND t.id = mk.movie_id AND mc.movie_id = mk.movie_id AND cn.country_code ='[nl]' AND cn... | job |
SELECT list_price, extended_price, extended_tax, ss_ticket_number, c_first_name, ca_city, c_last_name, bought_city FROM ( SELECT ss_ticket_number, ss_customer_sk, ca_city AS bought_city, SUM(ss_ext_sales_price) AS extended_price, SUM(ss_ext_list_price) AS list_price, SUM(ss_ext_tax) AS extended_tax FROM store_sales JOI... | tpcds |
select min(n.name) as of_person, min(t.title) as biography_movie from aka_name as an, cast_info as ci, info_type as it, link_type as lt, movie_link as ml, name as n, person_info as pi, title as t where n.id = pi.person_id AND (n.gender = 'm' or (n.gender = 'f' and n.name like 'B%')) AND t.id = ci.movie_id AND n.name_pc... | 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 l_suppkey = s_suppkey And c_nationkey = s_nationkey And s_nationkey = n_nationkey And n_regionkey = r_regionkey And r_name = 1 And o_ord... | tpch |
SELECT MIN(miidx.info) AS rating, MIN(mi.info) AS release_date, 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 it2.id = mi.info_type_id ... | job |
SELECT extended_price, ss_ticket_number, bought_city, c_first_name, c_last_name, extended_tax, list_price, 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(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 LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%') AND it.id = mi_idx.info_type_id AND t.id... | job |
select o_orderpriority, COUNT(*) as order_count from orders where o_orderdate >= DATE 1 AND o_orderdate < DATE 1 + INTERVAL '3' MONTH AND exists ( select * from lineitem where l_orderkey = o_orderkey and l_commitdate < l_receiptdate ) group by o_orderpriority order by o_orderpriority | 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 mc.movie_id = t.id AND t.id = mk.movie_id AND cn.country_code ='[sm]' AND mk.keyword_id = k.id AND cn.id = mc.company_id AND k.keyword ='character-name-in-title' AND mc.movie_id = mk.mo... | job |
select sum(cr_net_loss) as returns_loss, cc_name as call_center_name, cc_manager as manager, cc_call_center_id as call_center 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 c_address, c_name, c_phone, c_acctbal, n_name, c_comment, SUM(l_extendedprice * (1 - l_discount)) AS revenue, 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(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 k.keyword ='character-name-in-title' AND cn.id = mc.company_id AND t.id = mk.movie_id AND mc.movie_id = t.id AND mc.movie_id = mk.movie_id AND cn.country_code =... | 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 kt.kind = 'movie' AND mi_idx.info < '3.5'... | 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 pl.LinkTypeId = 1 AND p.Id = pl.RelatedPostId AND c.UserId = u.Id AND p.Id = v.PostId AND p.Score <= 40 AND b.UserId = u.Id AND p.Id = ph.PostId AND p.Id = c.PostId | stats |
SELECT AVG(cs_sales_price) AS agg4, AVG(cs_list_price) AS agg2, AVG(cs_coupon_amt) AS agg3, i_item_id, AVG(cs_quantity) AS agg1 FROM catalog_sales JOIN customer_demographics ON cs_bill_cdemo_sk = cd_demo_sk JOIN date_dim ON cs_sold_date_sk = d_date_sk JOIN item ON cs_item_sk = i_item_sk JOIN promotion ON cs_promo_sk = ... | tpcds |
SELECT COUNT(*) FROM comments AS c, posts AS p, users AS u WHERE c.CreationDate >= '2010-08-05 00:36:02'::timestamp AND p.FavoriteCount >= 0 AND c.UserId = u.Id AND u.Id = p.OwnerUserId AND p.ViewCount >= 0 AND p.CommentCount >= 0 LIMIT 1000; | stats |
select max(an.name) as cool_actor_pseudonym, max(t.title) as series_named_after_char from aka_name as an, cast_info as ci, company_name as cn, keyword as k, movie_companies as mc, movie_keyword as mk, name as n, title as t where ci.movie_id = mc.movie_id and t.id = mk.movie_id and k.keyword = 'character-name-in-title' ... | 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 it.id = mi.info_type_id AND ct.id = mc.company_type_id AND t.id = mi.movie_id AND (mc.note like '%(co-production)%' or mc.note like '%(presents)%') AND mc.movie_id = mi.movie_id AND ... | job |
SELECT c_last_name, c_first_name, c_preferred_cust_flag, ss_ticket_number, cnt, c_salutation 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 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 ml.movie_id = mk.movie_id AND ct.id... | job |
SELECT MIN(an.name) AS cool_actor_pseudonym, MIN(t.title) AS series_named_after_char FROM aka_name AS an, cast_info AS ci, company_name AS cn, keyword AS k, movie_companies AS mc, movie_keyword AS mk, name AS n, title AS t WHERE t.episode_nr >= 50 AND t.id = mk.movie_id AND t.episode_nr < 100 AND n.id = ci.person_id AN... | job |
SELECT AVG(ss_quantity) AS agg1, AVG(ss_list_price) AS agg2, i_item_id, AVG(ss_sales_price) AS agg4, AVG(ss_coupon_amt) AS agg3 FROM store_sales JOIN customer_demographics ON ss_cdemo_sk = cd_demo_sk JOIN date_dim ON ss_sold_date_sk = d_date_sk JOIN item ON ss_item_sk = i_item_sk JOIN promotion ON ss_promo_sk = p_promo... | tpcds |
SELECT SUM( CASE WHEN o_orderpriority != '1-URGENT' AND o_orderpriority != '2-HIGH' THEN 1 ELSE 0 END ) AS low_line_count, SUM( CASE WHEN o_orderpriority = '1-URGENT' OR o_orderpriority = '2-HIGH' THEN 1 ELSE 0 END ) AS high_line_count, l_shipmode FROM orders, lineitem WHERE l_receiptdate < DATE 1 + INTERVAL '1' YEAR A... | tpch |
select s_name, count(1) as numwait from supplier, lineitem l1, orders, nation where l1.l_receiptdate > l1.l_commitdate AND o_orderstatus = 'F' AND not exists ( select * from lineitem l3 where l3.l_orderkey = l1.l_orderkey and l3.l_suppkey <> l1.l_suppkey and l3.l_receiptdate > l3.l_commitdate ) AND n_name = 1 AND exist... | tpch |
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 rt.id = ci.role_id AND rt.role = 'actor' AND ci.movie_id = mc.movie_id AND cn.country_code = '[ru]' ... | job |
with _q as ( 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 pl.LinkTypeId = 1 ) select * from _q and b.UserId = u.Id and p.Id = c.PostId and p.Id = pl.RelatedPostId and p.Id = v.PostId and p.Id = ph.PostId and c.UserId = u.... | stats |
SELECT MIN(t.title) AS movie_title FROM company_name AS cn, keyword AS k, movie_companies AS mc, movie_keyword AS mk, title AS t WHERE cn.country_code ='[de]' AND mc.movie_id = t.id AND mc.movie_id = mk.movie_id AND mk.keyword_id = k.id AND t.id = mk.movie_id AND k.keyword ='character-name-in-title' AND cn.id = mc.comp... | 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 t.id = mk.movie_id AND t.id = mi.movie_id AND mk.movie_id = mi.movie_id AND t.production_year > 2000 AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Danish', ... | job |
WITH _q AS ( 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 =... | tpcds |
SELECT cc_manager AS manager, cc_name AS call_center_name, SUM(cr_net_loss) AS returns_loss, cc_call_center_id AS call_center FROM call_center JOIN catalog_returns ON cr_call_center_sk = cc_call_center_sk JOIN date_dim ON cr_returned_date_sk = d_date_sk JOIN customer ON cr_returning_customer_sk = c_customer_sk JOIN cus... | tpcds |
select min(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 t.production_year > 2010 and k.keyword = 'marvel-cinematic-universe' and k.id = mk.keyword_id and t.id = mk.movie_id... | job |
SELECT AVG(ss_quantity), AVG(ss_ext_sales_price), AVG(ss_ext_wholesale_cost), SUM(ss_ext_wholesale_cost) FROM store_sales JOIN store ON s_store_sk = ss_store_sk JOIN customer_demographics ON cd_demo_sk = ss_cdemo_sk JOIN household_demographics ON hd_demo_sk = ss_hdemo_sk JOIN customer_address ON ca_address_sk = ss_addr... | tpcds |
SELECT o_year, SUM( CASE WHEN nation = 1 THEN volume ELSE 0 END ) / SUM(volume) AS mkt_share FROM ( SELECT EXTRACT(YEAR FROM o_orderdate) AS o_year, l_extendedprice * (1 - l_discount) AS volume, n2.n_name AS nation FROM part, supplier, lineitem, orders, customer, nation n1, nation n2, region WHERE p_type = 1 ) AS all_n... | tpch |
select s_name, s_acctbal, s_phone, s_address, p_mfgr, n_name, s_comment, p_partkey 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 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 LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%') AND t.id = mc.movie_id AND it.info = 'to... | 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 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 AND n_regionkey... | tpch |
SELECT supp_nation, cust_nation, l_year, SUM(volume) AS revenue FROM ( SELECT n1.n_name AS supp_nation, n2.n_name AS cust_nation, EXTRACT(YEAR FROM l_shipdate) AS l_year, l_extendedprice * (1 - l_discount) AS volume FROM supplier, lineitem, orders, customer, nation n1, nation n2 WHERE c_custkey = o_custkey AND s_suppke... | tpch |
Select i_brand_id As brand_id, Sum(ss_ext_sales_price) As ext_price, i_brand As brand From date_dim Join store_sales On d_date_sk = ss_sold_date_sk Join item On ss_item_sk = i_item_sk Where i_manager_id = 33 And d_moy = 11 And d_year = 2001 Group By i_brand, i_brand_id Order By ext_price ASC, brand_id Limit 100; | tpcds |
SELECT MIN(k.keyword) AS movie_keyword, MIN(n.name) AS actor_name, MIN(t.title) AS marvel_movie FROM cast_info AS ci, keyword AS k, movie_keyword AS mk, name AS n, title AS t WHERE t.id = mk.movie_id AND k.id = mk.keyword_id AND n.id = ci.person_id AND t.production_year > 2010 AND t.id = ci.movie_id AND k.keyword = 'ma... | job |
SELECT MIN(t.title) AS american_movie FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info AS mi, title AS t WHERE t.id = mi.movie_id AND ct.kind = 'production companies' AND t.id = mc.movie_id AND mc.movie_id = mi.movie_id AND it.id = mi.info_type_id AND (mc.note LIKE '%(co-production)%' OR mc.n... | job |
WITH _q AS ( SELECT COUNT(*) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v, badges AS b WHERE p.Id = pl.RelatedPostId AND b.UserId = c.UserId AND pl.LinkTypeId = 1 ) SELECT * FROM _q AND p.Id = ph.PostId AND p.Id = c.PostId AND c.Score = 0 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_orderkey = o_orderkey AND o_orderdate >= DATE 1 AND l_suppkey = s_suppkey AND n_regionkey = r_regionkey AND c_custkey = o_custkey AND r_name = 1 AND o_orderdate < DATE 1 + INTERVAL '1' YEA... | 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 p_type = 1 ) as all_n... | tpch |
Select p_brand, p_type, p_size, Count(Distinct ps_suppkey) As supplier_cnt From partsupp, part Where p_type Not Like 1 AND p_brand <> 1 AND p_size = ANY(ARRAY[1, 1, 1, 1, 1, 1, 1, 1]) AND ps_suppkey Not In ( Select s_suppkey From supplier Where s_comment Like '%Customer%Complaints%' ) AND p_partkey = ps_partkey Group B... | tpch |
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 d_year = 2000 AND d_moy = 11 AND i_manager_id = 84 GROUP BY i_brand, i_brand_id ORDER BY ext_price DESC, brand_id LIM... | tpcds |
SELECT n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, supplier, nation, region WHERE c_custkey = o_custkey AND s_nationkey = n_nationkey AND n_regionkey = r_regionkey AND o_orderdate >= DATE 1 AND l_orderkey = o_orderkey AND c_nationkey = s_nationkey AND r_name = 1 AND l_sup... | tpch |
SELECT ss_ticket_number, cnt, c_last_name, c_first_name, c_preferred_cust_flag, c_salutation 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 movie_title From info_type As it, movie_info_idx As mi_idx, title As t Where t.id = mi_idx.movie_id And it.id = mi_idx.info_type_id And mi_idx.info > '8.0' And t.production_year Between 2000 And 2005 And it.info ='rating' Limit 20; | job |
SELECT COUNT(*) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v WHERE p.Id = pl.PostId AND pl.LinkTypeId = 1 AND p.Id = ph.PostId AND p.Id = c.PostId AND c.Score = 0 AND p.FavoriteCount >= 0 AND p.Id = v.PostId | stats |
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 mc.note Not Like '%(As Metro-Goldwyn-Mayer Pictures)%' AND t.id = mc.mov... | job |
SELECT cust_nation, supp_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 ( (n1.n_name = 1 AND n2.n_name = 1... | 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 t.id = ci.movie_id AND chn.id = ci.person_role_id AND mi.movie_id = ci.mo... | job |
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 Not Exists ( Select * From orders Where o_custkey = c_custkey ) ) As custsale AND c_acctbal > ( Select Avg(c_acctbal) From customer Where c_acctbal > 0.00 And SUB... | tpch |
SELECT MIN(mc.note) AS production_note, MIN(t.title) AS movie_title, MIN(t.production_year) AS movie_year FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info_idx AS mi_idx, title AS t WHERE t.id = mi_idx.movie_id AND (mc.note LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%') AND t.id = mc... | job |
Select Avg(ss_quantity), Avg(ss_ext_sales_price), Avg(ss_ext_wholesale_cost), Sum(ss_ext_wholesale_cost) From store_sales Join store On s_store_sk = ss_store_sk Join customer_demographics On cd_demo_sk = ss_cdemo_sk Join household_demographics On hd_demo_sk = ss_hdemo_sk Join customer_address On ca_address_sk = ss_addr... | tpcds |
Select 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(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 mc.note like '%(USA)%' AND mi.movie... | 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.id = mk.keyword_id AND n.name LIKE '%Hemsworth%Chris%' AND ci.movie_id = mk.movie_id AND t.id = ci.movie_id AND k.keyword = 'marvel-cinem... | job |
SELECT p_size, p_brand, COUNT(DISTINCT ps_suppkey) AS supplier_cnt, p_type FROM partsupp, part WHERE p_size IN (1, 1, 1, 1, 1, 1, 1, 1) AND p_partkey = ps_partkey AND p_brand <> 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(n.name) AS actor_name, MIN(k.keyword) AS movie_keyword, MIN(t.title) AS marvel_movie FROM cast_info AS ci, keyword AS k, movie_keyword AS mk, name AS n, title AS t WHERE n.id = ci.person_id AND n.name LIKE '%Hemsworth%Chris%' AND t.production_year > 2010 AND k.id = mk.keyword_id AND ci.movie_id = mk.movie_id... | job |
SELECT c_address, c_custkey, c_phone, SUM(l_extendedprice * (1 - l_discount)) AS revenue, c_acctbal, n_name, c_name, c_comment 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 p_brand, p_type, p_size, COUNT(DISTINCT ps_suppkey) AS supplier_cnt FROM partsupp, part WHERE p_partkey = ps_partkey AND p_brand <> 1 AND p_type NOT LIKE 1 AND p_size = ANY(ARRAY[1, 1, 1, 1, 1, 1, 1, 1]) AND ps_suppkey NOT IN ( SELECT s_suppkey FROM supplier WHERE s_comment LIKE '%Customer%Complaints%' ) GROUP B... | 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 t.id = mc.movie_id AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictur... | job |
SELECT MAX(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 LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%') AND it.id = mi.info_type_id AND t.id = mi.movie_id AND it.info = 'bottom 10 rank' AND mc.note NOT LIKE '%(as Metro-G... | job |
Select Count(*) From postHistory As ph, posts As p, users As u Where p.OwnerUserId = u.Id AND ph.PostId = p.Id AND ph.PostHistoryTypeId = 5 AND p.Score >= -1 | stats |
WITH _q AS ( SELECT COUNT(1) FROM comments AS c, badges AS b, users AS u WHERE c.Score = 0 AND u.UpVotes >= 0 ) SELECT * FROM _q AND u.Id = c.UserId AND c.UserId = b.UserId LIMIT 10; | 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 mi.info = ANY(ARRAY['Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Denish', 'Norwegian', 'German']) AND t.id = mk.movie_id AND t.id = mi.movie_id AND... | job |
SELECT MIN(mi_idx.info) AS rating, MIN(t.title) AS movie_title FROM info_type AS it, movie_info_idx AS mi_idx, title AS t WHERE it.id = mi_idx.info_type_id AND t.production_year BETWEEN 2000 AND 2010 AND it.info ='rating' AND mi_idx.info > '7.0' AND t.id = mi_idx.movie_id LIMIT 100; | job |
Select Count(*) From comments As c, posts As p, postLinks As pl, postHistory As ph, votes As v, badges As b Where p.Id = pl.RelatedPostId And pl.LinkTypeId = 1 And p.Id = ph.PostId And b.UserId = c.UserId And p.Id = c.PostId And c.Score = 0 And p.Id = v.PostId | stats |
select cc_name as call_center_name, cc_call_center_id as call_center, sum(cr_net_loss) as returns_loss, cc_manager as manager 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 i_item_desc, 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, s_store_id, i_item_id 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 Count(*) From comments As c, posts As p, postLinks As pl, postHistory As ph, votes As v, users As u Where p.Id = ph.PostId And p.Id = pl.PostId And p.PostTypeId = 1 And p.Id = c.PostId And p.Id = v.PostId And u.Id = p.OwnerUserId And p.AnswerCount >= 0 | stats |
SELECT MIN(n.name) AS voicing_actress, MIN(t.title) AS voiced_movie FROM aka_name AS an, char_name AS chn, cast_info AS ci, company_name AS cn, info_type AS it, movie_companies AS mc, movie_info AS mi, name AS n, role_type AS rt, title AS t WHERE n.id = ci.person_id AND ci.note IN ('(voice)', '(voice: Japanese version)... | 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 |
WITH _q AS ( Select p_size, Count(Distinct ps_suppkey) As supplier_cnt, p_brand, p_type From partsupp, part Where ps_suppkey Not In ( Select s_suppkey From supplier Where s_comment Like '%Customer%Complaints%' ) And p_brand <> 1 And p_type Not Like 1 And p_size In (1, 1, 1, 1, 1, 1, 1, 1) And p_partkey = ps_partkey Gro... | tpch |
SELECT COUNT(*) FROM comments AS c, postHistory AS ph, votes AS v, users AS u WHERE v.UserId = ph.UserId AND u.Id = v.UserId AND ph.UserId = c.UserId AND u.DownVotes >= 0 AND u.Views >= 0 AND u.UpVotes <= 123 | 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 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 supp_nation, cust_nation, l_year, SUM(volume) AS revenue FROM ( SELECT n1.n_name AS supp_nation, n2.n_name AS cust_nation, EXTRACT(YEAR FROM l_shipdate) AS l_year, l_extendedprice * (1 - l_discount) AS volume FROM supplier, lineitem, orders, customer, nation n1, nation n2 WHERE c_nationkey = n2.n_nationkey AND l... | tpch |
WITH _q AS ( SELECT MIN(t.title) AS movie_title FROM company_name AS cn, keyword AS k, movie_companies AS mc, movie_keyword AS mk, title AS t WHERE k.keyword ='character-name-in-title' AND 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 ='[nl]' AND cn... | job |
WITH _q AS ( 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 t.production_year > 2000 AND k.id = mk.keyword_id ) SELECT * FROM _q AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Danish', 'No... | job |
SELECT AVG(ss_quantity), AVG(ss_ext_sales_price), AVG(ss_ext_wholesale_cost), SUM(ss_ext_wholesale_cost) FROM store_sales JOIN store ON s_store_sk = ss_store_sk JOIN customer_demographics ON cd_demo_sk = ss_cdemo_sk JOIN household_demographics ON hd_demo_sk = ss_hdemo_sk JOIN customer_address ON ca_address_sk = ss_addr... | tpcds |
select count(*) from comments as c, users as u where c.UserId = u.Id and c.Score = 0 LIMIT 500; | 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 t.id = mi_idx.movie_id AND mi_idx.info < '3.5' AND cn.id = mc.company_... | job |
select i_brand_id as brand_id, i_brand as brand, i_manufact_id, i_manufact, sum(ss_ext_sales_price) as ext_price from date_dim 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 count(*) from store_sales INNER JOIN household_demographics on ss_hdemo_sk = hd_demo_sk INNER JOIN time_dim on ss_sold_time_sk = t_time_sk INNER JOIN store on ss_store_sk = s_store_sk where t_hour = 14 and hd_dep_count = 4 and s_store_name = 'pri' and t_minute >= 30 order by count(*) desc limit 100; | tpcds |
SELECT MIN(t.title) AS american_movie FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info AS mi, title AS t WHERE mc.movie_id = mi.movie_id AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND t.id = mi.movie_id AND it.info = 'bottom 10 rank' AND t.id = mc.movie_id AND (mc.note LIKE '%... | 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(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 LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%') AND t.id = mi.movie_id AND ct.id = mc.company_type_id AND mc.note NOT LIKE '%(as Metro-G... | job |
SELECT AVG(cs_list_price) AS agg2, AVG(cs_sales_price) AS agg4, AVG(cs_coupon_amt) AS agg3, AVG(cs_quantity) AS agg1, i_item_id FROM catalog_sales JOIN customer_demographics ON cs_bill_cdemo_sk = cd_demo_sk JOIN date_dim ON cs_sold_date_sk = d_date_sk JOIN item ON cs_item_sk = i_item_sk JOIN promotion ON cs_promo_sk = ... | tpcds |
SELECT 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 ( (n1.n_name = 1 AND n2.n_name = 1... | tpch |
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 p_brand, p_type, p_size, count(distinct ps_suppkey) as supplier_cnt from partsupp, part where 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%' ) AND p_partkey = ps_partkey group by p_brand... | tpch |
SELECT AVG(ss_quantity), AVG(ss_ext_sales_price), AVG(ss_ext_wholesale_cost), SUM(ss_ext_wholesale_cost) FROM store_sales JOIN store ON s_store_sk = ss_store_sk JOIN customer_demographics ON cd_demo_sk = ss_cdemo_sk JOIN household_demographics ON hd_demo_sk = ss_hdemo_sk JOIN customer_address ON ca_address_sk = ss_addr... | tpcds |
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 mi.info IN ('Sweden', 'Norway', 'Germany', 'Danish', 'Swedish', 'Danish', 'Norwegian', 'German') AND t.production_year > 2010 AND t.id = mi.movie_id AND k.keyword LIKE '%sequel%' A... | job |
SELECT s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE n_name = 1 AND s_suppkey = l1.l_suppkey AND o_orderkey = l1.l_orderkey AND o_orderstatus = 'F' 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_or... | tpch |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.