text stringlengths 84 1.49k | benchmark stringclasses 4
values |
|---|---|
WITH year_total AS ( SELECT 's' AS sale_type, c_last_name AS customer_last_name, c_first_name AS customer_first_name, c_birth_country AS customer_birth_country, c_login AS customer_login, c_customer_id AS customer_id, c_email_address AS customer_email_address, SUM(((ss_ext_list_price - ss_ext_wholesale_cost - ss_ext_di... | 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 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 INNER JOIN store ON ss_store_sk = s_store_sk INNER JOIN promotion ON ss_promo_sk = p_promo_sk INNER JOIN date_dim ON ss_sold_date_sk = d_date_sk INNER J... | tpcds |
SELECT MIN(t.title) AS voiced_movie, MIN(n.name) AS voicing_actress FROM aka_name AS an, char_name AS chn, cast_info AS ci, company_name AS cn, info_type AS it, movie_companies AS mc, movie_info AS mi, name AS n, role_type AS rt, title AS t WHERE chn.id = ci.person_role_id AND ci.note IN ('(voice)', '(voice: Japanese v... | job |
Select Count(*) From comments As c, postHistory As ph, badges As b, votes As v, users As u Where u.UpVotes = 0 AND b.UserId = ph.UserId AND ph.PostHistoryTypeId = 12 AND u.Id = b.UserId AND v.UserId = c.UserId AND ph.UserId = v.UserId | 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.note LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%') AND it.info = 'top 250 rank' AND t.id = ... | job |
SELECT c_phone, c_address, c_custkey, c_comment, n_name, c_acctbal, c_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, nation WHERE c_custkey = o_custkey AND l_orderkey = o_orderkey AND o_orderdate >= DATE 1 AND o_orderdate < DATE 1 + INTERVAL '3' MONTH AND l_returnflag = 'R' AN... | tpch |
select 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 ct.id = mc.company_type_id AND t.id = mc.movie_id AND it.info = 'top 250 rank' AND it.id = mi_idx.info_typ... | job |
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 cn.country_code = '[us]' AND mi.movie_id = ci.movie_id AND rt.role = 'act... | job |
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_commitdate < l_receiptdate AND l_shipmode ... | tpch |
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(sr_return_quantity) AS store_returns_quantitycount, i_item_id, AVG(sr_return_quantity) AS store_returns_quantityave, COUNT(cs_quantity) AS catalog_sales_quantitycount, STDDEV_SAMP(ss_quantity) / AVG(ss_quantity) AS store_sales_quantitycov, i_item_desc, STDDEV_SAMP(ss_quantity) AS store_sales_quantitystdev,... | 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 american_movie FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info AS mi, title AS t WHERE it.info = 'bottom 10 rank' AND t.id = mi.movie_id AND mc.movie_id = mi.movie_id AND t.id = mc.movie_id AND ct.id = mc.company_type_id AND ct.kind = 'production companies' AND it.id =... | 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_partkey = l_partkey AND p_partkey = l_partkey AND o_orderk... | tpch |
SELECT s_name, p_partkey, s_phone, n_name, p_mfgr, s_comment, s_address, 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 |
select item.i_brand as brand, item.i_brand_id as brand_id, sum(ss_ext_sales_price) as sum_agg, dt.d_year 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 item.i_manufact_id = 266 and dt.d_moy = 12 group by dt.d_year, item.i_bra... | 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 = t.id AND t.id = mk.movie_id AND cn.id = mc.company_id AND k.keyword ='character-name-in-title' AND cn.country_code ='[sm]' AND mc.movie_id = mk.movie_id AND mk.keyword_id ... | 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 cn.id = mc.company_id AND it2.info = 'release dates' AND kt.kind = 'mo... | job |
select count(*) from comments as c, posts as p, users as u where p.FavoriteCount >= 0 AND p.ViewCount >= 0 AND u.Id = p.OwnerUserId AND c.UserId = u.Id AND p.CommentCount >= 0 AND c.CreationDate >= '2010-08-05 00:36:02'::timestamp | 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 mc.movie_id = mi.movie_id AND t.id = mc.movie_id AND it.info = 'bottom 10 rank' AND it.id = mi.info_type_id AND t.id = mi.movie_id AND ct.id = mc.company_type_id AND mc.note NOT LIKE... | job |
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 cn.country_code = '[us]' AND n.gender = 'f' AND ci.movie_id = mc.movie_id... | job |
Select Count(*) From comments As c, posts As p, postLinks As pl, votes As v Where p.Id = c.PostId And v.VoteTypeId = 2 And p.Score >= -3 And c.CreationDate >= '2010-08-02 23:52:10'::timestamp And c.PostId = pl.PostId And pl.PostId = v.PostId | stats |
SELECT s_acctbal, s_name, n_name, p_partkey, p_mfgr, s_address, s_phone, s_comment FROM part, supplier, partsupp, nation, region WHERE s_nationkey = n_nationkey AND s_suppkey = ps_suppkey AND p_size = 1 AND r_name = 1 AND p_type LIKE 1 AND p_partkey = ps_partkey AND n_regionkey = r_regionkey AND ps_supplycost = ( SELEC... | 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_partkey = l_partkey... | tpch |
SELECT l_year, cust_nation, SUM(volume) AS revenue, supp_nation 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 MAX(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 cn.country_code ='[de]' AND mc.movie_id = t.id AND mk.keyword_id = k.id AND mc.movie_id = mk.movie_id AND t.id = mk.movie_id AND cn.id = mc.comp... | job |
SELECT COUNT(ss_quantity) AS store_sales_quantitycount, STDDEV_SAMP(ss_quantity) AS store_sales_quantitystdev, STDDEV_SAMP(sr_return_quantity) / AVG(sr_return_quantity) AS store_returns_quantitycov, STDDEV_SAMP(sr_return_quantity) AS store_returns_quantitystdev, AVG(ss_quantity) AS store_sales_quantityave, COUNT(sr_ret... | tpcds |
SELECT c_name, c_phone, SUM(l_extendedprice * (1 - l_discount)) AS revenue, n_name, c_address, c_comment, c_acctbal, 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 COUNT(*) FROM postHistory AS ph, posts AS p, users AS u, badges AS b WHERE ph.PostHistoryTypeId = 3 AND u.Id = b.UserId AND ph.UserId = u.Id AND u.Reputation >= 1 AND p.Score >= -7 AND p.OwnerUserId = u.Id LIMIT 200; | stats |
SELECT c_address, c_custkey, SUM(l_extendedprice * (1 - l_discount)) AS revenue, c_phone, c_acctbal, c_name, c_comment, n_name FROM customer, orders, lineitem, nation WHERE c_custkey = o_custkey AND l_orderkey = o_orderkey AND o_orderdate >= DATE 1 AND o_orderdate < DATE 1 + INTERVAL '3' MONTH AND l_returnflag = 'R' AN... | tpch |
SELECT 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 = ci.person_id AND n1.name LIKE '%Yo%' AND an1.person_id = n1.id AND ci.role_id = rt.id AND n1.id... | job |
select min(t.title) as movie_title from company_name as cn, keyword as k, movie_companies as mc, movie_keyword as mk, title as t where k.keyword ='character-name-in-title' and mk.keyword_id = k.id and cn.id = mc.company_id and mc.movie_id = t.id and cn.country_code ='[sm]' and mc.movie_id = mk.movie_id and t.id = mk.mo... | 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 |
WITH year_total AS ( SELECT SUM(((ss_ext_list_price - ss_ext_wholesale_cost - ss_ext_discount_amt) + ss_ext_sales_price) / 2) AS year_total, c_email_address AS customer_email_address, c_customer_id AS customer_id, c_login AS customer_login, c_birth_country AS customer_birth_country, c_first_name AS customer_first_name,... | tpcds |
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 mi.movie_id = miidx.movie_id AND mi.movie_id = ... | job |
SELECT AVG(ss_sales_price) AS agg4, AVG(ss_quantity) AS agg1, AVG(ss_list_price) AS agg2, AVG(ss_coupon_amt) AS agg3, i_item_id FROM store_sales JOIN customer_demographics ON ss_cdemo_sk = cd_demo_sk JOIN date_dim ON ss_sold_date_sk = d_date_sk JOIN item ON ss_item_sk = i_item_sk JOIN promotion ON ss_promo_sk = p_promo... | tpcds |
SELECT s_acctbal, s_name, n_name, p_partkey, p_mfgr, s_address, s_phone, s_comment FROM part, supplier, partsupp, nation, region WHERE p_type LIKE 1 AND n_regionkey = r_regionkey AND ps_supplycost = ( SELECT MIN(ps_supplycost) FROM partsupp, supplier, nation, region WHERE p_partkey = ps_partkey AND s_suppkey = ps_suppk... | tpch |
SELECT MIN(an.name) AS acress_pseudonym, MIN(t.title) AS japanese_anime_movie FROM aka_name AS an, cast_info AS ci, company_name AS cn, company_type AS ct, keyword AS k, movie_companies AS mc, movie_keyword AS mk, name AS n, role_type AS rt, title AS t WHERE n.id = ci.person_id AND k.id = mk.keyword_id AND ci.movie_id ... | job |
SELECT o_orderpriority, COUNT(1) AS order_count FROM orders WHERE EXISTS ( SELECT * FROM lineitem WHERE l_orderkey = o_orderkey AND l_commitdate < l_receiptdate ) AND o_orderdate < DATE 1 + INTERVAL '3' MONTH AND o_orderdate >= DATE 1 GROUP BY o_orderpriority ORDER BY o_orderpriority LIMIT 100; | tpch |
SELECT MIN(mi.info) AS release_date, MIN(miidx.info) AS rating, MIN(t.title) AS german_movie FROM company_name AS cn, company_type AS ct, info_type AS it, info_type AS it2, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS miidx, title AS t WHERE it.info = 'rating' AND mi.movie_id = mc.movie_i... | job |
SELECT MIN(t.title) AS western_sequel, MIN(cn.name) AS from_company, MIN(lt.link) AS link_type FROM company_name AS cn, company_type AS ct, info_type AS it, keyword AS k, link_type AS lt, movie_companies AS mc, movie_info AS mi, movie_keyword AS mk, movie_link AS ml, title AS t WHERE k.keyword IN ('sequel', 'revenge', ... | 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 STDDEV_SAMP(ss_quantity) / AVG(ss_quantity) AS store_sales_quantitycov, AVG(cs_quantity) AS catalog_sales_quantityave, AVG(sr_return_quantity) AS store_returns_quantityave, COUNT(sr_return_quantity) AS store_returns_quantitycount, s_state, i_item_desc, i_item_id, STDDEV_SAMP(cs_quantity) / AVG(cs_quantity) AS ca... | 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 mc.note LIKE '%(Japan)%' AND ci.note = '(voice: English version)' AND t.id = mc.movie_id AND ci.role_id = rt.id... | job |
select min(t.title) as movie_title from company_name as cn, keyword as k, movie_companies as mc, movie_keyword as mk, title as t where k.keyword ='character-name-in-title' and cn.country_code ='[nl]' and mc.movie_id = t.id and mk.keyword_id = k.id and cn.id = mc.company_id and t.id = mk.movie_id and mc.movie_id = mk.mo... | job |
SELECT COUNT(*) FROM comments AS c, posts AS p, postLinks AS pl, votes AS v WHERE p.Score >= -3 AND c.PostId = pl.PostId AND pl.PostId = v.PostId AND v.VoteTypeId = 2 AND c.CreationDate >= '2010-08-02 23:52:10'::timestamp AND p.Id = c.PostId LIMIT 20; | stats |
WITH year_total AS ( SELECT c_email_address AS customer_email_address, c_preferred_cust_flag AS customer_preferred_cust_flag, d_year AS dyear, c_login AS customer_login, 's' AS sale_type, c_customer_id AS customer_id, c_first_name AS customer_first_name, SUM(((ss_ext_list_price - ss_ext_wholesale_cost - ss_ext_discount... | tpcds |
SELECT MIN(mc.note) AS production_note, MIN(t.title) AS movie_title, MIN(t.production_year) AS movie_year FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info_idx AS mi_idx, title AS t WHERE ct.kind = 'production companies' AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND t.id = mi_... | job |
select count(*) from postHistory as ph, posts as p, users as u, badges as b where p.OwnerUserId = u.Id AND u.Reputation >= 1 AND p.Score >= -7 AND ph.PostHistoryTypeId = 3 AND ph.UserId = u.Id AND u.Id = b.UserId | stats |
SELECT MIN(mi_idx.info) AS rating, MIN(t.title) AS northamerican_movie FROM aka_title AS at, company_name AS cn, info_type AS it1, info_type AS it2, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS mi_idx, title AS t WHERE t.production_year > 2000 AND mi_idx.info < '3.5' AND kt.kind = 'movie'... | job |
SELECT AVG(ss_quantity) AS store_sales_quantityave, COUNT(cs_quantity) AS catalog_sales_quantitycount, AVG(cs_quantity) AS catalog_sales_quantityave, STDDEV_SAMP(ss_quantity) AS store_sales_quantitystdev, STDDEV_SAMP(sr_return_quantity) AS store_returns_quantitystdev, STDDEV_SAMP(cs_quantity) / AVG(cs_quantity) AS cata... | 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 cn.country_code = '[us]' AND t.episode_nr < 100 AND mk.keyword_id = k.id AND t.id = mc.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 mi.info in ('Sweden', 'Norway', 'Germany', 'Danish', 'Swedish', 'Danish', 'Norwegian', 'German') and mk.movie_id = mi.movie_id and t.id = mi.movie_id and t.production_year > 2010 and t.id = mk.movie_id and k.ke... | job |
SELECT MIN(mc.note) AS production_note, MIN(t.title) AS movie_title, MIN(t.production_year) AS movie_year FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info_idx AS mi_idx, title AS t WHERE ct.id = mc.company_type_id AND mc.movie_id = mi_idx.movie_id AND t.id = mi_idx.movie_id AND (mc.note LIKE ... | job |
SELECT MIN(n.name) AS of_person, MIN(t.title) AS biography_movie FROM aka_name AS an, cast_info AS ci, info_type AS it, link_type AS lt, movie_link AS ml, name AS n, person_info AS pi, title AS t WHERE lt.id = ml.link_type_id AND t.production_year BETWEEN 1980 AND 1995 AND it.id = pi.info_type_id AND t.id = ci.movie_id... | 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 s_nationkey = n_nationkey AND s_suppkey = ps_suppkey AND p_partkey = ps_partkey AND n_regionkey = r_regionkey AND r_name = 1 AND p_size = 1 AND ps_supplycost = ( SELECT MIN(ps_supplycos... | tpch |
SELECT SUM(l_quantity), c_custkey, c_name, o_orderdate, o_totalprice, o_orderkey 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 i_item_id, i_item_desc, s_store_id, s_store_name, SUM(ss_quantity) AS store_sales_quantity, SUM(sr_return_quantity) AS store_returns_quantity, SUM(cs_quantity) AS catalog_sales_quantity FROM store_sales INNER JOIN store_returns ON ss_customer_sk = sr_customer_sk AND ss_item_sk = sr_item_sk AND ss_ticket_number =... | tpcds |
SELECT s_name, COUNT(*) AS numwait FROM supplier, lineitem l1, orders, nation WHERE o_orderkey = l1.l_orderkey AND l1.l_receiptdate > l1.l_commitdate AND n_name = 1 AND s_nationkey = n_nationkey AND o_orderstatus = 'F' AND EXISTS ( SELECT * FROM lineitem l2 WHERE l2.l_orderkey = l1.l_orderkey AND l2.l_suppkey <> l1.l_s... | 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 = mc.movie_id AND it.info = 'top 250 rank' AND (mc.note like '%(co-production)%' or mc.note like '%(p... | 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 = mk.movie_id AND cn.country_code = '[jp]' AND ci.person... | job |
SELECT nation, o_year, SUM(amount) AS sum_profit FROM ( SELECT n_name AS nation, EXTRACT(YEAR FROM o_orderdate) AS o_year, l_extendedprice * (1 - l_discount) - ps_supplycost * l_quantity AS amount FROM part, supplier, lineitem, partsupp, orders, nation WHERE s_suppkey = l_suppkey AND ps_suppkey = l_suppkey AND s_nation... | tpch |
select count(1) from store_sales join household_demographics on ss_hdemo_sk = hd_demo_sk join time_dim on ss_sold_time_sk = t_time_sk join store on ss_store_sk = s_store_sk where t_hour = 14 and t_minute >= 57 and s_store_name = 'ought' and hd_dep_count = 6 order by count(1) desc limit 100; | tpcds |
WITH _q AS ( 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 t.id = mc.movie_id AND ci.movie_id = t.id AND mc.note LIKE '%(Jap... | 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 p_partkey = l_partkey AND ps_partkey = l_partkey AND ps_suppk... | 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 s_nationkey = n1.n_nationkey And c... | tpch |
select min(t.title) as movie_title from keyword as k, movie_info as mi, movie_keyword as mk, title as t where t.id = mk.movie_id and t.id = mi.movie_id and k.keyword like '%sequel%' and t.production_year > 2000 and k.id = mk.keyword_id and mi.info in ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Danish', 'Norw... | job |
SELECT AVG(cs_list_price) AS agg2, AVG(cs_sales_price) AS agg4, 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 |
WITH _q AS ( 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 (mc.note Like '%(co-production)%' ... | job |
Select Min(t.title) As movie_title From company_name As cn, keyword As k, movie_companies As mc, movie_keyword As mk, title As t Where cn.country_code ='[nl]' And t.id = mk.movie_id And mc.movie_id = mk.movie_id And mk.keyword_id = k.id And mc.movie_id = t.id And cn.id = mc.company_id And k.keyword ='character-name-In-... | 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 n_name = 1 AND s_nationkey = n_nationkey AND... | tpch |
SELECT ss_ticket_number, extended_price, ca_city, c_last_name, extended_tax, list_price, bought_city, c_first_name 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(mi.info) AS release_date, MIN(miidx.info) AS rating, MIN(t.title) AS german_movie FROM company_name AS cn, company_type AS ct, info_type AS it, info_type AS it2, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS miidx, title AS t WHERE it2.info = 'release dates' AND it.info = 'ratin... | job |
SELECT c_last_name, c_first_name, c_salutation, c_preferred_cust_flag, ss_ticket_number, cnt FROM ( SELECT ss_ticket_number, ss_customer_sk, COUNT(*) AS cnt FROM store_sales JOIN date_dim ON ss_sold_date_sk = d_date_sk JOIN store ON ss_store_sk = s_store_sk JOIN household_demographics ON ss_hdemo_sk = hd_demo_sk WHERE ... | tpcds |
SELECT COUNT(*) FROM comments AS c, posts AS p, postLinks AS pl, votes AS v WHERE p.Id = c.PostId AND v.VoteTypeId = 2 AND c.CreationDate >= '2010-08-02 23:52:10'::timestamp AND c.PostId = pl.PostId AND p.Score >= -3 AND pl.PostId = v.PostId | stats |
SELECT COUNT(*) FROM comments AS c, users AS u WHERE c.Score = 0 AND c.UserId = u.Id LIMIT 100; | stats |
SELECT AVG(ss_ext_sales_price), AVG(ss_quantity), 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 russian_movie, MIN(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 ci.note LIKE '%(uncredited)%' AND ct.id = mc.company_type_id AND ci.note LIKE '%(voice)%' AND ci.mov... | job |
SELECT c_preferred_cust_flag, c_salutation, cnt, c_first_name, 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 extended_price, extended_tax, ca_city, list_price, c_last_name, c_first_name, ss_ticket_number, 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 AVG(l_quantity) AS avg_qty, SUM(l_extendedprice) AS sum_base_price, COUNT(*) AS count_order, AVG(l_discount) AS avg_disc, l_linestatus, SUM(l_quantity) AS sum_qty, l_returnflag, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, AVG(l_e... | tpch |
select i_item_id, i_item_desc, s_store_id, s_store_name, max(ss_net_profit) as store_sales_profit, max(sr_net_loss) as store_returns_loss, max(cs_net_profit) as catalog_sales_profit from store_sales join store_returns on store_sales.ss_customer_sk = store_returns.sr_customer_sk and store_sales.ss_item_sk = store_return... | tpcds |
SELECT MIN(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.role_id = rt.id AND cn.id = mc.company_id AND it.id = mi.info_type_id ... | job |
SELECT MAX(mi.info) AS release_date, MAX(miidx.info) AS rating, MAX(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.id = mc.company_id AND... | job |
SELECT n_name, s_phone, s_address, s_name, s_acctbal, s_comment, p_partkey, p_mfgr 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 n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, supplier, nation, region WHERE l_suppkey = s_suppkey AND o_orderdate >= DATE 1 AND o_orderdate < DATE 1 + INTERVAL '1' YEAR AND c_nationkey = s_nationkey AND s_nationkey = n_nationkey AND c_custkey = o_custkey AND r_name ... | tpch |
SELECT l_shipmode, SUM( CASE WHEN o_orderpriority = '1-URGENT' OR o_orderpriority = '2-HIGH' THEN 1 ELSE 0 END ) AS high_line_count, SUM( CASE WHEN o_orderpriority <> '1-URGENT' AND o_orderpriority <> '2-HIGH' THEN 1 ELSE 0 END ) AS low_line_count FROM orders, lineitem WHERE o_orderkey = l_orderkey AND l_shipdate < l_c... | tpch |
SELECT MIN(an1.name) AS actress_pseudonym, MIN(t.title) AS japanese_movie_dubbed FROM aka_name AS an1, cast_info AS ci, company_name AS cn, movie_companies AS mc, name AS n1, role_type AS rt, title AS t WHERE n1.name NOT LIKE '%Yu%' AND ci.movie_id = mc.movie_id AND n1.name LIKE '%Yo%' AND mc.note LIKE '%(Japan)%' AND ... | 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 l_shipdate BETWEEN DATE '1995-01-0... | tpch |
SELECT AVG(ss_ext_wholesale_cost), AVG(ss_ext_sales_price), AVG(ss_quantity), 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 extended_price, ss_ticket_number, c_first_name, bought_city, c_last_name, extended_tax, ca_city, 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 c_address, c_name, c_acctbal, n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue, c_custkey, c_comment, c_phone FROM customer, orders, lineitem, nation WHERE c_custkey = o_custkey AND l_orderkey = o_orderkey AND c_nationkey = n_nationkey AND o_orderdate >= DATE 1 AND o_orderdate < DATE 1 + INTERVAL '3' M... | tpch |
Select item.i_brand As brand, item.i_brand_id As brand_id, dt.d_year, 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 MIN(mc.note) AS production_note, MIN(t.title) AS movie_title, MIN(t.production_year) AS movie_year FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info_idx AS mi_idx, title AS t WHERE ct.id = mc.company_type_id AND it.info = 'top 250 rank' AND mc.movie_id = mi_idx.movie_id AND it.id = mi_i... | job |
SELECT i_item_desc, i_item_id, MAX(sr_net_loss) AS store_returns_loss, s_store_name, MAX(ss_net_profit) AS store_sales_profit, MAX(cs_net_profit) AS catalog_sales_profit, s_store_id FROM store_sales JOIN store_returns ON store_sales.ss_customer_sk = store_returns.sr_customer_sk AND store_sales.ss_item_sk = store_return... | tpcds |
With _q As ( Select dt.d_year, item.i_brand_id As brand_id, item.i_brand As brand, Sum(ss_ext_sales_price) As ext_price 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_manager_id = 95 And dt.d_year = 1... | 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 = t.id AND t.id = mk.movie_id AND cn.country_code ='[nl]' AND cn.id = mc.company_id AND mc.movie_id = mk.movie_id AND mk.keyword_id = k.id AND k.keyword ='character-name-in-... | 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 c_custkey = o_custkey AND c_nation... | tpch |
SELECT i_item_id, i_item_desc, s_store_id, s_store_name, MAX(ss_net_profit) AS store_sales_profit, MAX(sr_net_loss) AS store_returns_loss, MAX(cs_net_profit) AS catalog_sales_profit FROM store_sales JOIN store_returns ON store_sales.ss_customer_sk = store_returns.sr_customer_sk AND store_sales.ss_item_sk = store_return... | tpcds |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.