text stringlengths 84 1.49k | benchmark stringclasses 4
values |
|---|---|
SELECT COUNT(1) 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 = c.PostId AND p.Id = pl.PostId AND p.Id = v.PostId AND u.Id = p.OwnerUserId AND p.PostTypeId = 1 AND p.AnswerCount >= 0 | stats |
SELECT ss_ticket_number, extended_tax, c_last_name, list_price, extended_price, ca_city, c_first_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(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 k.keyword = 'character-name-in-title' AND an.person_id = n.id AND mc.company_id = cn.id AND... | job |
SELECT COUNT(*) FROM comments AS c, votes AS v, badges AS b, users AS u WHERE u.Id = b.UserId AND u.Id = v.UserId AND c.Score = 1 AND u.CreationDate >= '2010-07-20 01:27:29'::timestamp AND u.Id = c.UserId; | stats |
SELECT o_orderkey, o_totalprice, c_name, c_custkey, SUM(l_quantity), o_orderdate FROM customer, orders, lineitem WHERE o_orderkey IN ( SELECT l_orderkey FROM lineitem GROUP BY l_orderkey HAVING SUM(l_quantity) > 1 ) AND c_custkey = o_custkey AND o_orderkey = l_orderkey GROUP BY c_name, c_custkey, o_orderkey, o_orderdat... | tpch |
SELECT MIN(mi.info) AS release_date, MIN(miidx.info) AS rating, MIN(t.title) AS german_movie FROM company_name AS cn, company_type AS ct, info_type AS it, info_type AS it2, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS miidx, title AS t WHERE kt.kind = 'movie' AND mi.movie_id = t.id AND it... | 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.movie_id = mi.movie_id AND ct.kind = 'production companies' AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND t.id = mi.movie_id AND (mc.note LIKE '%(co-production)%'... | job |
SELECT COUNT(1) FROM postHistory AS ph, posts AS p, votes AS v, badges AS b, users AS u, comments AS c WHERE p.Id = v.PostId AND p.Id = c.PostId AND p.ViewCount >= 0 AND u.Id = p.OwnerUserId AND u.Id = b.UserId AND p.Score <= 192 AND p.Id = ph.PostId | stats |
SELECT AVG(ss_ext_wholesale_cost), AVG(ss_quantity), AVG(ss_ext_sales_price), 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 Avg(ss_ext_wholesale_cost), Avg(ss_quantity), Sum(ss_ext_wholesale_cost), Avg(ss_ext_sales_price) From store_sales Inner Join store On s_store_sk = ss_store_sk Inner Join customer_demographics On cd_demo_sk = ss_cdemo_sk Inner Join household_demographics On hd_demo_sk = ss_hdemo_sk Inner Join customer_address On... | tpcds |
SELECT 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 t.id = mc.movie_id AND ci.role_id = rt.id AND ci.note = '(voice: English version)' AND ci.movie_id = t.id AND n... | job |
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 ci.movie_id = mc.movie_id AND ci.note LIKE '%(uncredited)%' AND t.production_year > 2005 AND ci.note... | 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 t.id = ci.movie_id AND t.id = mc.movie_id AND ci.person_id = an.person_id... | job |
SELECT i_item_id, AVG(ss_quantity) AS agg1, AVG(ss_list_price) AS agg2, AVG(ss_coupon_amt) AS agg3, AVG(ss_sales_price) AS agg4 FROM store_sales JOIN customer_demographics ON ss_cdemo_sk = cd_demo_sk JOIN date_dim ON ss_sold_date_sk = d_date_sk JOIN item ON ss_item_sk = i_item_sk JOIN promotion ON ss_promo_sk = p_promo... | tpcds |
SELECT i_item_id, s_store_id, MAX(sr_net_loss) AS store_returns_loss, s_store_name, MAX(cs_net_profit) AS catalog_sales_profit, i_item_desc, MAX(ss_net_profit) AS store_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 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 l_orderkey = o_orderk... | tpch |
select count(*) from votes as v, posts as p, users as u where v.PostId = p.Id and v.UserId = u.Id and p.PostTypeId = 1 and u.Reputation >= 1 LIMIT 200; | stats |
SELECT c_last_name, c_first_name, c_salutation, c_preferred_cust_flag, ss_ticket_number, cnt FROM ( SELECT ss_ticket_number, ss_customer_sk, COUNT(*) AS cnt FROM store_sales JOIN date_dim ON ss_sold_date_sk = d_date_sk JOIN store ON ss_store_sk = s_store_sk JOIN household_demographics ON ss_hdemo_sk = hd_demo_sk WHERE ... | tpcds |
SELECT i_brand_id AS brand_id, SUM(ss_ext_sales_price) AS ext_price, i_manufact_id, i_manufact, 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 MAX(an1.name) AS actress_pseudonym, MAX(t.title) AS japanese_movie_dubbed FROM aka_name AS an1, cast_info AS ci, company_name AS cn, movie_companies AS mc, name AS n1, role_type AS rt, title AS t WHERE an1.person_id = n1.id AND n1.id = ci.person_id AND rt.role = 'actress' AND n1.name NOT LIKE '%Yu%' AND t.id = m... | job |
SELECT i_current_price, i_item_desc, i_item_id FROM item JOIN inventory ON i_item_sk = inv_item_sk JOIN date_dim ON d_date_sk = inv_date_sk JOIN catalog_sales ON cs_item_sk = i_item_sk WHERE d_date BETWEEN CAST('2000-05-01' AS DATE) AND (CAST('2000-05-01' AS DATE) + INTERVAL '60 days') AND inv_quantity_on_hand BETWEEN ... | tpcds |
Select Sum(cs_sales_price), ca_zip From catalog_sales Inner Join customer On cs_bill_customer_sk = c_customer_sk Inner Join customer_address On c_current_addr_sk = ca_address_sk Inner Join date_dim On cs_sold_date_sk = d_date_sk Where d_qoy = 1 AND (SUBSTR(ca_zip, 1, 5) In ( '85669', '86197', '88274', '83405', '86475',... | tpcds |
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 o_orderkey = l_orderkey AND p_part... | tpch |
SELECT o_orderdate, l_orderkey, o_shippriority, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem WHERE l_orderkey = o_orderkey AND c_mktsegment = 1 AND c_custkey = o_custkey AND o_orderdate < DATE 1 AND l_shipdate > DATE 1 GROUP BY l_orderkey, o_orderdate, o_shippriority ORDER BY reven... | tpch |
SELECT MIN(t.title) AS american_movie FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info AS mi, title AS t WHERE it.info = 'bottom 10 rank' AND ct.id = mc.company_type_id AND t.id = mc.movie_id AND mc.movie_id = mi.movie_id AND t.id = mi.movie_id AND ct.kind = 'production companies' AND mc.note... | 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 mc.movie_id = mk.movie_id AND mk.keyword_id = k.id AND mc.movie_id = t.id AND k.keyword ='character-name-in-title' AND t.id = mk.movie_id AND cn.country_code ='[sm]' AND cn.id = mc.comp... | job |
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 i_manager_id = 1 And d_moy = 11 And d_year = 2001 Group By i_brand, i_brand_id Order By ext_price Desc, brand_id Limit 100; | 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 cn.id = mc.company_id AND rt.id = ci.role_id AND rt.role = 'actor' AND ci.note LIKE '%(uncredited)%'... | job |
select supp_nation, cust_nation, l_year, sum(volume) as revenue from ( select n1.n_name as supp_nation, n2.n_name as cust_nation, EXTRACT(YEAR from l_shipdate) as l_year, l_extendedprice * (1 - l_discount) as volume from supplier, lineitem, orders, customer, nation n1, nation n2 where s_suppkey = l_suppkey and o_orderk... | 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 MIN(cn.name) AS movie_company, MIN(mi_idx.info) AS rating, MIN(t.title) AS western_violent_movie FROM company_name AS cn, company_type AS ct, info_type AS it1, info_type AS it2, keyword AS k, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS mi_idx, movie_keyword AS mk, title AS t WHERE... | job |
Select Sum(cs_quantity) As catalog_sales_quantity, s_store_id, i_item_desc, Sum(ss_quantity) As store_sales_quantity, Sum(sr_return_quantity) As store_returns_quantity, s_store_name, i_item_id From store_sales Join store_returns On ss_customer_sk = sr_customer_sk And ss_item_sk = sr_item_sk And ss_ticket_number = sr_ti... | tpcds |
WITH year_total AS ( SELECT 's' AS sale_type, c_login AS customer_login, SUM(((ss_ext_list_price - ss_ext_wholesale_cost - ss_ext_discount_amt) + ss_ext_sales_price) / 2) AS year_total, c_email_address AS customer_email_address, c_customer_id AS customer_id, c_birth_country AS customer_birth_country, c_first_name AS cu... | tpcds |
SELECT COUNT(*) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v WHERE p.Id = c.PostId AND p.Id = pl.PostId AND p.Id = v.PostId AND p.Id = ph.PostId AND pl.LinkTypeId = 1 AND c.Score = 0 AND p.FavoriteCount >= 0 | stats |
SELECT MIN(an.name) AS cool_actor_pseudonym, MIN(t.title) AS series_named_after_char FROM aka_name AS an, cast_info AS ci, company_name AS cn, keyword AS k, movie_companies AS mc, movie_keyword AS mk, name AS n, title AS t WHERE ci.movie_id = t.id AND k.keyword = 'character-name-IN-title' AND t.id = mk.movie_id AND an.... | job |
SELECT MIN(miidx.info) AS rating, MIN(t.title) AS german_movie, 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 it.id = miidx.info_type_id AND kt.id = t.kind_i... | 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 mc.note NOT LIKE '%(USA)%' AND an1.person_id = ci.person_id AND t.id = mc.movie_id AND n1.name LIKE '%Yo%' AND ... | job |
select count(*) from postHistory as ph, posts as p, votes as v, badges as b, users as u, comments as c where u.Id = p.OwnerUserId AND p.Score <= 192 AND p.Id = v.PostId AND p.Id = ph.PostId AND p.Id = c.PostId AND p.ViewCount >= 0 AND u.Id = b.UserId | stats |
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(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 t.id = mc.movie_id AND it.info = 'bottom 10 rank' AND mc.movie_id = mi.movie_id AND (mc.note LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%') AND ct.kind = 'production compan... | job |
WITH _q AS ( SELECT COUNT(*) FROM comments AS c, postHistory AS ph, votes AS v, users AS u WHERE ph.UserId = c.UserId AND v.UserId = ph.UserId AND u.DownVotes >= 0 AND u.Id = v.UserId AND u.Views >= 0 AND u.UpVotes <= 123 ) SELECT * FROM _q | stats |
Select Min(t.title) As movie_title From keyword As k, movie_info As mi, movie_keyword As mk, title As t Where k.keyword Like '%sequel%' And t.production_year > 2010 And mk.movie_id = mi.movie_id And mi.info In ('Sweden', 'Norway', 'Germany', 'Danish', 'Swedish', 'Danish', 'Norwegian', 'German') And t.id = mk.movie_id A... | job |
SELECT COUNT(*) AS count_order, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, SUM(l_quantity) AS sum_qty, AVG(l_extendedprice) AS avg_price, AVG(l_quantity) AS avg_qty, SUM(l_extendedprice) AS sum_base_price, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, AVG(l_discount) AS avg_disc, ... | 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 s_nationkey = n2.n_na... | tpch |
SELECT AVG(cs_sales_price) AS agg4, AVG(cs_quantity) AS agg1, AVG(cs_coupon_amt) AS agg3, AVG(cs_list_price) AS agg2, 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 MIN(mi_idx.info) AS rating, MIN(t.title) AS northamerican_movie FROM aka_title AS at, company_name AS cn, info_type AS it1, info_type AS it2, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS mi_idx, title AS t WHERE mi.info LIKE 'USA:%200%' AND mi_idx.info < '3.5' AND mi.movie_id = mc.... | job |
SELECT item.i_brand AS brand, dt.d_year, item.i_brand_id AS brand_id, 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 = 387 GROUP BY dt.d_year, item.i_bra... | tpcds |
SELECT COUNT(*) FROM postHistory AS ph, posts AS p, votes AS v, badges AS b, users AS u, comments AS c WHERE u.Id = p.OwnerUserId AND u.Id = b.UserId AND p.Id = ph.PostId AND p.Id = v.PostId AND p.ViewCount >= 0 AND p.Id = c.PostId AND p.Score <= 192 LIMIT 10; | stats |
Select supp_nation, cust_nation, l_year, Sum(volume) As revenue From ( Select n1.n_name As supp_nation, n2.n_name As cust_nation, EXTRACT(YEAR From l_shipdate) As l_year, l_extendedprice * (1 - l_discount) As volume From supplier, lineitem, orders, customer, nation n1, nation n2 Where c_nationkey = n2.n_nationkey AND (... | tpch |
with _q as ( 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_... | 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 mc.note NOT LIKE '%(AS Metro-Goldwyn-Mayer Pictures)%' AND (mc.note LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%') AND it.info = 'botto... | job |
SELECT c_first_name, c_salutation, c_preferred_cust_flag, cnt, c_last_name, ss_ticket_number FROM ( SELECT ss_ticket_number, ss_customer_sk, COUNT(*) AS cnt FROM store_sales JOIN date_dim ON ss_sold_date_sk = d_date_sk JOIN store ON ss_store_sk = s_store_sk JOIN household_demographics ON ss_hdemo_sk = hd_demo_sk WHERE ... | tpcds |
SELECT SUM(l_extendedprice * (1 - l_discount)) AS revenue, n_name FROM customer, orders, lineitem, supplier, nation, region WHERE o_orderdate < DATE 1 + INTERVAL '1' YEAR AND l_suppkey = s_suppkey AND c_custkey = o_custkey AND o_orderdate >= DATE 1 AND n_regionkey = r_regionkey AND c_nationkey = s_nationkey AND r_name ... | 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 it2.info = 'release dates' AND it.info = 'ratin... | job |
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 mi.info LIKE 'USA:% 199%' AND t.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 at.movie_id = mi.movie_id AND t.production_year > 2000 AND at.movie_id... | 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_shipdate < l_commitdate AND l_commitdate <... | tpch |
select min(t.title) as movie_title from keyword as k, movie_info as mi, movie_keyword as mk, title as t where mi.info in ('Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Danish', 'Norwegian', 'German') and k.keyword like '%sequel%' and t.production_year > 2000 and k.id = mk.keyword_id and t.id = mk.movie_id and m... | job |
SELECT MIN(t.title) AS american_movie FROM company_type AS ct, info_type AS it, movie_companies AS mc, movie_info AS mi, title AS t WHERE mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%' AND mc.movie_id = mi.movie_id AND it.info = 'bottom 10 rank' AND ct.id = mc.company_type_id AND ct.kind = 'production companies... | 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(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 '%Hemsworth%Chris%' AND n.id = ci.person_id AND t.production_year > 2010 AND t.id = ci.movie_id AND k.keyword = 'marvel-cinemat... | job |
select avg(ss_ext_sales_price), sum(ss_ext_wholesale_cost), avg(ss_quantity), avg(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 i_item_id, AVG(cs_quantity) AS agg1, AVG(cs_list_price) AS agg2, AVG(cs_coupon_amt) AS agg3, AVG(cs_sales_price) AS agg4 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 AVG(ss_quantity) AS store_sales_quantityave, STDDEV_SAMP(sr_return_quantity) AS store_returns_quantitystdev, STDDEV_SAMP(ss_quantity) / AVG(ss_quantity) AS store_sales_quantitycov, STDDEV_SAMP(cs_quantity) / AVG(cs_quantity) AS catalog_sales_quantitycov, AVG(sr_return_quantity) AS store_returns_quantityave, i_it... | tpcds |
WITH year_total AS ( SELECT c_birth_country AS customer_birth_country, c_email_address AS customer_email_address, c_login AS customer_login, 's' AS sale_type, c_last_name AS customer_last_name, d_year AS dyear, c_customer_id AS customer_id, c_preferred_cust_flag AS customer_preferred_cust_flag, SUM(((ss_ext_list_price ... | tpcds |
SELECT l_shipmode, SUM( CASE WHEN o_orderpriority = '1-URGENT' OR o_orderpriority = '2-HIGH' THEN 1 ELSE 0 END ) AS high_line_count, SUM( CASE WHEN o_orderpriority <> '1-URGENT' AND o_orderpriority <> '2-HIGH' THEN 1 ELSE 0 END ) AS low_line_count FROM orders, lineitem WHERE l_receiptdate >= DATE 1 AND l_commitdate < l... | tpch |
SELECT SUM(l_extendedprice * (1 - l_discount)) AS revenue, o_shippriority, l_orderkey, o_orderdate FROM customer, orders, lineitem WHERE o_orderdate < DATE 1 AND l_orderkey = o_orderkey AND c_custkey = o_custkey AND c_mktsegment = 1 AND l_shipdate > DATE 1 GROUP BY l_orderkey, o_orderdate, o_shippriority ORDER BY reven... | 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 it.id = mi_idx.info_type_id AND ct.id = mc.company_type_id AND mc.movie_id = mi_idx.movie_id AND t.id = mi... | job |
SELECT n_name, c_comment, c_custkey, c_phone, c_acctbal, c_address, c_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, nation WHERE o_orderdate < DATE 1 + INTERVAL '3' MONTH AND o_orderdate >= DATE 1 AND l_returnflag = 'R' AND l_orderkey = o_orderkey AND c_custkey = o_custkey AN... | tpch |
SELECT cnt, c_preferred_cust_flag, c_last_name, c_first_name, c_salutation, ss_ticket_number FROM ( SELECT ss_ticket_number, ss_customer_sk, COUNT(1) 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(1) FROM comments AS c, votes AS v, badges AS b, users AS u WHERE c.Score = 1 AND u.Id = c.UserId AND u.Id = v.UserId AND u.Id = b.UserId AND u.CreationDate >= '2010-07-20 01:27:29'::timestamp | stats |
SELECT i_brand_id AS brand_id, i_manufact_id, SUM(ss_ext_sales_price) AS ext_price, i_brand AS brand, i_manufact 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 c_name, n_name, c_acctbal, c_comment, c_custkey, c_address, SUM(l_extendedprice * (1 - l_discount)) AS revenue, c_phone FROM customer, orders, lineitem, nation WHERE c_custkey = o_custkey AND l_orderkey = o_orderkey AND o_orderdate >= DATE 1 AND o_orderdate < DATE 1 + INTERVAL '3' MONTH AND l_returnflag = 'R' AN... | tpch |
SELECT 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 k.id = mk.keyword_id AND t.id = mk.movie_id AND ci.movie_id = mk.movie_id AND n.id = ci.person_id AND k.keyword = 'm... | job |
SELECT MIN(k.keyword) AS movie_keyword, MIN(n.name) AS actor_name, MIN(t.title) AS marvel_movie FROM cast_info AS ci, keyword AS k, movie_keyword AS mk, name AS n, title AS t WHERE t.production_year > 2010 AND n.name LIKE '%Hemsworth%Chris%' AND t.id = ci.movie_id AND ci.movie_id = mk.movie_id AND k.keyword = 'marvel-c... | 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 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 t.id = mk.movie_id AND cn.id = mc.company_id AND mc.movie_id = mk.movie_id AND mc.movie_id = t.id AND k.keyword ='character-name-in-title' AND cn.country_code ='[sm]' AND m... | job |
SELECT i_item_desc, i_item_id, s_store_name, s_store_id, MAX(sr_net_loss) AS store_returns_loss, MAX(cs_net_profit) AS catalog_sales_profit, MAX(ss_net_profit) AS store_sales_profit FROM store_sales INNER JOIN store_returns ON store_sales.ss_customer_sk = store_returns.sr_customer_sk AND store_sales.ss_item_sk = store_... | tpcds |
SELECT MIN(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 mc.movie_id = mi_idx.movie_id AND ct... | job |
SELECT MIN(mi.info) AS release_date, MIN(miidx.info) AS rating, MIN(t.title) AS german_movie FROM company_name AS cn, company_type AS ct, info_type AS it, info_type AS it2, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS miidx, title AS t WHERE miidx.movie_id = mc.movie_id AND kt.kind = 'mov... | job |
SELECT ps_partkey, SUM(ps_supplycost * ps_availqty) AS VALUE FROM partsupp, supplier, nation WHERE s_nationkey = n_nationkey AND n_name = 1 AND ps_suppkey = s_suppkey GROUP BY ps_partkey HAVING SUM(ps_supplycost * ps_availqty) > ( SELECT SUM(ps_supplycost * ps_availqty) * 1 FROM partsupp, supplier, nation WHERE ps_supp... | tpch |
SELECT n_name, c_comment, c_name, c_address, c_acctbal, c_phone, c_custkey, 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 i_item_id, i_item_desc, i_current_price FROM item JOIN inventory ON i_item_sk = inv_item_sk JOIN date_dim ON d_date_sk = inv_date_sk JOIN store_sales ON ss_item_sk = i_item_sk WHERE i_manufact_id IN (301, 227, 392, 436) AND i_current_price >= 93 AND i_current_price <= 93 + 30 AND inv_quantity_on_hand BETWEEN 100... | 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 ci.person_id = n.id AND ml.linked_movie_id = t.id AND n.id = an.person_id AND n.id = pi.person_id AND pi.note = 'Volke... | job |
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 (mc.note LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%') AND t.id = mc.movie_id AND it.id = mi_id... | job |
SELECT COUNT(*) FROM comments AS c, posts AS p, votes AS v, users AS u WHERE u.Id = v.UserId AND p.ViewCount >= 0 AND c.Score = 0 AND u.Id = c.UserId AND p.Score >= 0 AND u.Id = p.OwnerUserId LIMIT 50; | 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 k.keyword ='character-name-In-title' And mc.movie_id = mk.movie_id And mk.keyword_id = k.id And mc.movie_id = t.id And cn.country_code ='[nl]' And t.id = mk.movie_id 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 t.id = mc.movie_id AND cn.country_code = '[us]' AND mk.keyword_id = k.id AND t.id = mk.movi... | job |
WITH year_total AS ( SELECT d_year AS dyear, c_preferred_cust_flag AS customer_preferred_cust_flag, c_login AS customer_login, c_last_name AS customer_last_name, '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_amt) + ... | tpcds |
SELECT COUNT(1) FROM comments AS c, posts AS p, postLinks AS pl, postHistory AS ph, votes AS v WHERE c.Score = 0 AND p.FavoriteCount >= 0 AND p.Id = ph.PostId AND p.Id = pl.PostId AND p.Id = v.PostId AND p.Id = c.PostId AND pl.LinkTypeId = 1 | stats |
select count(*) from comments as c, posts as p, postHistory as ph, votes as v, users as u where p.Score <= 13 and p.AnswerCount >= 0 and p.OwnerUserId = ph.UserId and c.UserId = p.OwnerUserId and u.Id = c.UserId and ph.UserId = v.UserId | stats |
select ca_zip, sum(cs_sales_price) from catalog_sales INNER JOIN customer on cs_bill_customer_sk = c_customer_sk INNER JOIN customer_address on c_current_addr_sk = ca_address_sk INNER JOIN date_dim on cs_sold_date_sk = d_date_sk where d_qoy = 3 and d_year = 1999 and (SUBSTR(ca_zip, 1, 5) in ( '85669', '86197', '88274',... | tpcds |
SELECT n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem, supplier, nation, region WHERE l_suppkey = s_suppkey AND l_orderkey = o_orderkey AND s_nationkey = n_nationkey AND c_custkey = o_custkey AND c_nationkey = s_nationkey AND n_regionkey = r_regionkey AND o_orderdate < DATE 1... | tpch |
WITH _q AS ( SELECT COUNT(*) FROM badges AS b, users AS u, posts AS p WHERE p.PostTypeId = 1 AND u.Id = b.UserId AND u.Reputation >= 1 AND u.Id = p.OwnerUserId LIMIT 20 ) SELECT * FROM _q; | 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 t.id = mi_idx.movie_id AND (mc.note LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%') AND it.id = m... | job |
SELECT MIN(k.keyword) AS movie_keyword, MIN(n.name) AS actor_name, MIN(t.title) AS marvel_movie FROM cast_info AS ci, keyword AS k, movie_keyword AS mk, name AS n, title AS t WHERE n.id = ci.person_id AND t.id = mk.movie_id AND k.keyword = 'marvel-cinematic-universe' AND ci.movie_id = mk.movie_id AND k.id = mk.keyword_... | job |
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 k.id = mk.keyword_id AND ct.id = mc... | 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.kind = 'production companies' AND it.id = mi_idx.info_type_id AND t.id = mi_idx.movie_id AND it.info = ... | job |
SELECT l_shipmode, SUM( CASE WHEN o_orderpriority = '1-URGENT' OR o_orderpriority = '2-HIGH' THEN 1 ELSE 0 END ) AS high_line_count, SUM( CASE WHEN o_orderpriority <> '1-URGENT' AND o_orderpriority <> '2-HIGH' THEN 1 ELSE 0 END ) AS low_line_count FROM orders, lineitem WHERE l_receiptdate >= DATE 1 AND l_shipdate < l_c... | tpch |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.