problem
stringlengths
121
422
db_id
stringclasses
69 values
solution
stringlengths
23
804
Write SQL query to solve given problem: How many of the items are instructed to be delivered in person?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
SELECT COUNT(l_linenumber) FROM lineitem WHERE l_shipinstruct = 'DELIVER IN PERSON'
Write SQL query to solve given problem: What is the largest supplier's account balance?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
SELECT MAX(s_acctbal) FROM supplier
Write SQL query to solve given problem: How many part supplies are close to being out of stock?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
SELECT COUNT(ps_suppkey) FROM partsupp WHERE ps_availqty < 10
Write SQL query to solve given problem: List all the nations in Europe.. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
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'
Write SQL query to solve given problem: What is the supply cost for the part "violet olive rose ivory sandy"?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
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'
Write SQL query to solve given problem: List all the customers' phone numbers from Ethiopia.. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
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'
Write SQL query to solve given problem: What is the total price of all orders from the customer with the phone number "627-220-3983"?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
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'
Write SQL query to solve given problem: What are the shipping methods for the orders on 12/31/1994?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
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'
Write SQL query to solve given problem: What is the account balance of the supplier with the most parts?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
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
Write SQL query to solve given problem: Which nation does the supplier with the account balance of "4393.04" belong to?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
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
Write SQL query to solve given problem: What is the region with the most customers?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
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
Write SQL query to solve given problem: List the phone number of the customer who placed orders with a total price of more than $300,000.. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
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
Write SQL query to solve given problem: What are the clerks of orders with line items shipped by mail?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
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'
Write SQL query to solve given problem: What are the top 5 nations of suppliers with the lowest account balance?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
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
Write SQL query to solve given problem: List all the addresses for the suppliers of the biggest parts.. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
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
Write SQL query to solve given problem: Which part and supplier have the most profit?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
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
Write SQL query to solve given problem: What proportion of suppliers are from Asia?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
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
Write SQL query to solve given problem: Please indicate the total price of order key 32.. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
SELECT o_totalprice FROM orders WHERE o_orderkey = 32
Write SQL query to solve given problem: How many order keys are not applied for the discount?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
SELECT COUNT(l_orderkey) FROM lineitem WHERE l_discount = 0
Write SQL query to solve given problem: List line items shipped by truck with delivery time before 1997.. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
SELECT l_linenumber FROM lineitem WHERE STRFTIME('%Y', l_shipdate) < 1997 AND l_shipmode = 'truck'
Write SQL query to solve given problem: How many line items were returned in 1998?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
SELECT l_linenumber FROM lineitem WHERE STRFTIME('%Y', l_shipdate) < 1997 AND l_shipmode = 'TRUCK'
Write SQL query to solve given problem: Which line item with the highest quantity is shipped by air?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
SELECT l_linenumber FROM lineitem WHERE l_shipmode = 'AIR' ORDER BY l_quantity DESC LIMIT 1
Write SQL query to solve given problem: List the names of customers whose accounts are in debt.. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
SELECT c_name FROM customer WHERE c_acctbal < 0
Write SQL query to solve given problem: How many customers belong to the household segment in Germany?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
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'
Write SQL query to solve given problem: List the phone numbers of customers whose order priority is urgent.. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
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'
Write SQL query to solve given problem: Name of customer whose order is applied with the highest discount.. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
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
Write SQL query to solve given problem: List the 5 orders with the highest total price, indicating the delivery date.. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
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
Write SQL query to solve given problem: List the comments describing orders from customers in the furniture segment.. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
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'
Write SQL query to solve given problem: Please indicate the names of the customers whose order with a total price over $300000.. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
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
Write SQL query to solve given problem: Name customers in India with account balances over $5000.. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
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'
Write SQL query to solve given problem: List the phone numbers of suppliers from Japan.. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
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'
Write SQL query to solve given problem: Among the providers in Argentina, which supplier has an account that is in debt?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
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'
Write SQL query to solve given problem: How many countries belong to the Algeria region?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
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'
Write SQL query to solve given problem: Please indicate the names of customers whose orders are eligible for 10% discount with order dates between 1/1/1994 and 1/1/1995.. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
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
Write SQL query to solve given problem: Calculate the percentage of countries that belong to the American region.. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
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
Write SQL query to solve given problem: Calculate percentage of household segment in Indonesia.. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
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'
Write SQL query to solve given problem: Please list the names of all the products under the type "promo brushed steel".. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
SELECT p_name FROM part WHERE p_type = 'PROMO BRUSHED STEEL'
Write SQL query to solve given problem: What is the comment of the product "burlywood plum powder puff mint"?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
SELECT p_comment FROM part WHERE p_name = 'burlywood plum powder puff mint'
Write SQL query to solve given problem: How many parts have a retail price of over 1900?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
SELECT COUNT(p_partkey) FROM part WHERE p_retailprice > 1900
Write SQL query to solve given problem: Among the products under the type "promo brushed steel", how many of them are manufactured by Manufacturer#5?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
SELECT COUNT(p_partkey) FROM part WHERE p_type = 'PROMO BRUSHED STEEL' AND p_mfgr = 'Manufacturer#5'
Write SQL query to solve given problem: Please list all the brands that contain a part under the type "promo brushed steel".. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
SELECT p_brand FROM part WHERE p_type = 'PROMO BRUSHED STEEL'
Write SQL query to solve given problem: What is the name of the product with the highest retail price?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
SELECT p_name FROM part WHERE p_retailprice = ( SELECT MAX(p_retailprice) FROM part )
Write SQL query to solve given problem: Which part has a bigger size, "pink powder drab lawn cyan" or "cornflower sky burlywood green beige"?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
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
Write SQL query to solve given problem: How many parts have a jumbo case container?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
SELECT COUNT(p_partkey) FROM part WHERE p_container = 'JUMBO CASE'
Write SQL query to solve given problem: What is the size of the smallest part in a jumbo case container?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
SELECT MIN(p_size) FROM part WHERE p_container = 'JUMBO CASE'
Write SQL query to solve given problem: How many suppliers have their accounts in debt?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
SELECT COUNT(s_suppkey) FROM supplier WHERE s_acctbal < 0
Write SQL query to solve given problem: Please list the names of the top 3 suppliers with the most amount of money in their accounts.. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
SELECT s_name FROM supplier ORDER BY s_acctbal DESC LIMIT 3
Write SQL query to solve given problem: Please list the phone numbers of all the suppliers in Germany.. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
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'
Write SQL query to solve given problem: Please list the names of all the suppliers for the part "hot spring dodger dim light".. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
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'
Write SQL query to solve given problem: What is the lowest supply cost for the part "hot spring dodger dim light"?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
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'
Write SQL query to solve given problem: What is the name of the supplier that provides the part "hot spring dodger dim light" with the lowest supply cost?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
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
Write SQL query to solve given problem: What is the total quantity available by all suppliers for the part "hot spring dodger dim light"?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
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'
Write SQL query to solve given problem: Which supplier can provide the most number of "hot spring dodger dim light"? Please give the supplier's phone number.. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
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
Write SQL query to solve given problem: Please list the names of all the suppliers for the part with the highest retail price.. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
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
Write SQL query to solve given problem: How many suppliers for the part "hot spring dodger dim light" are in Vietnam?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
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'
Write SQL query to solve given problem: Among the suppliers providing parts under the type "promo brushed steel", how many of them are in debt?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
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'
Write SQL query to solve given problem: Please list the names of all the suppliers for parts under Brand#55.. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
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'
Write SQL query to solve given problem: 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?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
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
Write SQL query to solve given problem: The part "hot spring dodger dim light" is ordered in how many orders?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
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'
Write SQL query to solve given problem: What is the total quantity of the part "hot spring dodger dim light" ordered in all orders?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
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'
Write SQL query to solve given problem: Please list the order keys of all the orders that have more than 2 parts with a jumbo case container.. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
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
Write SQL query to solve given problem: Among all the suppliers in debt, how many of them are in Europe?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
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
Write SQL query to solve given problem: Among all the suppliers providing the part "hot spring dodger dim light", how many of them are in Europe?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
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'
Write SQL query to solve given problem: Please list the phone numbers of all the suppliers for the parts ordered in order no.1.. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
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
Write SQL query to solve given problem: Among the suppliers for the parts ordered in order no.4, how many of them are in debt?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
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
Write SQL query to solve given problem: Among the parts that are returned, how many of them are provided by a supplier in debt?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
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
Write SQL query to solve given problem: On which date was the part "burnished seashell gainsboro navajo chocolate" in order no.1 shipped?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
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'
Write SQL query to solve given problem: What is the quantity of the part "burnished seashell gainsboro navajo chocolate" ordered in order no.1?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
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'
Write SQL query to solve given problem: Which part is ordered in a bigger amount in order no.1, "burnished seashell gainsboro navajo chocolate" or "salmon white grey tan navy"?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
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
Write SQL query to solve given problem: What is the biggest discount among all orders for the part "burnished seashell gainsboro navajo chocolate"?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
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'
Write SQL query to solve given problem: Please list all the modes of shipping for the part "burnished seashell gainsboro navajo chocolate".. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
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'
Write SQL query to solve given problem: What is the average supply cost for the part "hot spring dodger dim light"?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
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'
Write SQL query to solve given problem: How much higher in percentage is the highest supply cost of the part "hot spring dodger dim light" than the lowest supply cost?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
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'
Write SQL query to solve given problem: What is the profit for part no.98768 in order no.1?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
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
Write SQL query to solve given problem: What is the discounted price of the part "burnished seashell gainsboro navajo chocolate" in order no.1?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
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
Write SQL query to solve given problem: Which market segment does the customer with the highest amount of debt belongs to?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
SELECT c_mktsegment FROM customer WHERE c_acctbal = ( SELECT MIN(c_acctbal) FROM customer )
Write SQL query to solve given problem: In 1997, how many orders were shipped via mail?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
SELECT COUNT(l_orderkey) FROM lineitem WHERE STRFTIME('%Y', l_shipdate) = '1997' AND l_shipmode = 'MAIL'
Write SQL query to solve given problem: How many customers are in the furniture segment?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
SELECT COUNT(c_custkey) FROM customer WHERE c_mktsegment = 'FURNITURE'
Write SQL query to solve given problem: Among the items shipped in 1994 via truck, how many items were returned?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
SELECT COUNT(l_orderkey) FROM lineitem WHERE STRFTIME('%Y', l_shipdate) = '1994' AND l_returnflag = 'R' AND l_shipmode = 'TRUCK'
Write SQL query to solve given problem: How many customers in the machinery segment are in debt?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
SELECT COUNT(c_custkey) FROM customer WHERE c_acctbal < 0 AND c_mktsegment = 'MACHINERY'
Write SQL query to solve given problem: How many urgent orders did Clerk#000000001 handle in 1997?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
SELECT COUNT(o_orderkey) FROM orders WHERE STRFTIME('%Y', o_orderdate) = '1997' AND o_clerk = 'Clerk#000000001' AND o_orderpriority = '1-URGENT'
Write SQL query to solve given problem: What is the name of the customer whose order was delivered the longest?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
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 (JULIANDAY(T2.l_receiptdate) - JULIANDAY(T2.l_commitdate)) DESC LIMIT 1
Write SQL query to solve given problem: How much is the total price of all the orders shipped to customers in Argentina?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
SELECT SUM(T3.o_totalprice) FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey INNER JOIN orders AS T3 ON T1.c_custkey = T3.o_custkey WHERE T2.n_name = 'ARGENTINA'
Write SQL query to solve given problem: How many customers in the building segments have orders with a total price of no less than 50,000?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
SELECT COUNT(T2.c_name) FROM orders AS T1 INNER JOIN customer AS T2 ON T1.o_custkey = T2.c_custkey WHERE T2.c_mktsegment = 'BUILDING' AND T1.o_totalprice > 50000
Write SQL query to solve given problem: Which country has the least number of suppliers?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
SELECT T2.n_name FROM supplier AS T1 INNER JOIN nation AS T2 ON T1.s_nationkey = T2.n_nationkey GROUP BY T1.s_nationkey ORDER BY COUNT(T1.s_name) LIMIT 1
Write SQL query to solve given problem: How much is the part supply cost for the medium metallic grey dodger linen?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
SELECT T2.ps_supplycost FROM part AS T1 INNER JOIN partsupp AS T2 ON T1.p_partkey = T2.ps_partkey WHERE T1.p_name = 'medium metallic grey dodger linen'
Write SQL query to solve given problem: What are the top 2 countries with the highest number of indebted suppliers?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
SELECT T.n_name FROM ( SELECT T2.n_name, SUM(T1.s_acctbal) AS num FROM supplier AS T1 INNER JOIN nation AS T2 ON T1.s_nationkey = T2.n_nationkey WHERE T1.s_acctbal < 0 GROUP BY T1.s_nationkey ) AS T ORDER BY T.num LIMIT 2
Write SQL query to solve given problem: What are the names of the parts that have a part supply cost of at least 1,000?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
SELECT T1.p_name FROM part AS T1 INNER JOIN partsupp AS T2 ON T1.p_partkey = T2.ps_partkey WHERE T2.ps_supplycost > 1000
Write SQL query to solve given problem: What is the name of the country of the supplier with the highest debt?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
SELECT T2.n_name FROM supplier AS T1 INNER JOIN nation AS T2 ON T1.s_nationkey = T2.n_nationkey ORDER BY T1.s_suppkey DESC LIMIT 1
Write SQL query to solve given problem: Who is the clerk in charge of handling the item with the highest amount of extended price?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
SELECT T1.o_clerk FROM orders AS T1 INNER JOIN lineitem AS T2 ON T1.o_orderkey = T2.l_orderkey ORDER BY T2.l_extendedprice DESC LIMIT 1
Write SQL query to solve given problem: What are the total quantities of the items ordered by customer 101660 on 10/5/1995?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
SELECT SUM(T2.l_quantity) FROM orders AS T1 INNER JOIN lineitem AS T2 ON T1.o_orderkey = T2.l_orderkey WHERE T1.o_orderdate = '1995-10-05' AND T1.o_custkey = 101660
Write SQL query to solve given problem: What is the total amount of tax charged for the order placed by customer 88931 on 7/13/994?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
SELECT SUM(T2.l_extendedprice * (1 - T2.l_discount) * (1 + T2.l_tax)) FROM orders AS T1 INNER JOIN lineitem AS T2 ON T1.o_orderkey = T2.l_orderkey WHERE T1.o_custkey = 88931 AND T1.o_orderdate = '1994-07-13'
Write SQL query to solve given problem: What are the names of the parts that were ordered by customer 110942?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
SELECT T3.p_name FROM orders AS T1 INNER JOIN lineitem AS T2 ON T1.o_orderkey = T2.l_orderkey INNER JOIN part AS T3 ON T2.l_partkey = T3.p_partkey WHERE T1.o_custkey = 110942
Write SQL query to solve given problem: How much is the discounted price of every item that customer 111511 ordered in order 53159? List the names of the parts of every item.. Keep the solution inside sql tag ```sql [SQL-Query] ```
retails
SELECT T2.l_extendedprice * (1 - T2.l_discount), T3.p_name FROM orders AS T1 INNER JOIN lineitem AS T2 ON T1.o_orderkey = T2.l_orderkey INNER JOIN part AS T3 ON T2.l_partkey = T3.p_partkey WHERE T1.o_custkey = 111511 AND T1.o_orderkey = 53159
Write SQL query to solve given problem: What is the height of David Bornhammar in inches?. Keep the solution inside sql tag ```sql [SQL-Query] ```
ice_hockey_draft
SELECT T2.height_in_inch FROM PlayerInfo AS T1 INNER JOIN height_info AS T2 ON T1.height = T2.height_id WHERE T1.PlayerName = 'David Bornhammar'
Write SQL query to solve given problem: Please list the names of all the players with a height of over 6'2" inches.. Keep the solution inside sql tag ```sql [SQL-Query] ```
ice_hockey_draft
SELECT DISTINCT T1.PlayerName FROM PlayerInfo AS T1 INNER JOIN height_info AS T2 ON T1.height = T2.height_id WHERE T2.height_in_inch > '6''2"'
Write SQL query to solve given problem: Among the players with a height of over 6'2" inches, how many of them were born in Sweden?. Keep the solution inside sql tag ```sql [SQL-Query] ```
ice_hockey_draft
SELECT COUNT(T1.ELITEID) FROM PlayerInfo AS T1 INNER JOIN height_info AS T2 ON T1.height = T2.height_id WHERE T2.height_in_inch > '6''2"' AND T1.nation = 'Sweden'
Write SQL query to solve given problem: What is the name of the tallest player?. Keep the solution inside sql tag ```sql [SQL-Query] ```
ice_hockey_draft
SELECT T1.PlayerName FROM PlayerInfo AS T1 INNER JOIN height_info AS T2 ON T1.height = T2.height_id ORDER BY T2.height_in_cm DESC LIMIT 1
Write SQL query to solve given problem: How much does David Bornhammar weigh in kilograms?. Keep the solution inside sql tag ```sql [SQL-Query] ```
ice_hockey_draft
SELECT T2.weight_in_kg FROM PlayerInfo AS T1 INNER JOIN weight_info AS T2 ON T1.weight = T2.weight_id WHERE T1.PlayerName = 'David Bornhammar'
Write SQL query to solve given problem: How many players weigh more than 90 kg?. Keep the solution inside sql tag ```sql [SQL-Query] ```
ice_hockey_draft
SELECT COUNT(T1.ELITEID) FROM PlayerInfo AS T1 INNER JOIN weight_info AS T2 ON T1.weight = T2.weight_id WHERE T2.weight_in_kg > 90