db_id stringclasses 69 values | question stringlengths 24 325 | evidence stringlengths 0 673 | SQL stringlengths 23 804 |
|---|---|---|---|
retails | Please list any three line item numbers that have 10% off. | line item number refers to l_linenumber; 10% off refers to l_discount = 0.1 | SELECT l_linenumber FROM lineitem WHERE l_discount = 0.1 LIMIT 3 |
retails | How many of the line items that have a quantity greater than 40 have been shipped by air? | quantity greater than 40 refers to l_quantity > 40; shipped by air refers to l_shipmode = 'AIR' | SELECT COUNT(l_linenumber) FROM lineitem WHERE l_quantity > 40 AND l_shipmode = 'AIR' |
retails | Which ship mode has more "deliver in person" instructions, rail or mail? | ship mode refers to l_shipmode; "deliver in person" instruction refers to l_shipinstruct = 'DELIVER IN PERSON' | SELECT IIF(SUM(IIF(l_shipmode = 'RAIL', 1, 0)) - SUM(IIF(l_shipmode = 'MAIL', 1, 0)), 'RAIL', 'MAIL') AS result FROM lineitem WHERE l_shipinstruct = 'DELIVER IN PERSON' |
retails | What is the total price and the order priority of order number 33? | total price refers to o_totalprice; order priority refers to o_orderpriority; order number 33 refers to o_orderkey = 33 | SELECT o_totalprice, o_orderpriority FROM orders WHERE o_orderkey = 33 |
retails | How many orders in 1998 had a total price under 950? | 1998 refers to year(o_orderdate) = '1998'; a total price under 950 refers to o_totalprice < 950 | SELECT COUNT(o_orderkey) AS countorders FROM orders WHERE STRFTIME('%Y', o_orderdate) = '1998' AND o_totalprice < 950 |
retails | Please list any three customers with debt. | customer refers to c_name; with debt refers to c_acctbal < 0 | SELECT c_name FROM customer WHERE c_acctbal < 0 LIMIT 3 |
retails | What is the discounted price of line item number 1? | discounted price refers to multiply(l_extendedprice, subtract(1, l_discount)); line item number 1 refers to l_linenumber = 1 | SELECT l_extendedprice * (1 - l_discount) FROM lineitem WHERE l_linenumber = 1 |
retails | What is the difference between the number of returned items and not returned items with the full price of under 16947.7? | full price of under 16947.7 refers to l_extendedprice < 16947.7; returned item refers to l_returnflag = 'R'; not returned item refers to l_returnflag = 'A' OR l_returnflag = 'N'; difference = subtract(count(l_linenumber where l_returnflag = 'A' OR l_returnflag = 'N'), count(l_linenumber where l_returnflag = 'R')) where l_extendedprice < 16947.7 | SELECT SUM(IIF(l_returnflag = 'A', 1, 0)) - SUM(IIF(l_returnflag = 'N', 1, 0)) AS diff FROM lineitem WHERE l_extendedprice < 16947.7 |
retails | What is the supply cost of large plated tin? | supply cost refers to ps_supplycost; large plated tin refers to p_type = 'large plated tin' | SELECT T2.ps_supplycost FROM part AS T1 INNER JOIN partsupp AS T2 ON T1.p_partkey = T2.ps_partkey WHERE T1.p_type = 'large plated tin' |
retails | Please name any three parts that have an available quantity of more than 9998. | part name refers to p_name; an available quantity of more than 9998 refers to ps_availqty > 9998 | SELECT T1.p_name FROM part AS T1 INNER JOIN partsupp AS T2 ON T1.p_partkey = T2.ps_partkey WHERE T2.ps_availqty > 9998 LIMIT 3 |
retails | Please list any two parts that come with the wrap bag container and have a supply cost of under 10. | part name refers to p_name; wrap bag container refers to p_container = 'WRAP BAG'; supply cost of under 10 refers to ps_supplycost < 10 | SELECT T1.p_name FROM part AS T1 INNER JOIN partsupp AS T2 ON T1.p_partkey = T2.ps_partkey WHERE T2.ps_supplycost < 10 AND T1.p_container = 'WRAP BAG' LIMIT 2 |
retails | What is the nationality of supplier number 1? | nationality refers to n_name; supplier number 1 refers to s_suppkey = 1 | SELECT T2.n_name FROM supplier AS T1 INNER JOIN nation AS T2 ON T1.s_nationkey = T2.n_nationkey WHERE T1.s_suppkey = 1 |
retails | What are the countries that belong to Africa? | country is nation name which refers to n_name; Africa is region name refers to r_name = 'Africa' | SELECT T2.n_name FROM region AS T1 INNER JOIN nation AS T2 ON T1.r_regionkey = T2.n_regionkey WHERE T1.r_name = 'Africa' |
retails | Which region has the lowest number of countries? | region refers to has r_name; the lowest number of countries refers to min(count(n_name)) | SELECT T.r_name FROM ( SELECT T1.r_name, COUNT(T2.n_name) AS num FROM region AS T1 INNER JOIN nation AS T2 ON T1.r_regionkey = T2.n_regionkey GROUP BY T1.r_name ) AS T ORDER BY T.num LIMIT 1 |
retails | How many customers from the furniture segments come from Iraq? | furniture segment refers to c_mktsegment = 'FURNITURE'; Iraq refers to n_name = 'Iraq' | SELECT COUNT(T1.c_custkey) FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey WHERE T1.c_mktsegment = 'FURNITURE' AND T2.n_name = 'IRAQ' |
retails | What is the name of the customer number 93697 with the total order price of 191918.92? | customer name refers to c_name; number 93697 refers to o_custkey = 93697; total order price of 191918.92 refers to o_totalprice = 191918.92 | SELECT T2.c_name FROM orders AS T1 INNER JOIN customer AS T2 ON T1.o_custkey = T2.c_custkey WHERE T1.o_totalprice = 191918.92 AND T1.o_custkey = 93697 |
retails | Which nation and region does the Customer#000000008 come from? | nation refers to n_name; region refers to r_name; Customer#000000008 refers to c_name = 'Customer#000000008' | SELECT T1.n_name, T3.r_name FROM nation AS T1 INNER JOIN customer AS T2 ON T1.n_nationkey = T2.c_nationkey INNER JOIN region AS T3 ON T1.n_regionkey = T3.r_regionkey WHERE T2.c_name = 'Customer#000000008' |
retails | What is the delivery time and the clerk of order number 6? | delivery time = subtract(l_receiptdate, l_commitdate); clerk refers to o_clerk; order number 6 refers to o_orderkey = 6 | SELECT JULIANDAY(T2.l_receiptdate) - JULIANDAY(T2.l_commitdate), T1.o_clerk FROM orders AS T1 INNER JOIN lineitem AS T2 ON T1.o_orderkey = T2.l_orderkey WHERE T1.o_orderkey = 6 |
retails | How many Japanese suppliers have their accounts in debt? | Japanese refers to n_name = 'Japan'; have accounts in debt refers to s_acctbal < 0 | SELECT COUNT(T1.s_suppkey) FROM supplier AS T1 INNER JOIN nation AS T2 ON T1.s_nationkey = T2.n_nationkey WHERE T1.s_acctbal < 0 AND T2.n_name = 'JAPAN' |
retails | Which customer is the most in debt? | customer refers to c_name; the most in debt refers to max(c_acctbal) | SELECT c_name FROM customer WHERE c_acctbal = ( SELECT MIN(c_acctbal) FROM customer ) |
retails | List all the dates of the urgent orders. | date refers to o_orderdate; urgent order refers to o_orderpriority = '1-URGENT' | SELECT o_orderdate FROM orders WHERE o_orderpriority = '1-URGENT' |
retails | How many of the items are instructed to be delivered in person? | instructed to be delivered in person refers to l_shipinstruct = 'DELIVER IN PERSON' | SELECT COUNT(l_linenumber) FROM lineitem WHERE l_shipinstruct = 'DELIVER IN PERSON' |
retails | What is the largest supplier's account balance? | the largest supplier's account balance refers to max(s_acctbal) | SELECT MAX(s_acctbal) FROM supplier |
retails | How many part supplies are close to being out of stock? | close to being out of stock refers to ps_availqty < 10 | SELECT COUNT(ps_suppkey) FROM partsupp WHERE ps_availqty < 10 |
retails | List all the nations in Europe. | nation refers to n_name; Europe refers to r_name = 'EUROPE' | SELECT T2.n_name FROM region AS T1 INNER JOIN nation AS T2 ON T1.r_regionkey = T2.n_regionkey WHERE T1.r_name = 'EUROPE' |
retails | What is the supply cost for the part "violet olive rose ivory sandy"? | supply cost refers to ps_supplycost; part "violet olive rose ivory sandy" refers to p_name = 'violet olive rose ivory sandy' | SELECT T2.ps_supplycost FROM part AS T1 INNER JOIN partsupp AS T2 ON T1.p_partkey = T2.ps_partkey WHERE T1.p_name = 'violet olive rose ivory sandy' |
retails | List all the customers' phone numbers from Ethiopia. | phone number refers to c_phone; Ethiopia refers to n_name = 'Ethiopia' | SELECT T1.c_phone FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey WHERE T2.n_name = 'Ethiopia' |
retails | What is the total price of all orders from the customer with the phone number "627-220-3983"? | total price = sum(o_totalprice); phone number "627-220-3983" refers to c_phone = '627-220-3983' | SELECT SUM(T1.o_totalprice) FROM orders AS T1 INNER JOIN customer AS T2 ON T1.o_custkey = T2.c_custkey WHERE T2.c_phone = '627-220-3983' |
retails | What are the shipping methods for the orders on 12/31/1994? | shipping method refers to l_shipmode; order on 12/31/1994 refers to o_orderdate = '1994-12-31' | SELECT DISTINCT T2.l_shipmode FROM orders AS T1 INNER JOIN lineitem AS T2 ON T1.o_orderkey = T2.l_orderkey WHERE T1.o_orderdate = '1994-12-31' |
retails | What is the account balance of the supplier with the most parts? | account balance refers to s_acctbal; the most parts refers to max(count(ps_suppkey)) | SELECT T.s_acctbal FROM ( SELECT T1.s_acctbal, COUNT(T2.ps_suppkey) AS num FROM supplier AS T1 INNER JOIN partsupp AS T2 ON T1.s_suppkey = T2.ps_suppkey GROUP BY T1.s_suppkey ) AS T ORDER BY T.num DESC LIMIT 1 |
retails | Which nation does the supplier with the account balance of "4393.04" belong to? | nation refers to n_name; account balance of "4393.04" refers to s_acctbal = 4393.04 | SELECT T2.n_name FROM supplier AS T1 INNER JOIN nation AS T2 ON T1.s_nationkey = T2.n_nationkey WHERE T1.s_acctbal = 4393.04 |
retails | What is the region with the most customers? | region refers to r_name; the most customers refers to max(count(c_custkey)) | SELECT T.r_name FROM ( SELECT T3.r_name, COUNT(T2.c_custkey) AS num FROM nation AS T1 INNER JOIN customer AS T2 ON T1.n_nationkey = T2.c_nationkey INNER JOIN region AS T3 ON T1.n_regionkey = T3.r_regionkey GROUP BY T3.r_name ) AS T ORDER BY T.num DESC LIMIT 1 |
retails | List the phone number of the customer who placed orders with a total price of more than $300,000. | phone number refers to c_phone; a total price of more than $300,000 refers to o_totalprice > 300000 | SELECT T2.c_phone FROM orders AS T1 INNER JOIN customer AS T2 ON T1.o_custkey = T2.c_custkey WHERE T1.o_totalprice > 300000 |
retails | What are the clerks of orders with line items shipped by mail? | clerk refers to o_clerk; shipped by mail refers to l_shipmode = 'MAIL' | SELECT T1.o_clerk FROM orders AS T1 INNER JOIN lineitem AS T2 ON T1.o_orderkey = T2.l_orderkey WHERE T2.l_shipmode = 'MAIL' |
retails | What are the top 5 nations of suppliers with the lowest account balance? | nation refers to n_name; the lowest account balance refers to min(s_acctbal) | SELECT T2.n_name FROM supplier AS T1 INNER JOIN nation AS T2 ON T1.s_nationkey = T2.n_nationkey ORDER BY T1.s_acctbal LIMIT 1 |
retails | List all the addresses for the suppliers of the biggest parts. | addresses refers to s_address; the biggest part refers to max(p_size) | SELECT T2.s_address FROM partsupp AS T1 INNER JOIN supplier AS T2 ON T1.ps_suppkey = T2.s_suppkey INNER JOIN part AS T3 ON T1.ps_partkey = T3.p_partkey ORDER BY T3.p_size DESC LIMIT 1 |
retails | Which part and supplier have the most profit? | part refers to p_name; supplier refers to s_name; the most profit refers to max(subtract(multiply(l_extendedprice, subtract(1, l_discount)), multiply(ps_supplycost, l_quantity))) | SELECT T3.p_name, T4.s_name FROM partsupp AS T1 INNER JOIN lineitem AS T2 ON T1.ps_suppkey = T2.l_suppkey INNER JOIN part AS T3 ON T1.ps_partkey = T3.p_partkey INNER JOIN supplier AS T4 ON T1.ps_suppkey = T4.s_suppkey ORDER BY T2.l_extendedprice * (1 - T2.l_discount) - T1.ps_supplycost * T2.l_quantity DESC LIMIT 1 |
retails | What proportion of suppliers are from Asia? | Asia refers to r_name = 'ASIA'; proportion = divide(count(s_name where r_name = 'ASIA'), count(s_name)) * 100% | SELECT CAST(SUM(IIF(T1.r_name = 'ASIA', 1, 0)) AS REAL) * 100 / COUNT(T1.r_regionkey) FROM region AS T1 INNER JOIN nation AS T2 ON T1.r_regionkey = T2.n_regionkey INNER JOIN supplier AS T3 ON T2.n_nationkey = T3.s_nationkey |
retails | Please indicate the total price of order key 32. | total price refers to o_totalprice; order key 32 refers to o_orderkey = 32 | SELECT o_totalprice FROM orders WHERE o_orderkey = 32 |
retails | How many order keys are not applied for the discount? | order key refers to l_orderkey; not applied for the discount refers to l_discount = 0 | SELECT COUNT(l_orderkey) FROM lineitem WHERE l_discount = 0 |
retails | List line items shipped by truck with delivery time before 1997. | line item refers to l_linenumber; shipped by truck refers to l_shipmode = 'truck'; delivery time before 1997 refers to year(l_shipdate) < 1997 | SELECT l_linenumber FROM lineitem WHERE STRFTIME('%Y', l_shipdate) < 1997 AND l_shipmode = 'truck' |
retails | How many line items were returned in 1998? | line item refers to l_linenumber; returned refers to returnflag = 'R'; in 1998 refers to year(l_shipdate) = 1998 | SELECT l_linenumber FROM lineitem WHERE STRFTIME('%Y', l_shipdate) < 1997 AND l_shipmode = 'TRUCK' |
retails | Which line item with the highest quantity is shipped by air? | line item refers to l_linenumber; the highest quantity refers to max(l_quantity); shipped by air refers to l_shipmode = 'AIR' | SELECT l_linenumber FROM lineitem WHERE l_shipmode = 'AIR' ORDER BY l_quantity DESC LIMIT 1 |
retails | List the names of customers whose accounts are in debt. | name of customer refers to c_name; account in debt refers to c_acctbal < 0 | SELECT c_name FROM customer WHERE c_acctbal < 0 |
retails | How many customers belong to the household segment in Germany? | household segment refers to c_mktsegment = 'household'; Germany refers to n_name = 'Germany' | SELECT COUNT(T1.c_name) FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey WHERE T1.c_mktsegment = 'HOUSEHOLD' AND T2.n_name = 'GERMANY' |
retails | List the phone numbers of customers whose order priority is urgent. | phone number refers to c_phone; order priority is urgent refers to o_orderpriority = '1-URGENT' | SELECT T2.c_phone FROM orders AS T1 INNER JOIN customer AS T2 ON T1.o_custkey = T2.c_custkey WHERE T1.o_orderpriority = '1-URGENT' |
retails | Name of customer whose order is applied with the highest discount. | customer name refers to c_name; the highest discount refers to max(l_discount) | SELECT T3.c_name FROM orders AS T1 INNER JOIN lineitem AS T2 ON T1.o_orderkey = T2.l_orderkey INNER JOIN customer AS T3 ON T1.o_custkey = T3.c_custkey ORDER BY T2.l_discount DESC LIMIT 1 |
retails | List the 5 orders with the highest total price, indicating the delivery date. | order refers to o_orderkey; the highest total price refers to max(o_totalprice); delivery date refers to l_shipdate | SELECT T1.o_orderkey, T2.l_shipdate FROM orders AS T1 INNER JOIN lineitem AS T2 ON T1.o_orderkey = T2.l_orderkey ORDER BY T1.o_totalprice DESC LIMIT 5 |
retails | List the comments describing orders from customers in the furniture segment. | comment refers to o_comment; furniture segment refers to c_mktsegment = 'FURNITURE' | SELECT T1.o_comment FROM orders AS T1 INNER JOIN customer AS T2 ON T1.o_custkey = T2.c_custkey WHERE T2.c_mktsegment = 'FURNITURE' |
retails | Please indicate the names of the customers whose order with a total price over $300000. | customer name refers to c_name; a total price over $300000 refers to o_totalprice > 300000 | SELECT T2.c_name FROM orders AS T1 INNER JOIN customer AS T2 ON T1.o_custkey = T2.c_custkey WHERE T1.o_totalprice > 300000 |
retails | Name customers in India with account balances over $5000. | customer name refers to c_name; India refers to n_name = 'INDIA'; account balance over $5000 refers to c_acctbal > 5000 | SELECT T1.c_name FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey WHERE T1.c_acctbal > 5000 AND T2.n_name = 'INDIA' |
retails | List the phone numbers of suppliers from Japan. | phone number refers to s_phone; Japan refers to n_name = 'JAPAN' | SELECT T1.s_phone FROM supplier AS T1 INNER JOIN nation AS T2 ON T1.s_nationkey = T2.n_nationkey WHERE T2.n_name = 'JAPAN' |
retails | Among the providers in Argentina, which supplier has an account that is in debt? | Argentina refers to n_name = 'ARGENTINA'; supplier refers to s_name; an account in debt refers to s_acctbal < 0 | SELECT T1.s_name FROM supplier AS T1 INNER JOIN nation AS T2 ON T1.s_nationkey = T2.n_nationkey WHERE T1.s_acctbal < 0 AND T2.n_name = 'ARGENTINA' |
retails | How many countries belong to the Algeria region? | the algeria region refers to r_name = 'ALGERIA' | SELECT COUNT(T1.r_name) FROM region AS T1 INNER JOIN nation AS T2 ON T1.r_regionkey = T2.n_regionkey WHERE T2.n_name = 'ALGERIA' |
retails | Please indicate the names of customers whose orders are eligible for 10% discount with order dates between 1/1/1994 and 1/1/1995. | customer name refers to c_name; 10% discount refers to l_discount = 0.1; order dates between 1/1/1994 and 1/1/1995 refers to year(o_orderdate) = 1994 OR o_orderdate = '1995-01-01' | SELECT T3.c_name FROM orders AS T1 INNER JOIN lineitem AS T2 ON T1.o_orderkey = T2.l_orderkey INNER JOIN customer AS T3 ON T1.o_custkey = T3.c_custkey WHERE T2.l_discount = 0.1 AND STRFTIME('%Y', T1.o_orderdate) BETWEEN 1994 AND 1995 |
retails | Calculate the percentage of countries that belong to the American region. | the American region refers to r_name = 'America'; percentage = divide(count(n_name where r_name = 'America'), count(n_name)) * 100% | SELECT CAST(SUM(IIF(T1.r_name = 'America', 1, 0)) AS REAL) * 100 / COUNT(T2.n_name) FROM region AS T1 INNER JOIN nation AS T2 ON T1.r_regionkey = T2.n_regionkey |
retails | Calculate percentage of household segment in Indonesia. | household segment refers to c_mktsegment = 'HOUSEHOLD'; Indonesia refers to n_name = 'Indonesia'; percentage = divide(count(c_mktsegment = 'HOUSEHOLD'), count(c_mktsegment)) where n_name = 'Indonesia' * 100% | SELECT CAST(SUM(IIF(T1.c_mktsegment = 'HOUSEHOLD', 1, 0)) AS REAL) * 100 / COUNT(T1.c_mktsegment) FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey WHERE T2.n_name = 'INDONESIA' |
retails | Please list the names of all the products under the type "promo brushed steel". | product name refers to p_name; type "promo brushed steel" refers to p_type = 'PROMO BRUSHED STEEL' | SELECT p_name FROM part WHERE p_type = 'PROMO BRUSHED STEEL' |
retails | What is the comment of the product "burlywood plum powder puff mint"? | comment refers to p_comment; product "burlywood plum powder puff mint" refers to p_name = 'burlywood plum powder puff mint' | SELECT p_comment FROM part WHERE p_name = 'burlywood plum powder puff mint' |
retails | How many parts have a retail price of over 1900? | a retail price of over 1900 refers to p_retailprice > 1900 | SELECT COUNT(p_partkey) FROM part WHERE p_retailprice > 1900 |
retails | Among the products under the type "promo brushed steel", how many of them are manufactured by Manufacturer#5? | type "promo brushed steel" refers to p_type = 'PROMO BRUSHED STEEL'; Manufacturer#5 refers to p_mfgr = 'Manufacturer#5' | SELECT COUNT(p_partkey) FROM part WHERE p_type = 'PROMO BRUSHED STEEL' AND p_mfgr = 'Manufacturer#5' |
retails | Please list all the brands that contain a part under the type "promo brushed steel". | brand refers to p_brand; type "promo brushed steel" refers to p_type = 'PROMO BRUSHED STEEL' | SELECT p_brand FROM part WHERE p_type = 'PROMO BRUSHED STEEL' |
retails | What is the name of the product with the highest retail price? | name of the product refers to p_name; the highest retail price refers to p_retailprice | SELECT p_name FROM part WHERE p_retailprice = ( SELECT MAX(p_retailprice) FROM part ) |
retails | Which part has a bigger size, "pink powder drab lawn cyan" or "cornflower sky burlywood green beige"? | size refers to p_size; "pink powder drab lawn cyan" or "cornflower sky burlywood green beige" refers to p_name in ('pink powder drab lawn cyan', 'cornflower sky burlywood green beige') | SELECT T.p_name FROM ( SELECT p_name, p_size FROM part WHERE p_name IN ('pink powder drab lawn cyan', 'cornflower sky burlywood green beige') ) AS T ORDER BY p_size DESC LIMIT 1 |
retails | How many parts have a jumbo case container? | jumbo case container refers to p_container = 'JUMBO CASE' | SELECT COUNT(p_partkey) FROM part WHERE p_container = 'JUMBO CASE' |
retails | What is the size of the smallest part in a jumbo case container? | size refers to p_size; the smallest part refers to min(p_size); jumbo case container refers to p_container = 'JUMBO CASE' | SELECT MIN(p_size) FROM part WHERE p_container = 'JUMBO CASE' |
retails | How many suppliers have their accounts in debt? | account in debt refers to s_acctbal < 0 | SELECT COUNT(s_suppkey) FROM supplier WHERE s_acctbal < 0 |
retails | Please list the names of the top 3 suppliers with the most amount of money in their accounts. | supplier name refers to s_name; the most amount of money refers to max(s_acctbal) | SELECT s_name FROM supplier ORDER BY s_acctbal DESC LIMIT 3 |
retails | Please list the phone numbers of all the suppliers in Germany. | phone number refers to s_phone; Germany refers to n_name = 'Germany' | SELECT T1.s_phone FROM supplier AS T1 INNER JOIN nation AS T2 ON T1.s_nationkey = T2.n_nationkey WHERE T2.n_name = 'Germany' |
retails | Please list the names of all the suppliers for the part "hot spring dodger dim light". | supplier name refers to s_name; part "hot spring dodger dim light" refers to p_name = 'hot spring dodger dim light' | SELECT T2.s_name FROM partsupp AS T1 INNER JOIN supplier AS T2 ON T1.ps_suppkey = T2.s_suppkey INNER JOIN part AS T3 ON T1.ps_partkey = T3.p_partkey WHERE T3.p_name = 'hot spring dodger dim light' |
retails | What is the lowest supply cost for the part "hot spring dodger dim light"? | the lowest supply cost refers to min(ps_supplycost); part "hot spring dodger dim light" refers to p_name = 'hot spring dodger dim light' | SELECT MIN(T1.ps_supplycost) FROM partsupp AS T1 INNER JOIN part AS T2 ON T1.ps_partkey = T2.p_partkey WHERE T2.p_name = 'hot spring dodger dim light' |
retails | What is the name of the supplier that provides the part "hot spring dodger dim light" with the lowest supply cost? | supplier name refers to s_name; part "hot spring dodger dim light" refers to p_name = 'hot spring dodger dim light'; the lowest supply cost refers to min(ps_supplycost) | SELECT T2.s_name FROM partsupp AS T1 INNER JOIN supplier AS T2 ON T1.ps_suppkey = T2.s_suppkey INNER JOIN part AS T3 ON T1.ps_partkey = T3.p_partkey WHERE T3.p_name = 'hot spring dodger dim light' ORDER BY T1.ps_supplycost LIMIT 1 |
retails | What is the total quantity available by all suppliers for the part "hot spring dodger dim light"? | total quantity available refers to sum(ps_availqty); part "hot spring dodger dim light" refers to p_name = 'hot spring dodger dim light' | SELECT SUM(T1.ps_availqty) FROM partsupp AS T1 INNER JOIN part AS T2 ON T1.ps_partkey = T2.p_partkey WHERE T2.p_name = 'hot spring dodger dim light' |
retails | Which supplier can provide the most number of "hot spring dodger dim light"? Please give the supplier's phone number. | the most number refers to max(ps_availqty); "hot spring dodger dim light" refers to p_name = 'hot spring dodger dim light'; phone number refers to s_phone | SELECT T3.s_phone FROM part AS T1 INNER JOIN partsupp AS T2 ON T1.p_partkey = T2.ps_partkey INNER JOIN supplier AS T3 ON T2.ps_suppkey = T3.s_suppkey WHERE T1.p_name = 'hot spring dodger dim light' ORDER BY T2.ps_availqty DESC LIMIT 1 |
retails | Please list the names of all the suppliers for the part with the highest retail price. | supplier name refers to s_name; the highest retail price refers to max(p_retailprice) | SELECT T3.s_phone FROM part AS T1 INNER JOIN partsupp AS T2 ON T1.p_partkey = T2.ps_partkey INNER JOIN supplier AS T3 ON T2.ps_suppkey = T3.s_suppkey WHERE T1.p_name = 'hot spring dodger dim light' ORDER BY T1.p_size DESC LIMIT 1 |
retails | How many suppliers for the part "hot spring dodger dim light" are in Vietnam? | part "hot spring dodger dim light" refers to p_name = 'hot spring dodger dim light'; Vietnam refers to n_name = 'VIETNAM' | SELECT COUNT(T3.s_name) FROM part AS T1 INNER JOIN partsupp AS T2 ON T1.p_partkey = T2.ps_partkey INNER JOIN supplier AS T3 ON T2.ps_suppkey = T3.s_suppkey INNER JOIN nation AS T4 ON T3.s_nationkey = T4.n_nationkey WHERE T1.p_name = 'hot spring dodger dim light' AND T4.n_name = 'VIETNAM' |
retails | Among the suppliers providing parts under the type "promo brushed steel", how many of them are in debt? | type "promo brushed steel" refers to p_type = 'PROMO BRUSHED STEEL'; in debt refers to s_acctbal < 0 | SELECT COUNT(T3.s_name) FROM part AS T1 INNER JOIN partsupp AS T2 ON T1.p_partkey = T2.ps_partkey INNER JOIN supplier AS T3 ON T2.ps_suppkey = T3.s_suppkey WHERE T3.s_acctbal < 0 AND T1.p_type = 'PROMO BRUSHED STEEL' |
retails | Please list the names of all the suppliers for parts under Brand#55. | supplier name refers to s_name; Brand#55 refers to p_brand = 'Brand#55' | SELECT T3.s_name FROM part AS T1 INNER JOIN partsupp AS T2 ON T1.p_partkey = T2.ps_partkey INNER JOIN supplier AS T3 ON T2.ps_suppkey = T3.s_suppkey WHERE T1.p_brand = 'Brand#55' |
retails | Among all the parts under the type "promo brushed steel", how many of them have a total available quantity from all suppliers of under 5000? | type "promo brushed steel" refers to p_type = 'PROMO BRUSHED STEEL'; a total available quantity of under 5000 refers to sum(ps_availqty) < 5000 | SELECT SUM(num) FROM ( SELECT COUNT(T3.s_name) AS num FROM part AS T1 INNER JOIN partsupp AS T2 ON T1.p_partkey = T2.ps_partkey INNER JOIN supplier AS T3 ON T2.ps_suppkey = T3.s_suppkey WHERE T1.p_type = 'PROMO BRUSHED STEEL' GROUP BY T2.ps_partkey HAVING SUM(T2.ps_availqty) < 5000 ) T |
retails | The part "hot spring dodger dim light" is ordered in how many orders? | part "hot spring dodger dim light" refers to p_name = 'hot spring dodger dim light' | SELECT COUNT(T1.p_partkey) FROM part AS T1 INNER JOIN lineitem AS T2 ON T1.p_partkey = T2.l_partkey WHERE T1.p_name = 'hot spring dodger dim light' |
retails | What is the total quantity of the part "hot spring dodger dim light" ordered in all orders? | total quantity refers to sum(l_quantity); part "hot spring dodger dim light" refers to p_name = 'hot spring dodger dim light' | SELECT SUM(T1.p_partkey) FROM part AS T1 INNER JOIN lineitem AS T2 ON T1.p_partkey = T2.l_partkey WHERE T1.p_name = 'hot spring dodger dim light' |
retails | Please list the order keys of all the orders that have more than 2 parts with a jumbo case container. | order key refers to l_orderkey; jumbo case container refers to p_container = 'JUMBO CASE'; more than 2 parts refers to count(l_partkey) > 2 | SELECT T.l_orderkey FROM ( SELECT T2.l_orderkey, COUNT(T2.l_partkey) AS num FROM part AS T1 INNER JOIN lineitem AS T2 ON T1.p_partkey = T2.l_partkey WHERE T1.p_container = 'JUMBO CASE' GROUP BY T2.l_orderkey ) AS T WHERE T.num > 2 |
retails | Among all the suppliers in debt, how many of them are in Europe? | in debt refers to s_acctbal < 0; Europe refers to r_name = 'EUROPE' | SELECT COUNT(T1.n_nationkey) FROM nation AS T1 INNER JOIN region AS T2 ON T1.n_regionkey = T2.r_regionkey INNER JOIN supplier AS T3 ON T1.n_nationkey = T3.s_nationkey WHERE T2.r_name = 'EUROPE' AND T3.s_acctbal < 0 |
retails | Among all the suppliers providing the part "hot spring dodger dim light", how many of them are in Europe? | part "hot spring dodger dim light" refers to p_name = hot spring dodger dim light; Europe refers to r_name = 'EUROPE' | SELECT COUNT(T1.r_regionkey) FROM region AS T1 INNER JOIN nation AS T2 ON T1.r_regionkey = T2.n_regionkey INNER JOIN supplier AS T3 ON T2.n_nationkey = T3.s_nationkey WHERE T1.r_name = 'EUROPE' |
retails | Please list the phone numbers of all the suppliers for the parts ordered in order no.1. | phone number refers to s_phone; order no.1 refers to l_orderkey = 1 | SELECT T2.s_phone FROM lineitem AS T1 INNER JOIN supplier AS T2 ON T1.l_suppkey = T2.s_suppkey WHERE T1.l_orderkey = 1 |
retails | Among the suppliers for the parts ordered in order no.4, how many of them are in debt? | order no.4 refers to l_orderkey = 4; in debt refers to s_acctbal < 0 | SELECT COUNT(T1.l_linenumber) FROM lineitem AS T1 INNER JOIN supplier AS T2 ON T1.l_suppkey = T2.s_suppkey WHERE T1.l_orderkey = 4 AND T2.s_acctbal < 0 |
retails | Among the parts that are returned, how many of them are provided by a supplier in debt? | returned refers to l_returnflag = 'R'; in debt refers to s_acctbal < 0 | SELECT COUNT(T1.l_partkey) FROM lineitem AS T1 INNER JOIN supplier AS T2 ON T1.l_suppkey = T2.s_suppkey WHERE T1.l_returnflag = 'R' AND T2.s_acctbal < 0 |
retails | On which date was the part "burnished seashell gainsboro navajo chocolate" in order no.1 shipped? | date refers to l_shipdate; part "burnished seashell gainsboro navajo chocolate" refers to p_name = 'burnished seashell gainsboro navajo chocolate'; order no.1 refers to l_orderkey = 1 | SELECT T1.l_shipdate FROM lineitem AS T1 INNER JOIN part AS T2 ON T1.l_partkey = T2.p_partkey WHERE T1.l_orderkey = 1 AND T2.p_name = 'burnished seashell gainsboro navajo chocolate' |
retails | What is the quantity of the part "burnished seashell gainsboro navajo chocolate" ordered in order no.1? | quantity refers to l_quantity; part "burnished seashell gainsboro navajo chocolate" refers to p_name = 'burnished seashell gainsboro navajo chocolate'; order no.1 refers to l_orderkey = 1 | SELECT T1.l_quantity FROM lineitem AS T1 INNER JOIN part AS T2 ON T1.l_partkey = T2.p_partkey WHERE T1.l_orderkey = 1 AND T2.p_name = 'burnished seashell gainsboro navajo chocolate' |
retails | Which part is ordered in a bigger amount in order no.1, "burnished seashell gainsboro navajo chocolate" or "salmon white grey tan navy"? | amount refers to sum(l_quantity); order no.1 refers to l_orderkey = 1; "burnished seashell gainsboro navajo chocolate" or "salmon white grey tan navy" refers to p_name IN ('salmon white grey tan navy', 'burnished seashell gainsboro navajo chocolate') | SELECT T.p_name FROM ( SELECT T2.p_name, SUM(T1.l_quantity) AS num FROM lineitem AS T1 INNER JOIN part AS T2 ON T1.l_partkey = T2.p_partkey WHERE T2.p_name IN ('salmon white grey tan navy', 'burnished seashell gainsboro navajo chocolate') GROUP BY T1.l_partkey ) AS T ORDER BY T.num DESC LIMIT 1 |
retails | What is the biggest discount among all orders for the part "burnished seashell gainsboro navajo chocolate"? | the biggest discount refers to max(l_discount); part "burnished seashell gainsboro navajo chocolate" refers to p_name = 'burnished seashell gainsboro navajo chocolate' | SELECT MAX(T1.l_discount) FROM lineitem AS T1 INNER JOIN part AS T2 ON T1.l_partkey = T2.p_partkey WHERE T2.p_name = 'burnished seashell gainsboro navajo chocolate' |
retails | Please list all the modes of shipping for the part "burnished seashell gainsboro navajo chocolate". | mode of shipping refers to l_shipmode; part "burnished seashell gainsboro navajo chocolate" refers to p_name = 'burnished seashell gainsboro navajo chocolate' | SELECT DISTINCT T1.l_shipmode FROM lineitem AS T1 INNER JOIN part AS T2 ON T1.l_partkey = T2.p_partkey WHERE T2.p_name = 'burnished seashell gainsboro navajo chocolate' |
retails | What is the average supply cost for the part "hot spring dodger dim light"? | average supply cost refers to avg(ps_supplycost); part "hot spring dodger dim light" refers to p_name = 'hot spring dodger dim light' | SELECT AVG(T1.ps_supplycost) FROM partsupp AS T1 INNER JOIN supplier AS T2 ON T1.ps_suppkey = T2.s_suppkey INNER JOIN part AS T3 ON T1.ps_partkey = T3.p_partkey WHERE T3.p_name = 'hot spring dodger dim light' |
retails | How much higher in percentage is the highest supply cost of the part "hot spring dodger dim light" than the lowest supply cost? | part "hot spring dodger dim light" refers to p_name = 'hot spring dodger dim light'; percentage = divide(subtract(max(ps_supplycost), min(ps_supplycost)), min(ps_supplycost)) * 100% | SELECT CAST((MAX(T1.ps_supplycost) - MIN(T1.ps_supplycost)) AS REAL) * 100 / MIN(T1.ps_supplycost) FROM partsupp AS T1 INNER JOIN supplier AS T2 ON T1.ps_suppkey = T2.s_suppkey INNER JOIN part AS T3 ON T1.ps_partkey = T3.p_partkey WHERE T3.p_name = 'hot spring dodger dim light' |
retails | What is the profit for part no.98768 in order no.1? | part no.98768 refers to l_partkey = 98768; order no.1 refers to l_orderkey = 1; profit = subtract(multiply(l_extendedprice, subtract(1, l_discount)), multiply(ps_supplycost, l_quantity)) | SELECT T1.l_extendedprice * (1 - T1.l_discount) - T2.ps_supplycost * T1.l_quantity FROM lineitem AS T1 INNER JOIN partsupp AS T2 ON T1.l_suppkey = T2.ps_suppkey WHERE T1.l_orderkey = 1 AND T1.l_partkey = 98768 |
retails | What is the discounted price of the part "burnished seashell gainsboro navajo chocolate" in order no.1? | part "burnished seashell gainsboro navajo chocolate" refers to p_name = 'burnished seashell gainsboro navajo chocolate'; order no.1 refers to l_orderkey = 1; discounted price refers to multiply(l_extendedprice, subtract(1, l_discount)) | SELECT T1.l_extendedprice * (1 - T1.l_discount) FROM lineitem AS T1 INNER JOIN part AS T2 ON T1.l_partkey = T2.p_partkey WHERE T2.p_name = 'burnished seashell gainsboro navajo chocolate' AND T1.l_orderkey = 1 |
retails | Which market segment does the customer with the highest amount of debt belongs to? | market segment refers to c_mktsegment; the highest amount of debt refers to max(c_acctbal) | SELECT c_mktsegment FROM customer WHERE c_acctbal = ( SELECT MIN(c_acctbal) FROM customer ) |
retails | In 1997, how many orders were shipped via mail? | 1997 refers to year(l_shipdate) = 1997; shipped via mail refers to l_shipmode = 'MAIL' | SELECT COUNT(l_orderkey) FROM lineitem WHERE STRFTIME('%Y', l_shipdate) = '1997' AND l_shipmode = 'MAIL' |
retails | How many customers are in the furniture segment? | furniture segment refers to c_mktsegment = 'FURNITURE' | SELECT COUNT(c_custkey) FROM customer WHERE c_mktsegment = 'FURNITURE' |
retails | Among the items shipped in 1994 via truck, how many items were returned? | 1994 refers to year(l_shipdate) = 1994; via truck refers to l_shipmode = 'TRUCK'; returned refers to l_returnflag = 'R' | SELECT COUNT(l_orderkey) FROM lineitem WHERE STRFTIME('%Y', l_shipdate) = '1994' AND l_returnflag = 'R' AND l_shipmode = 'TRUCK' |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.