text stringlengths 84 1.49k | benchmark stringclasses 4
values |
|---|---|
SELECT l_orderkey, o_shippriority, o_orderdate, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem WHERE c_custkey = o_custkey AND l_orderkey = o_orderkey AND l_shipdate > DATE 1 AND c_mktsegment = 1 AND o_orderdate < DATE 1 GROUP BY l_orderkey, o_orderdate, o_shippriority ORDER BY reven... | tpch |
Select Count(*) From comments As c, posts As p, postLinks As pl, votes As v Where c.CreationDate >= '2010-08-02 23:52:10'::timestamp And p.Id = c.PostId And c.PostId = pl.PostId And p.Score >= -3 And v.VoteTypeId = 2 And pl.PostId = v.PostId | stats |
SELECT o_orderkey, c_name, o_totalprice, c_custkey, o_orderdate, SUM(l_quantity) 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 c_acctbal, c_address, c_name, c_comment, SUM(l_extendedprice * (1 - l_discount)) AS revenue, c_custkey, c_phone, n_name FROM customer, orders, lineitem, nation WHERE o_orderdate < DATE 1 + INTERVAL '3' MONTH AND l_returnflag = 'R' AND l_orderkey = o_orderkey AND c_custkey = o_custkey AND c_nationkey = n_nationke... | tpch |
SELECT MIN(t.title) AS movie_title FROM company_name AS cn, keyword AS k, movie_companies AS mc, movie_keyword AS mk, title AS t WHERE mc.movie_id = t.id AND mc.movie_id = mk.movie_id AND mk.keyword_id = k.id AND k.keyword ='character-name-IN-title' AND cn.country_code ='[de]' AND t.id = mk.movie_id AND cn.id = mc.comp... | 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 t.production_year > 1950 AND lt.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.country_code = '[us]' AND t.production_year > 2000 AND it1.info = '... | job |
SELECT SUM(l_extendedprice * (1 - l_discount)) AS revenue, n_name FROM customer, orders, lineitem, supplier, nation, region WHERE l_suppkey = s_suppkey AND l_orderkey = o_orderkey AND n_regionkey = r_regionkey AND o_orderdate >= DATE 1 AND o_orderdate < DATE 1 + INTERVAL '1' YEAR AND c_custkey = o_custkey AND s_nationk... | tpch |
SELECT MIN(t.title) AS biography_movie, MIN(n.name) AS of_person 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.movie_id = ml.linked_movie_id AND ml.linked_movie_id = t.id AND t.id = ci.movie_id AND an.name LIKE '%a%' AND lt.li... | job |
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 c_last_name, cnt, c_salutation, c_first_name, c_preferred_cust_flag, 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 MIN(t.title) AS marvel_movie, MIN(n.name) AS actor_name, 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.name LIKE '%Downey%Robert%' AND t.production_year > 2010 AND k.keyword = 'marvel-cinematic-universe' AND ci.movie_id = mk.movie_id AND t.... | job |
SELECT SUM(l_extendedprice) AS sum_base_price, l_returnflag, COUNT(*) AS count_order, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_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, AVG(l_discount) AS avg_disc, l_linestatus, ... | 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 o_orderkey = l_orderkey AND s_supp... | tpch |
select n_name, sum(l_extendedprice * (1 - l_discount)) as revenue from customer, orders, lineitem, supplier, nation, region where n_regionkey = r_regionkey AND s_nationkey = n_nationkey AND c_nationkey = s_nationkey AND o_orderdate < DATE 1 + INTERVAL '1' YEAR AND r_name = 1 AND c_custkey = o_custkey AND l_orderkey = o... | 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 n.name_pcode_cf between 'A' and 'F' and lt.link = 'features' and it.info = 'mini biography' and pi.note = 'Volker Boeh... | 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_nationkey = n_nationkey AND ps_suppkey = l_suppkey AND ps_p... | 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 k.keyword ='character-name-In-title' And cn.country_code ='[nl]' And mk.keyword_id = k.id And mc.movie_id = t.id And cn.id = mc.company_id And mc.movie_id = mk.movie_id And t.id = mk.mo... | job |
select count(*) from postHistory as ph, posts as p, users as u, badges as b where p.Score >= -7 and p.OwnerUserId = u.Id and u.Id = b.UserId and ph.PostHistoryTypeId = 3 and ph.UserId = u.Id and u.Reputation >= 1 LIMIT 20; | stats |
SELECT p_partkey, n_name, s_address, s_name, s_phone, s_comment, s_acctbal, 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 p_size, p_brand, p_type, count(distinct ps_suppkey) as supplier_cnt from partsupp, part where ps_suppkey not in ( select s_suppkey from supplier where s_comment like '%Customer%Complaints%' ) and p_partkey = ps_partkey and p_type not like 1 and p_brand <> 1 and p_size in (1, 1, 1, 1, 1, 1, 1, 1) group by p_brand... | tpch |
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 dt.d_year, SUM(ss_ext_sales_price) AS sum_agg, item.i_brand AS brand, item.i_brand_id AS brand_id 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 = 599 AND dt.d_moy = 12 GROUP BY dt.d_year, item.i_bra... | 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 cn.country_code = '[jp]' AND ci.movie_id = mc.movie_id AND mc.note NOT LIKE '%(USA... | 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 n.id = pi.person_id AND t.id = ci.movie_id AND an.person_id = ci.person_id AND ml.linked_movie_id = t.id AND it.id = p... | 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_commitdate < l_receiptdate AND l_shipmode ... | tpch |
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 u.Id = b.UserId AND p.Id = v.PostId AND u.Id = p.OwnerUserId AND p.Id = c.PostId AND p.Id = ph.PostId AND p.ViewCount >= 0 LIMIT 1000; | stats |
With _q As ( 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_s... | tpch |
select count(*) from comments as c, posts as p, postLinks as pl, postHistory as ph, votes as v, badges as b where p.Id = pl.RelatedPostId AND pl.LinkTypeId = 1 AND p.Id = c.PostId AND p.Id = v.PostId AND b.UserId = c.UserId AND p.Id = ph.PostId AND c.Score = 0 | stats |
SELECT MIN(mi.info) AS release_date, MIN(miidx.info) AS rating, MIN(t.title) AS german_movie FROM company_name AS cn, company_type AS ct, info_type AS it, info_type AS it2, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS miidx, title AS t WHERE it.info = 'rating' AND cn.country_code = '[de]'... | job |
with _q as ( select count(*) from posts as p, postLinks as pl, users as u where p.OwnerUserId = u.Id and p.Id = pl.PostId and p.CommentCount <= 17 and u.CreationDate <= '2014-09-12 07:12:16'::timestamp ) select * from _q | 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 c_custkey, c_name, Sum(l_extendedprice * (1 - l_discount)) As revenue, c_acctbal, n_name, c_address, c_phone, c_comment From customer, orders, lineitem, nation Where l_returnflag = 'R' And o_orderdate >= DATE 1 And o_orderdate < DATE 1 + INTERVAL '3' MONTH And c_nationkey = n_nationkey And c_custkey = o_custkey ... | 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 t.id = mc.movie_id AND mc.movie_id = mi.movie_id AND t.id = mi.movie_id AND (mc.note LIKE '%(co-production)%' OR mc.note LIKE '%(presents)%') AND it.info = 'bottom 10 rank' AND mc.no... | job |
SELECT nation, o_year, SUM(amount) AS sum_profit FROM ( SELECT n_name AS nation, EXTRACT(YEAR FROM o_orderdate) AS o_year, l_extendedprice * (1 - l_discount) - ps_supplycost * l_quantity AS amount FROM part, supplier, lineitem, partsupp, orders, nation WHERE ps_suppkey = l_suppkey AND s_suppkey = l_suppkey AND p_name L... | tpch |
SELECT c_last_name, c_first_name, c_salutation, c_preferred_cust_flag, ss_ticket_number, cnt FROM ( SELECT ss_ticket_number, ss_customer_sk, COUNT(*) AS cnt FROM store_sales JOIN date_dim ON ss_sold_date_sk = d_date_sk JOIN store ON ss_store_sk = s_store_sk JOIN household_demographics ON ss_hdemo_sk = hd_demo_sk WHERE ... | tpcds |
SELECT 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 mc.movie_id = t.id AND mc.movie_id = mk.movie_id AND cn.country_code ='[de]' AND cn.id = mc.company_id AND mk.keyword_id = k.id AND k.keyword ='character-name-IN-... | 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 rt.role = 'actress' AND mc.note NOT LIKE '%(USA)%' AND ci.note = '(voice: English version)' AND an1.person_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 cn.country_code ='[sm]' AND t.id = mk.movie_id AND mc.movie_id = mk.movie_id AND mc.movie_id = t.id AND cn.id = mc.company_id AND mk.keyword_id = k.id AND k.keyword ='character-name-In-... | 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 t.production_year > 2000 AND mi.info = ANY(ARRAY['Sweden', 'Norway', 'Germany', 'Denmark', 'Swedish', 'Danish', 'Norwegian', 'German']) AND t.id = mi.movie_id AND k.id = mk.keyword_id AND... | job |
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 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 _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 mk.keyword_id = k.id And cn.id = mc.company_id And k.keyword ='character-name-In-title' And t.id = mk.movie_id And mc.movie_id = t.id And mc.movie_id = mk.movie_id ) Select... | 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 k.keyword = 'character-name-in-title' AND t.id = mk.movie_id AND an.person_id = ci.person_i... | job |
SELECT SUM(ss_ext_sales_price) AS ext_price, i_brand_id AS brand_id, i_manufact_id, 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 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.Id = c.PostId AND pl.LinkTypeId = 1 AND p.Score <= 40 AND b.UserId = u.Id AND p.Id = v.PostId AND c.UserId = u.Id AND p.Id = ph.PostId AND p.Id = pl.RelatedPostId | stats |
select sum(case when (CAST(d_date as DATE) < CAST('2000-03-11' as DATE)) then cs_sales_price - COALESCE(cr_refunded_cash, 0) else 0 end) as sales_before, i_item_id, w_state, sum(case when (CAST(d_date as DATE) >= CAST('2000-03-11' as DATE)) then cs_sales_price - COALESCE(cr_refunded_cash, 0) else 0 end) as sales_after ... | tpcds |
select min(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 it.in... | job |
SELECT MAX(mi_idx.info) AS rating, MAX(cn.name) AS movie_company, MAX(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 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 INNER JOIN customer_demographics On cs_bill_cdemo_sk = cd_demo_sk INNER JOIN date_dim On cs_sold_date_sk = d_date_sk INNER JOIN item On cs_item_sk = i_item_sk INNER JOIN pro... | 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 n.id = ci.person_id AND an.person_id = ci.person_id AND t.id = mc.movie_id AND ci.movie_id ... | job |
with _q as ( select min(t.title) as movie_title from keyword as k, movie_info as mi, movie_keyword as mk, title as t where mk.movie_id = mi.movie_id AND t.production_year > 2010 AND t.id = mi.movie_id AND k.keyword like '%sequel%' AND k.id = mk.keyword_id ) select * from _q AND t.id = mk.movie_id AND mi.info in ('Swede... | job |
SELECT AVG(ss_ext_wholesale_cost), AVG(ss_quantity), SUM(ss_ext_wholesale_cost), AVG(ss_ext_sales_price) 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(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 rt.id = ci.role_id AND ci.note LIKE '%(uncredited)%' AND chn.id = ci.p... | job |
select count(*) from comments as c, posts as p, postLinks as pl where c.UserId = p.OwnerUserId and p.CommentCount <= 18 and p.CreationDate >= '2010-07-23 07:27:31'::timestamp and p.Id = pl.PostId and p.CreationDate <= '2014-09-09 01:43:00'::timestamp | 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 t.id = mk.movie_id and mc.movie_id = t.id and mc.movie_id = mk.movie_id and k.keyword ='character-name-in-title' and cn.country_code ='[nl]' and cn.id = mc.company_id and mk.keyword_id ... | job |
Select i_brand As brand, Sum(ss_ext_sales_price) As ext_price, i_manufact_id, i_brand_id As brand_id, 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 min(t.title) as movie_title from company_name as cn, keyword as k, movie_companies as mc, movie_keyword as mk, title as t where mk.keyword_id = k.id AND cn.country_code ='[de]' AND t.id = mk.movie_id AND mc.movie_id = mk.movie_id AND cn.id = mc.company_id AND mc.movie_id = t.id AND k.keyword ='character-name-in-... | job |
SELECT i_manufact_id, i_manufact, i_brand_id AS brand_id, SUM(ss_ext_sales_price) AS ext_price, i_brand AS brand FROM date_dim JOIN store_sales ON d_date_sk = ss_sold_date_sk JOIN item ON ss_item_sk = i_item_sk JOIN customer ON ss_customer_sk = c_customer_sk JOIN customer_address ON c_current_addr_sk = ca_address_sk JO... | 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 t.id = mk.movie_id AND n.id = ci.person_id AND t.production_year > 2010 AND k.id = mk.keyword_id AND ci.m... | 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 mc.no... | job |
select sum(l_extendedprice * (1 - l_discount)) as sum_disc_price, avg(l_discount) as avg_disc, sum(l_extendedprice) as sum_base_price, l_linestatus, avg(l_quantity) as avg_qty, sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) as sum_charge, sum(l_quantity) as sum_qty, count(*) as count_order, l_returnflag, avg(l_e... | 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 l_receiptdate < DATE 1 + INTERVAL '1' YEAR A... | 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 an1.person_id = n1.id AND mc.note LIKE '%(Japan)%' AND mc.note NOT LIKE '%(USA)%' AND an1.person_id = ci.person... | 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 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 AVG(cs_quantity) AS catalog_sales_quantityave, s_state, STDDEV_SAMP(sr_return_quantity) / AVG(sr_return_quantity) AS store_returns_quantitycov, COUNT(cs_quantity) AS catalog_sales_quantitycount, STDDEV_SAMP(sr_return_quantity) AS store_returns_quantitystdev, i_item_id, COUNT(ss_quantity) AS store_sales_quantityc... | tpcds |
WITH _q AS ( 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 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 ... | 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.country_code = '[ru]' AND cn.id = mc.company_id AND ci.note LIKE '%(voice)%' AND t.id = mc.movie_... | job |
SELECT STDDEV_SAMP(sr_return_quantity) AS store_returns_quantitystdev, COUNT(sr_return_quantity) AS store_returns_quantitycount, COUNT(cs_quantity) AS catalog_sales_quantitycount, AVG(sr_return_quantity) AS store_returns_quantityave, STDDEV_SAMP(sr_return_quantity) / AVG(sr_return_quantity) AS store_returns_quantitycov... | tpcds |
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 it2.info = 'release dates' AND mi.movie_id = mc... | job |
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 n.name LIKE '%Hemsworth%Chris%' AND t.id = ci.movie_id AND k.id = mk.keyword_id AND k.keyword = 'marvel-cinematic-u... | job |
SELECT * FROM ( SELECT AVG(ss_list_price) AS b1_lp, COUNT(ss_list_price) AS b1_cnt, COUNT(DISTINCT ss_list_price) AS b1_cntd FROM store_sales WHERE ss_quantity BETWEEN 0 AND 5 AND (ss_list_price BETWEEN 16 AND 16 + 10 OR ss_coupon_amt BETWEEN 665 AND 665 + 1000 OR ss_wholesale_cost BETWEEN 67 AND 67 + 20) ) AS b1, ( SE... | 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 it.id = pi.info_type_id AND n.id = pi.person_id AND pi.person_id = ci.person_id AND pi.note = 'Volker Boehm' AND an.na... | 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 ct.kind = 'production companies' AND... | 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 rt.role = 'actor' AND ci.movie_id = mc.movie_id AND rt.id = ci.role_id AND chn.id = ci.person_role_i... | job |
Select Min(t.title) As movie_title, Min(mi_idx.info) As rating From info_type As it, movie_info_idx As mi_idx, title As t Where mi_idx.info > '8.0' And t.production_year Between 2000 And 2005 And t.id = mi_idx.movie_id And it.id = mi_idx.info_type_id And it.info ='rating' | job |
SELECT i_item_desc, AVG(cs_quantity) AS catalog_sales_quantityave, s_state, STDDEV_SAMP(sr_return_quantity) AS store_returns_quantitystdev, AVG(sr_return_quantity) AS store_returns_quantityave, COUNT(sr_return_quantity) AS store_returns_quantitycount, STDDEV_SAMP(sr_return_quantity) / AVG(sr_return_quantity) AS store_r... | tpcds |
select count(*) from comments as c, posts as p, postLinks as pl, postHistory as ph, votes as v, badges as b, users as u where p.Id = pl.RelatedPostId AND c.UserId = u.Id AND p.Id = v.PostId AND p.Id = c.PostId AND pl.LinkTypeId = 1 AND p.Score <= 40 AND p.Id = ph.PostId AND b.UserId = u.Id | stats |
SELECT o_orderdate, c_custkey, o_orderkey, SUM(l_quantity), c_name, o_totalprice 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_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 Inner Join store_sales On d_date_sk = ss_sold_date_sk Inner Join item On ss_item_sk = i_item_sk Inner Join customer On ss_customer_sk = c_customer_sk Inner Join customer_address On c_current_ad... | tpcds |
Select i_item_id, i_item_desc, i_category, i_class, i_current_price, Sum(ws_ext_sales_price) As itemrevenue, Sum(ws_ext_sales_price) * 100 / Sum(Sum(ws_ext_sales_price)) OVER (PARTITION By i_class) As revenueratio From web_sales Inner Join item On ws_item_sk = i_item_sk Inner Join date_dim On ws_sold_date_sk = d_date_s... | tpcds |
select min(cn.name) as from_company, min(lt.link) as link_type, min(t.title) as western_sequel from company_name as cn, company_type as ct, info_type as it, keyword as k, link_type as lt, movie_companies as mc, movie_info as mi, movie_keyword as mk, movie_link as ml, title as t where it.info = 'release dates' AND ct.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 count(*) from comments as c, badges as b, users as u where u.Id = c.UserId AND u.UpVotes >= 0 AND c.Score = 0 AND c.UserId = b.UserId LIMIT 200; | stats |
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 t.id = mk.movie_id AND t.id = ci.movie_id AND n.id = ci.person_id AND k.keyword = 'marvel-cinematic-universe' ... | 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 k.keyword LIKE '%sequel%' AND t.id = mk.movie_id AND t.production_year > 2000 AND t.id = mi.movie_id AND mk.movie_id = mi.movie_id AND mi.info IN ('Sweden', 'Norway', 'Germany', 'Denmar... | job |
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 count(*) from comments as c, posts as p, postHistory as ph, votes as v, users as u where u.Id = c.UserId and c.UserId = p.OwnerUserId and p.AnswerCount >= 0 and ph.UserId = v.UserId and p.OwnerUserId = ph.UserId and p.Score <= 13 | stats |
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 o_orderkey = l_orderkey and ps_supp... | tpch |
SELECT COUNT(*) FROM comments AS c, postHistory AS ph, badges AS b, votes AS v, users AS u WHERE u.Id = b.UserId AND ph.PostHistoryTypeId = 12 AND b.UserId = ph.UserId AND u.UpVotes = 0 AND ph.UserId = v.UserId AND v.UserId = c.UserId LIMIT 200; | stats |
SELECT p_size, COUNT(DISTINCT ps_suppkey) AS supplier_cnt, p_type, p_brand FROM partsupp, part WHERE p_size IN (1, 1, 1, 1, 1, 1, 1, 1) AND p_brand <> 1 AND p_partkey = ps_partkey 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 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 |
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_preferred_cust_flag as customer_preferred_cust_flag, c_last_name as customer_last_name, c_birth_country as customer_birth_country, d_year as dyear, c_first_name as customer_firs... | tpcds |
SELECT MIN(cn.name) AS movie_company, MIN(mi_idx.info) AS rating, MIN(t.title) AS western_violent_movie FROM company_name AS cn, company_type AS ct, info_type AS it1, info_type AS it2, keyword AS k, kind_type AS kt, movie_companies AS mc, movie_info AS mi, movie_info_idx AS mi_idx, movie_keyword AS mk, title AS t WHERE... | job |
select min(t.title) as movie_title from 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 cn.id = mc.company_id and t.id = mk.movie_id and mc.movie_id = t.id and mk.keyword_id = k.id and mc.movie_id = mk.mo... | 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 it1.info = 'rating' AND at.title LIKE '%Champion%' AND mi_idx.info < '... | 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 = ci.movie_id AND t.production_year > 2010 AND k.id = mk.keyword_id AND k.keyword = 'marvel-cinematic-universe... | 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 ci.movie_id = mk.movie_id AND t.production_year > 2010 AND k.keyword = 'marvel-cinematic-universe' AND n.id = ci.person_id AND k.id = mk.ke... | 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.production_year > 2000 AND rt.role = 'actress' AND t.id = mi.movie_id A... | job |
SELECT o_shippriority, o_orderdate, l_orderkey, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer, orders, lineitem WHERE o_orderdate < DATE 1 AND c_custkey = o_custkey AND l_shipdate > DATE 1 AND c_mktsegment = 1 AND l_orderkey = o_orderkey GROUP BY l_orderkey, o_orderdate, o_shippriority ORDER BY reven... | tpch |
SELECT SUM(l_quantity) AS sum_qty, l_linestatus, AVG(l_quantity) AS avg_qty, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, l_returnflag, SUM(l_extendedprice) AS sum_base_price, AVG(l_discount) AS avg_disc, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, COUNT(*) AS count_order, AVG(l_e... | tpch |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.