text stringlengths 84 1.49k | benchmark stringclasses 4
values |
|---|---|
SELECT o_shippriority, l_orderkey, o_orderdate, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem WHERE o_orderdate < DATE 1 AND l_shipdate > 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 |
SELECT COUNT(*) AS count_order, AVG(l_extendedprice) AS avg_price, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, SUM(l_extendedprice) AS sum_base_price, l_returnflag, l_linestatus, AVG(l_quantity) AS avg_qty, AVG(l_discount) AS avg_disc, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, ... | tpch |
select max(mc.note) as production_note, max(t.title) as movie_title, max(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 ct.kind = 'production companies' AND it.id = mi_idx.info_type_id AND ct.id = mc... | job |
SELECT o_year, SUM(amount) AS sum_profit, 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 p_partkey = l_partkey AND ps_partkey = l_partkey AND ps_suppk... | tpch |
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 s_name, s_address, s_phone, s_suppkey, total_revenue FROM supplier, revenue0 WHERE s_suppkey = supplier_no AND total_revenue = ( SELECT MAX(total_revenue) FROM revenue0 ) ORDER BY s_suppkey | tpch |
SELECT s_acctbal, s_name, n_name, p_partkey, p_mfgr, s_address, s_phone, s_comment FROM part, supplier, partsupp, nation, region WHERE r_name = 1 AND s_nationkey = n_nationkey AND p_size = 1 AND p_partkey = ps_partkey AND n_regionkey = r_regionkey AND s_suppkey = ps_suppkey AND ps_supplycost = ( SELECT MIN(ps_supplycos... | tpch |
SELECT MIN(t.title) AS german_movie, MIN(mi.info) AS release_date, MIN(miidx.info) AS rating FROM company_name AS cn, company_type AS ct, info_type AS it, info_type AS it2, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS miidx, title AS t WHERE mi.movie_id = t.id AND mc.movie_id = t.id AND k... | job |
SELECT COUNT(*) FROM postHistory AS ph, posts AS p, users AS u, badges AS b WHERE u.Id = b.UserId AND u.Reputation >= 1 AND ph.PostHistoryTypeId = 3 AND p.OwnerUserId = u.Id AND p.Score >= -7 AND ph.UserId = u.Id LIMIT 500; | stats |
SELECT AVG(l_extendedprice) AS avg_price, COUNT(*) AS count_order, l_returnflag, AVG(l_quantity) AS avg_qty, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, AVG(l_discount) AS avg_disc, SUM(l_quantity) AS sum_qty, SUM(l_extendedprice) AS sum_base_price, SUM(l_extendedprice * (1 - l_discount)) AS su... | tpch |
Select extended_tax, c_last_name, ss_ticket_number, bought_city, list_price, c_first_name, ca_city, extended_price From ( Select ss_ticket_number, ss_customer_sk, ca_city As bought_city, Sum(ss_ext_sales_price) As extended_price, Sum(ss_ext_list_price) As list_price, Sum(ss_ext_tax) As extended_tax From store_sales Joi... | tpcds |
SELECT MIN(chn.name) AS uncredited_voiced_character, MIN(t.title) AS russian_movie FROM char_name AS chn, cast_info AS ci, company_name AS cn, company_type AS ct, movie_companies AS mc, role_type AS rt, title AS t WHERE t.id = ci.movie_id AND cn.country_code = '[ru]' AND cn.id = mc.company_id AND ci.note LIKE '%(voice)... | job |
SELECT l_year, cust_nation, supp_nation, 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 o... | 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 cn.country_code ='[nl]' and mc.movie_id = t.id and mk.keyword_id = k.id and mc.movie_id = mk.movie_id and cn.id = mc.company_id and k.keyword ='character-name-in-title' and t.id = mk.mo... | 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 s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE 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 l1.l_receiptdate > l1.l_commitdate AND s_suppkey = l1.l_suppkey AND o_orderstatus =... | 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 = mk.movie_id AND k.keyword = 'marvel-cinematic-universe' AND k.id = mk.keyword_id AND n.id = ci.person_id AND t.production_year > 201... | job |
SELECT p_brand, p_size, p_type, COUNT(DISTINCT ps_suppkey) AS supplier_cnt FROM partsupp, part WHERE p_type NOT LIKE 1 AND p_brand <> 1 AND p_size IN (1, 1, 1, 1, 1, 1, 1, 1) AND p_partkey = ps_partkey AND ps_suppkey NOT IN ( SELECT s_suppkey FROM supplier WHERE s_comment LIKE '%Customer%Complaints%' ) GROUP BY p_brand... | tpch |
SELECT p_type, COUNT(DISTINCT ps_suppkey) AS supplier_cnt, p_brand, p_size 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(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 it.id = mi_id... | 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 c_first_name, c_salutation, ss_ticket_number, c_preferred_cust_flag, cnt, c_last_name FROM ( SELECT ss_ticket_number, ss_customer_sk, COUNT(*) AS cnt FROM store_sales INNER JOIN date_dim ON ss_sold_date_sk = d_date_sk INNER JOIN store ON ss_store_sk = s_store_sk INNER JOIN household_demographics ON ss_hdemo_sk =... | tpcds |
select min(t.title) as movie_title from company_name as cn, keyword as k, movie_companies as mc, movie_keyword as mk, title as t where mc.movie_id = mk.movie_id and cn.country_code ='[nl]' and mc.movie_id = t.id and cn.id = mc.company_id and k.keyword ='character-name-in-title' and mk.keyword_id = k.id and t.id = mk.mo... | job |
SELECT i_brand AS brand, i_brand_id AS brand_id, 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 = 2001 AND d_moy = 11 AND i_manager_id = 33 GROUP BY i_brand, i_brand_id ORDER BY ext_price DESC, brand_id LIMIT 100; | tpcds |
Select Count(1) From votes As v, posts As p, users As u Where v.UserId = u.Id And p.PostTypeId = 1 And v.PostId = p.Id And u.Reputation >= 1 | stats |
Select cc_call_center_id As call_center, Sum(cr_net_loss) As returns_loss, cc_name As call_center_name, 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 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 cn.country_code = '[jp]' AND n1.id = ci.person_id AND an1.person_id = ci.person_id AND an1.person_id = n1.id AN... | job |
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 = v.PostId and p.Id = c.PostId and p.Id = ph.PostId and p.FavoriteCount >= 0 and c.Score = 0 and p.Id = pl.PostId | stats |
SELECT s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE o_orderkey = l1.l_orderkey AND n_name = 1 AND o_orderstatus = 'F' AND l1.l_receiptdate > l1.l_commitdate AND EXISTS ( SELECT * FROM lineitem l2 WHERE l2.l_orderkey = l1.l_orderkey AND l2.l_suppkey <> l1.l_suppkey ) AND NOT EXISTS ( SELE... | tpch |
SELECT SUM(ss_ext_sales_price) AS ext_price, i_manufact, i_manufact_id, i_brand_id AS brand_id, 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 JOIN customer ON ss_customer_sk = c_customer_sk JOIN customer_address ON c_current_addr_sk = ca_address_sk JO... | tpcds |
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 n.id = ci.person_id AND ci.movie_id = mk.movie_id AND k.keyword = 'marvel-cinematic-universe' AND t.id = mk.movie_id AND k.id = mk.keyword_... | job |
SELECT COUNT(1) FROM comments AS c, posts AS p, postLinks AS pl, votes AS v WHERE pl.PostId = v.PostId AND c.CreationDate >= '2010-08-02 23:52:10'::timestamp AND v.VoteTypeId = 2 AND p.Id = c.PostId AND p.Score >= -3 AND c.PostId = pl.PostId | stats |
SELECT s_name, s_address, s_suppkey, total_revenue, s_phone FROM supplier, revenue0 WHERE s_suppkey = supplier_no AND total_revenue = ( SELECT MAX(total_revenue) FROM revenue0 ) ORDER BY s_suppkey | tpch |
SELECT MIN(mi_idx.info) AS rating, MIN(t.title) AS movie_title FROM info_type AS it, movie_info_idx AS mi_idx, title AS t WHERE t.id = mi_idx.movie_id AND t.production_year >= 2000 AND t.production_year <= 2010 AND it.info ='rating' AND mi_idx.info > '7.0' AND it.id = mi_idx.info_type_id LIMIT 20; | 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 mi_idx.movie_id = mc.movie_id AND it1.info = 'rating' AND t.id = mi_id... | job |
SELECT SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, AVG(l_extendedprice) AS avg_price, COUNT(*) AS count_order, l_linestatus, AVG(l_quantity) AS avg_qty, SUM(l_extendedprice) AS sum_base_price, l_returnflag, SUM(l_quantity) AS sum_qty, A... | 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 l_shipdate BETWEEN DATE '1995-01-0... | tpch |
SELECT ca_city, bought_city, c_first_name, extended_tax, ss_ticket_number, c_last_name, extended_price, list_price FROM ( SELECT ss_ticket_number, ss_customer_sk, ca_city AS bought_city, SUM(ss_ext_sales_price) AS extended_price, SUM(ss_ext_list_price) AS list_price, SUM(ss_ext_tax) AS extended_tax FROM store_sales JOI... | tpcds |
SELECT 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 ci.note = '(voice: English version)' AND ci.movie_id = mc.movie_id AND n1.id = ci.person_id AND cn.country_code... | job |
SELECT AVG(ss_quantity), AVG(ss_ext_sales_price), AVG(ss_ext_wholesale_cost), SUM(ss_ext_wholesale_cost) 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 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 ci.movie_id = mk.movie_id And n.id = ci.person_id And t.id = mk.movie_id And t.id = ci.movie_id And k.key... | job |
SELECT o_year, SUM( CASE WHEN nation = 1 THEN volume ELSE 0 END ) / SUM(volume) AS mkt_share FROM ( SELECT EXTRACT(YEAR FROM o_orderdate) AS o_year, l_extendedprice * (1 - l_discount) AS volume, n2.n_name AS nation FROM part, supplier, lineitem, orders, customer, nation n1, nation n2, region WHERE s_suppkey = l_suppkey... | tpch |
SELECT MIN(n.name) AS voicing_actress, MIN(t.title) AS voiced_movie FROM aka_name AS an, char_name AS chn, cast_info AS ci, company_name AS cn, info_type AS it, movie_companies AS mc, movie_info AS mi, name AS n, role_type AS rt, title AS t WHERE n.gender = 'f' AND ci.role_id = rt.id AND mi.movie_id = mc.movie_id AND m... | job |
SELECT MIN(an1.name) AS actress_pseudonym, MIN(t.title) AS japanese_movie_dubbed FROM aka_name AS an1, cast_info AS ci, company_name AS cn, movie_companies AS mc, name AS n1, role_type AS rt, title AS t WHERE ci.movie_id = mc.movie_id AND ci.role_id = rt.id AND n1.name NOT LIKE '%Yu%' AND ci.note = '(voice: English ver... | 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.id = mk.keyword_id And t.id = mi.movie_id And k.keyword Like '%sequel%' And mi.info In ('Sweden', 'Norway', 'Germany', 'Danish', 'Swedish', 'Danish', 'Norwegian', 'German') And t.id = mk.movie_id And mk.movie... | job |
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 v.UserId = c.UserId AND b.UserId = ph.UserId AND u.Id = b.UserId AND ph.PostHistoryTypeId = 12 AND u.UpVotes = 0 | stats |
Select cntrycode, Count(*) 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 Count(*) From votes As v, posts As p, users As u Where p.PostTypeId = 1 AND u.Reputation >= 1 AND v.UserId = u.Id AND v.PostId = p.Id Limit 100; | 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 mc.movie_id = t.id And it.id = miidx.info_type_... | 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 = mc.movie_id AND rt.role = 'actress' AND n.gender = 'f'... | job |
SELECT MAX(mi_idx.info) AS rating, MAX(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 it1.info = 'rating' AND it1.id = mi_idx.info_type_id AND mi_idx.info <... | job |
SELECT p_size, p_type, p_brand, 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 ps_suppkey NOT IN ( SELECT s_suppkey FROM supplier WHERE s_comment LIKE '%Customer%Complaints%' ) AND p_brand <> 1 AND p_partkey = ps_partkey GROUP BY p_brand... | tpch |
SELECT MIN(n.name) AS of_person, MIN(t.title) AS biography_movie FROM aka_name AS an, cast_info AS ci, info_type AS it, link_type AS lt, movie_link AS ml, name AS n, person_info AS pi, title AS t WHERE it.info = 'mini biography' AND an.person_id = ci.person_id AND lt.link = 'features' AND pi.note = 'Volker Boehm' AND c... | job |
WITH year_total AS ( SELECT c_login AS customer_login, c_email_address AS customer_email_address, 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_customer_id AS customer_id, d_year AS dyear, c_first_name AS customer_first_name, c_prefe... | 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 ct.kind = 'production companies' AND it.info = 'bottom 10 rank' AND t.id = mi.movie_id AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND t.id = mc.movie_id AND it.id = m... | 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 pl.LinkTypeId = 1 AND p.Id = v.PostId AND p.Id = c.PostId AND p.Id = pl.RelatedPostId AND c.UserId = u.Id AND p.Id = ph.PostId AND b.UserId = u.Id | stats |
select p_brand, p_type, p_size, count(distinct ps_suppkey) as supplier_cnt from partsupp, part where p_brand <> 1 AND p_type not like 1 AND p_size in (1, 1, 1, 1, 1, 1, 1, 1) AND ps_suppkey not in ( select s_suppkey from supplier where s_comment like '%Customer%Complaints%' ) AND p_partkey = ps_partkey group by p_brand... | tpch |
SELECT s_acctbal, s_name, n_name, p_partkey, p_mfgr, s_address, s_phone, s_comment FROM part, supplier, partsupp, nation, region WHERE r_name = 1 AND p_type LIKE 1 AND p_size = 1 AND n_regionkey = r_regionkey AND s_nationkey = n_nationkey AND s_suppkey = ps_suppkey AND p_partkey = ps_partkey AND ps_supplycost = ( SELEC... | 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 ct.id = mc.company_type_id AND it.info = 'bottom 10 rank' AND (mc.note LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%') AND t.id = mc.movie_id AND ct.kind = 'production compa... | job |
SELECT COUNT(1) 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 = pl.RelatedPostId AND p.Id = ph.PostId AND c.Score = 0 AND pl.LinkTypeId = 1 AND b.UserId = c.UserId AND p.Id = c.PostId | 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 at.title LIKE '%Champion%' AND mi.movie_id = mi_idx.movie_id AND it1.i... | 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.keyword Like '%sequel%' And mi.info In ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Danish', 'Norwegian', 'German') And mk.movie_id = mi.movie_id And k.id = mk.keyword_id And ... | 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(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 ci.note LIKE '%(voice: English version)%' AND cn.id = mc.comp... | 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 mc.company_id = cn.id AND t.episode_nr >= 50 AND ci.movie_id = t.id AND ci.movie_id = mk.mo... | job |
SELECT s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE s_nationkey = n_nationkey AND n_name = 1 AND s_suppkey = l1.l_suppkey AND 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... | tpch |
select min(t.production_year) as movie_year, min(mc.note) as production_note, min(t.title) as movie_title from company_type as ct, info_type as it, movie_companies as mc, movie_info_idx as mi_idx, title as t where mc.note not like '%(as Metro-Goldwyn-Mayer Pictures)%' and ct.id = mc.company_type_id and t.id = mi_idx.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 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 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 o_orderdate BETWEEN D... | 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 cn.id = mc.company_id AND ci.person_id = an.perso... | job |
SELECT s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE s_suppkey = l1.l_suppkey AND s_nationkey = n_nationkey AND o_orderstatus = 'F' AND l1.l_receiptdate > l1.l_commitdate AND EXISTS ( SELECT * FROM lineitem l2 WHERE l2.l_orderkey = l1.l_orderkey AND l2.l_suppkey != l1.l_suppkey ) AND o_or... | tpch |
SELECT COUNT(1) 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 = v.PostId AND p.Id = ph.PostId AND p.Id = c.PostId AND b.UserId = u.Id AND p.Id = pl.RelatedPostId AND p.Score <= 40 AND c.UserId = u.Id | stats |
SELECT COUNT(ss_quantity) AS store_sales_quantitycount, STDDEV_SAMP(sr_return_quantity) / AVG(sr_return_quantity) AS store_returns_quantitycov, COUNT(cs_quantity) AS catalog_sales_quantitycount, AVG(sr_return_quantity) AS store_returns_quantityave, AVG(cs_quantity) AS catalog_sales_quantityave, i_item_desc, COUNT(sr_re... | tpcds |
SELECT o_orderdate, o_orderkey, SUM(l_quantity), o_totalprice, c_custkey, 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 n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, supplier, nation, region WHERE l_orderkey = o_orderkey AND c_custkey = o_custkey AND s_nationkey = n_nationkey AND r_name = 1 AND o_orderdate < DATE 1 + INTERVAL '1' YEAR AND n_regionkey = r_regionkey AND l_suppkey = s_su... | tpch |
SELECT COUNT(1) 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 AND c.UserId = u.Id AND p.Id = ph.PostId AND p.Id = pl.RelatedPostId AND p.Id = v.PostId AND p.Id = c.PostId AND b.UserId = u.Id | stats |
SELECT promotions, total, CAST(promotions AS DECIMAL(15, 4)) / CAST(total AS DECIMAL(15, 4)) * 100 FROM ( SELECT SUM(ss_ext_sales_price) AS promotions FROM store_sales JOIN store ON ss_store_sk = s_store_sk JOIN promotion ON ss_promo_sk = p_promo_sk JOIN date_dim ON ss_sold_date_sk = d_date_sk JOIN customer ON ss_custo... | tpcds |
SELECT COUNT(*) FROM postHistory AS ph, posts AS p, votes AS v, badges AS b, users AS u, comments AS c WHERE p.Score <= 192 AND p.Id = ph.PostId AND p.Id = v.PostId AND u.Id = p.OwnerUserId AND p.Id = c.PostId AND p.ViewCount >= 0 AND u.Id = b.UserId LIMIT 500; | stats |
SELECT MIN(t.production_year) AS movie_year, MIN(mc.note) AS production_note, MIN(t.title) AS movie_title 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.id = mc.company_type_id AND it.info = 'top 250 rank' AND (mc.note LIK... | job |
SELECT MIN(k.keyword) AS movie_keyword, MIN(n.name) AS actor_name, MIN(t.title) AS marvel_movie FROM cast_info AS ci, keyword AS k, movie_keyword AS mk, name AS n, title AS t WHERE k.keyword = 'marvel-cinematic-universe' AND t.production_year > 2010 AND n.id = ci.person_id AND t.id = mk.movie_id AND n.name LIKE '%Downe... | job |
Select dt.d_year, item.i_brand_id As brand_id, item.i_brand As brand, Sum(ss_ext_sales_price) As sum_agg From date_dim As dt Join store_sales On dt.d_date_sk = store_sales.ss_sold_date_sk Join item On store_sales.ss_item_sk = item.i_item_sk Where dt.d_moy = 12 And item.i_manufact_id = 691 Group By dt.d_year, item.i_bra... | tpcds |
SELECT COUNT(1) FROM comments AS c, posts AS p, postHistory AS ph, votes AS v, users AS u WHERE c.UserId = p.OwnerUserId AND u.Id = c.UserId AND p.Score <= 13 AND p.OwnerUserId = ph.UserId AND ph.UserId = v.UserId AND p.AnswerCount >= 0 | stats |
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(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.role_id = rt.id AND n1.name LIKE '%Yo%' AND mc.note LIKE '%(Japan)%' AND n1... | job |
Select Count(*) From comments As c, posts As p, votes As v, users As u Where p.Score >= 0 And u.Id = c.UserId And u.Id = v.UserId And u.Id = p.OwnerUserId And p.ViewCount >= 0 And c.Score = 0 | stats |
SELECT SUM(l_extendedprice * (1 - l_discount)) AS revenue, n_name FROM customer, orders, lineitem, supplier, nation, region WHERE l_orderkey = o_orderkey AND l_suppkey = s_suppkey AND s_nationkey = n_nationkey AND c_custkey = o_custkey AND o_orderdate >= DATE 1 AND c_nationkey = s_nationkey AND o_orderdate < DATE 1 + I... | tpch |
SELECT AVG(l_discount) AS avg_disc, COUNT(*) AS count_order, l_linestatus, AVG(l_quantity) AS avg_qty, SUM(l_extendedprice) AS sum_base_price, AVG(l_extendedprice) AS avg_price, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, SUM(l_quantity) AS sum_qty, l_returnflag, SUM(l_extendedprice * (1 - l_di... | tpch |
SELECT s_name, s_address FROM supplier, nation WHERE n_name = 1 AND s_nationkey = n_nationkey AND s_suppkey IN ( SELECT ps_suppkey FROM partsupp WHERE ps_partkey IN ( SELECT p_partkey FROM part WHERE p_name LIKE 1 ) AND ps_availqty > ( SELECT 0.5 * SUM(l_quantity) FROM lineitem WHERE l_partkey = ps_partkey AND l_suppke... | tpch |
SELECT AVG(l_quantity) AS avg_qty, AVG(l_discount) AS avg_disc, COUNT(*) AS count_order, AVG(l_extendedprice) AS avg_price, SUM(l_extendedprice) AS sum_base_price, l_returnflag, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, SUM(l_quantity) AS sum_qty, SUM(l_extendedprice * (1 - l_discount)) AS su... | tpch |
WITH year_total AS ( SELECT c_last_name AS customer_last_name, c_email_address AS customer_email_address, c_customer_id AS customer_id, c_birth_country AS customer_birth_country, c_preferred_cust_flag AS customer_preferred_cust_flag, c_login AS customer_login, 's' AS sale_type, SUM(((ss_ext_list_price - ss_ext_wholesal... | tpcds |
SELECT o_orderkey, SUM(l_quantity), o_totalprice, o_orderdate, c_name, c_custkey FROM customer, orders, lineitem WHERE o_orderkey IN ( SELECT l_orderkey FROM lineitem GROUP BY l_orderkey HAVING SUM(l_quantity) > 1 ) AND c_custkey = o_custkey AND o_orderkey = l_orderkey GROUP BY c_name, c_custkey, o_orderkey, o_orderdat... | tpch |
Select o_year, nation, 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 s_nationkey = n_nationkey AND o_or... | tpch |
Select Min(an1.name) As actress_pseudonym, Min(t.title) As japanese_movie_dubbed From aka_name As an1, cast_info As ci, company_name As cn, movie_companies As mc, name As n1, role_type As rt, title As t Where mc.note Not Like '%(USA)%' And mc.company_id = cn.id And t.id = mc.movie_id And ci.role_id = rt.id And an1.pers... | job |
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(Distinct ps_suppkey) As supplier_cnt, p_brand, p_size, p_type From partsupp, part Where p_type Not Like 1 AND ps_suppkey Not In ( Select s_suppkey From supplier Where s_comment Like '%Customer%Complaints%' ) AND p_brand <> 1 AND p_partkey = ps_partkey AND p_size = ANY(ARRAY[1, 1, 1, 1, 1, 1, 1, 1]) Group B... | 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 cn.id = mc.company_id 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.country_code =... | job |
Select Avg(ss_quantity), Avg(ss_ext_sales_price), Avg(ss_ext_wholesale_cost), Sum(ss_ext_wholesale_cost) 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 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.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND ct.kind = 'production companies' AND ct.id = mc.company_type_id AND (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 p_partkey, s_address, n_name, s_comment, s_phone, s_name, p_mfgr, s_acctbal 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.