Chinastark/bird_dataset huggingface dataset:
Database: retails
Note: nation refers to n_name; Europe refers to r_name = 'EUROPE';
Question: List all the nations in Europe.
SQL: SELECT nation.n_name FROM region INNER JOIN nation ON region.r_regionkey = nation.n_regionkey WHERE region.r_name = 'EUROPE'
Database: retails
Note: supply cost refers to ps_supplycost; part "violet olive rose ivory sandy" refers to p_name = 'violet olive rose ivory sandy';
Question: What is the supply cost for the part "violet olive rose ivory sandy"?
SQL: SELECT partsupp.ps_supplycost FROM part INNER JOIN partsupp ON part.p_partkey = partsupp.ps_partkey WHERE part.p_name = 'violet olive rose ivory sandy'
Database: retails
Note: phone number refers to c_phone; Ethiopia refers to n_name = 'Ethiopia';
Question: List all the customers' phone numbers from Ethiopia.
SQL: SELECT customer.c_phone FROM customer INNER JOIN nation ON customer.c_nationkey = nation.n_nationkey WHERE nation.n_name = 'Ethiopia'
Database: retails
Note: total price = sum(o_totalprice); phone number "627-220-3983" refers to c_phone = '627-220-3983';
Question: What is the total price of all orders from the customer with the phone number "627-220-3983"?
SQL: SELECT sum(orders.o_totalprice) FROM orders INNER JOIN customer ON orders.o_custkey = customer.c_custkey WHERE customer.c_phone = '627-220-3983'
Database: retails
Note: shipping method refers to l_shipmode; order on 12/31/1994 refers to o_orderdate = '1994-12-31';
Question: What are the shipping methods for the orders on 12/31/1994?
SQL: SELECT DISTINCT lineitem.l_shipmode FROM orders INNER JOIN lineitem ON orders.o_orderkey = lineitem.l_orderkey WHERE orders.o_orderdate = '1994-12-31'
Database: retails
Note: account balance refers to s_acctbal; the most parts refers to max(count(ps_suppkey));
Question: What is the account balance of the supplier with the most parts?
SQL: SELECT t.s_acctbal FROM ( SELECT supplier.s_acctbal, count(partsupp.ps_suppkey) AS num FROM supplier INNER JOIN partsupp ON supplier.s_suppkey = partsupp.ps_suppkey GROUP BY supplier.s_suppkey ) AS t ORDER BY t.num DESC LIMIT 1
Database: retails
Note: nation refers to n_name; account balance of "4393.04" refers to s_acctbal = 4393.04;
Question: Which nation does the supplier with the account balance of "4393.04" belong to?
SQL: SELECT nation.n_name FROM supplier INNER JOIN nation ON supplier.s_nationkey = nation.n_nationkey WHERE supplier.s_acctbal = 4393.04
Database: retails
Note: region refers to r_name; the most customers refers to max(count(c_custkey));
Question: What is the region with the most customers?
SQL: SELECT t.r_name FROM ( SELECT region.r_name, count(customer.c_custkey) AS num FROM nation INNER JOIN customer ON nation.n_nationkey = customer.c_nationkey INNER JOIN region ON nation.n_regionkey = region.r_regionkey GROUP BY region.r_name ) AS t ORDER BY t.num DESC LIMIT 1
Database: retails
Note: phone number refers to c_phone; a total price of more than $300,000 refers to o_totalprice > 300000;
Question: List the phone number of the customer who placed orders with a total price of more than $300,000.
SQL: SELECT customer.c_phone FROM orders INNER JOIN customer ON orders.o_custkey = customer.c_custkey WHERE orders.o_totalprice > 300000
Database: retails
Note: clerk refers to o_clerk; shipped by mail refers to l_shipmode = 'MAIL';
Question: What are the clerks of orders with line items shipped by mail?
SQL: SELECT orders.o_clerk FROM orders INNER JOIN lineitem ON orders.o_orderkey = lineitem.l_orderkey WHERE lineitem.l_shipmode = 'MAIL'
Database: retails
Note: nation refers to n_name; the lowest account balance refers to min(s_acctbal);
Question: What are the top 5 nations of suppliers with the lowest account balance?
SQL: SELECT nation.n_name FROM supplier INNER JOIN nation ON supplier.s_nationkey = nation.n_nationkey ORDER BY supplier.s_acctbal LIMIT 1
Database: retails
Note: addresses refers to s_address; the biggest part refers to max(p_size);
Question: List all the addresses for the suppliers of the biggest parts.
SQL: SELECT supplier.s_address FROM partsupp INNER JOIN supplier ON partsupp.ps_suppkey = supplier.s_suppkey INNER JOIN part ON partsupp.ps_partkey = part.p_partkey ORDER BY part.p_size DESC LIMIT 1
Database: retails
Note: 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)));
Question: Which part and supplier have the most profit?
SQL: SELECT part.p_name, supplier.s_name FROM partsupp INNER JOIN lineitem ON partsupp.ps_suppkey = lineitem.l_suppkey INNER JOIN part ON partsupp.ps_partkey = part.p_partkey INNER JOIN supplier ON partsupp.ps_suppkey = supplier.s_suppkey ORDER BY lineitem.l_extendedprice * (1 - lineitem.l_discount) - partsupp.ps_supplycost * lineitem.l_quantity DESC LIMIT 1
Database: retails
Note: Asia refers to r_name = 'ASIA'; proportion = divide(count(s_name where r_name = 'ASIA'), count(s_name)) * 100%;
Question: What proportion of suppliers are from Asia?
SQL: SELECT cast(sum(iif(region.r_name = 'ASIA', 1, 0)) AS REAL) * 100 / count(region.r_regionkey) FROM region INNER JOIN nation ON region.r_regionkey = nation.n_regionkey INNER JOIN supplier ON nation.n_nationkey = supplier.s_nationkey
Database: retails
Note: total price refers to o_totalprice; order key 32 refers to o_orderkey = 32;
Question: Please indicate the total price of order key 32.
SQL: SELECT o_totalprice FROM orders WHERE o_orderkey = 32
Database: retails
Note: order key refers to l_orderkey; not applied for the discount refers to l_discount = 0;
Question: How many order keys are not applied for the discount?
SQL: SELECT count(l_orderkey) FROM lineitem WHERE l_discount = 0
Database: retails
Note: line item refers to l_linenumber; shipped by truck refers to l_shipmode = 'truck'; delivery time before 1997 refers to year(l_shipdate) < 1997;
Question: List line items shipped by truck with delivery time before 1997.
SQL: SELECT l_linenumber FROM lineitem WHERE strftime('%Y', l_shipdate) < 1997 AND l_shipmode = 'truck'
Database: retails
Note: line item refers to l_linenumber; returned refers to returnflag = 'R'; in 1998 refers to year(l_shipdate) = 1998;
Question: How many line items were returned in 1998?
SQL: SELECT l_linenumber FROM lineitem WHERE strftime('%Y', l_shipdate) < 1997 AND l_shipmode = 'TRUCK'
Database: retails
Note: line item refers to l_linenumber; the highest quantity refers to max(l_quantity); shipped by air refers to l_shipmode = 'AIR';
Question: Which line item with the highest quantity is shipped by air?
SQL: SELECT l_linenumber FROM lineitem WHERE l_shipmode = 'AIR' ORDER BY l_quantity DESC LIMIT 1
Database: retails
Note: name of customer refers to c_name; account in debt refers to c_acctbal < 0;
Question: List the names of customers whose accounts are in debt.
SQL: SELECT c_name FROM customer WHERE c_acctbal < 0
Database: retails
Note: household segment refers to c_mktsegment = 'household'; Germany refers to n_name = 'Germany';
Question: How many customers belong to the household segment in Germany?
SQL: SELECT count(customer.c_name) FROM customer INNER JOIN nation ON customer.c_nationkey = nation.n_nationkey WHERE customer.c_mktsegment = 'HOUSEHOLD' AND nation.n_name = 'GERMANY'
Database: retails
Note: phone number refers to c_phone; order priority is urgent refers to o_orderpriority = '1-URGENT';
Question: List the phone numbers of customers whose order priority is urgent.
SQL: SELECT customer.c_phone FROM orders INNER JOIN customer ON orders.o_custkey = customer.c_custkey WHERE orders.o_orderpriority = '1-URGENT'
Database: retails
Note: customer name refers to c_name; the highest discount refers to max(l_discount);
Question: Name of customer whose order is applied with the highest discount.
SQL: SELECT customer.c_name FROM orders INNER JOIN lineitem ON orders.o_orderkey = lineitem.l_orderkey INNER JOIN customer ON orders.o_custkey = customer.c_custkey ORDER BY lineitem.l_discount DESC LIMIT 1
Database: retails
Note: order refers to o_orderkey; the highest total price refers to max(o_totalprice); delivery date refers to l_shipdate;
Question: List the 5 orders with the highest total price, indicating the delivery date.
SQL: SELECT orders.o_orderkey, lineitem.l_shipdate FROM orders INNER JOIN lineitem ON orders.o_orderkey = lineitem.l_orderkey ORDER BY orders.o_totalprice DESC LIMIT 5
Database: retails
Note: comment refers to o_comment; furniture segment refers to c_mktsegment = 'FURNITURE';
Question: List the comments describing orders from customers in the furniture segment.
SQL: SELECT orders.o_comment FROM orders INNER JOIN customer ON orders.o_custkey = customer.c_custkey WHERE customer.c_mktsegment = 'FURNITURE'
Database: retails
Note: customer name refers to c_name; a total price over $300000 refers to o_totalprice > 300000;
Question: Please indicate the names of the customers whose order with a total price over $300000.
SQL: SELECT customer.c_name FROM orders INNER JOIN customer ON orders.o_custkey = customer.c_custkey WHERE orders.o_totalprice > 300000
Database: retails
Note: customer name refers to c_name; India refers to n_name = 'INDIA'; account balance over $5000 refers to c_acctbal > 5000;
Question: Name customers in India with account balances over $5000.
SQL: SELECT customer.c_name FROM customer INNER JOIN nation ON customer.c_nationkey = nation.n_nationkey WHERE customer.c_acctbal > 5000 AND nation.n_name = 'INDIA'
Database: retails
Note: phone number refers to s_phone; Japan refers to n_name = 'JAPAN';
Question: List the phone numbers of suppliers from Japan.
SQL: SELECT supplier.s_phone FROM supplier INNER JOIN nation ON supplier.s_nationkey = nation.n_nationkey WHERE nation.n_name = 'JAPAN'
Database: retails
Note: Argentina refers to n_name = 'ARGENTINA'; supplier refers to s_name; an account in debt refers to s_acctbal < 0;
Question: Among the providers in Argentina, which supplier has an account that is in debt?
SQL: SELECT supplier.s_name FROM supplier INNER JOIN nation ON supplier.s_nationkey = nation.n_nationkey WHERE supplier.s_acctbal < 0 AND nation.n_name = 'ARGENTINA'
Database: retails
Note: the algeria region refers to r_name = 'ALGERIA';
Question: How many countries belong to the Algeria region?
SQL: SELECT count(region.r_name) FROM region INNER JOIN nation ON region.r_regionkey = nation.n_regionkey WHERE nation.n_name = 'ALGERIA'
Database: retails
Note: 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';
Question: Please indicate the names of customers whose orders are eligible for 10% discount with order dates between 1/1/1994 and 1/1/1995.
SQL: SELECT customer.c_name FROM orders INNER JOIN lineitem ON orders.o_orderkey = lineitem.l_orderkey INNER JOIN customer ON orders.o_custkey = customer.c_custkey WHERE lineitem.l_discount = 0.1 AND strftime('%Y', orders.o_orderdate) BETWEEN 1994 AND 1995
Database: retails
Note: the American region refers to r_name = 'America'; percentage = divide(count(n_name where r_name = 'America'), count(n_name)) * 100%;
Question: Calculate the percentage of countries that belong to the American region.
SQL: SELECT cast(sum(iif(region.r_name = 'America', 1, 0)) AS REAL) * 100 / count(nation.n_name) FROM region INNER JOIN nation ON region.r_regionkey = nation.n_regionkey
Database: retails
Note: 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%;
Question: Calculate percentage of household segment in Indonesia.
SQL: SELECT cast(sum(iif(customer.c_mktsegment = 'HOUSEHOLD', 1, 0)) AS REAL) * 100 / count(customer.c_mktsegment) FROM customer INNER JOIN nation ON customer.c_nationkey = nation.n_nationkey WHERE nation.n_name = 'INDONESIA'
Database: retails
Note: product name refers to p_name; type "promo brushed steel" refers to p_type = 'PROMO BRUSHED STEEL';
Question: Please list the names of all the products under the type "promo brushed steel".
SQL: SELECT p_name FROM part WHERE p_type = 'PROMO BRUSHED STEEL'
Database: retails
Note: comment refers to p_comment; product "burlywood plum powder puff mint" refers to p_name = 'burlywood plum powder puff mint';
Question: What is the comment of the product "burlywood plum powder puff mint"?
SQL: SELECT p_comment FROM part WHERE p_name = 'burlywood plum powder puff mint'
Database: retails
Note: a retail price of over 1900 refers to p_retailprice > 1900;
Question: How many parts have a retail price of over 1900?
SQL: SELECT count(p_partkey) FROM part WHERE p_retailprice > 1900
Database: retails
Note: type "promo brushed steel" refers to p_type = 'PROMO BRUSHED STEEL'; Manufacturer#5 refers to p_mfgr = 'Manufacturer#5';
Question: Among the products under the type "promo brushed steel", how many of them are manufactured by Manufacturer#5?
SQL: SELECT count(p_partkey) FROM part WHERE p_type = 'PROMO BRUSHED STEEL' AND p_mfgr = 'Manufacturer#5'
Database: retails
Note: brand refers to p_brand; type "promo brushed steel" refers to p_type = 'PROMO BRUSHED STEEL';
Question: Please list all the brands that contain a part under the type "promo brushed steel".
SQL: SELECT p_brand FROM part WHERE p_type = 'PROMO BRUSHED STEEL'
Database: retails
Note: name of the product refers to p_name; the highest retail price refers to p_retailprice;
Question: What is the name of the product with the highest retail price?
SQL: SELECT p_name FROM part WHERE p_retailprice = ( SELECT max(p_retailprice) FROM part )
Database: retails
Note: 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');
Question: Which part has a bigger size, "pink powder drab lawn cyan" or "cornflower sky burlywood green beige"?
SQL: 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
Database: retails
Note: jumbo case container refers to p_container = 'JUMBO CASE';
Question: How many parts have a jumbo case container?
SQL: SELECT count(p_partkey) FROM part WHERE p_container = 'JUMBO CASE'
Database: retails
Note: size refers to p_size; the smallest part refers to min(p_size); jumbo case container refers to p_container = 'JUMBO CASE';
Question: What is the size of the smallest part in a jumbo case container?
SQL: SELECT min(p_size) FROM part WHERE p_container = 'JUMBO CASE'
Database: retails
Note: account in debt refers to s_acctbal < 0;
Question: How many suppliers have their accounts in debt?
SQL: SELECT count(s_suppkey) FROM supplier WHERE s_acctbal < 0
Database: retails
Note: supplier name refers to s_name; the most amount of money refers to max(s_acctbal);
Question: Please list the names of the top 3 suppliers with the most amount of money in their accounts.
SQL: SELECT s_name FROM supplier ORDER BY s_acctbal DESC LIMIT 3
Database: retails
Note: phone number refers to s_phone; Germany refers to n_name = 'Germany';
Question: Please list the phone numbers of all the suppliers in Germany.
SQL: SELECT supplier.s_phone FROM supplier INNER JOIN nation ON supplier.s_nationkey = nation.n_nationkey WHERE nation.n_name = 'Germany'
Database: retails
Note: supplier name refers to s_name; part "hot spring dodger dim light" refers to p_name = 'hot spring dodger dim light';
Question: Please list the names of all the suppliers for the part "hot spring dodger dim light".
SQL: SELECT supplier.s_name FROM partsupp INNER JOIN supplier ON partsupp.ps_suppkey = supplier.s_suppkey INNER JOIN part ON partsupp.ps_partkey = part.p_partkey WHERE part.p_name = 'hot spring dodger dim light'
Database: retails
Note: the lowest supply cost refers to min(ps_supplycost); part "hot spring dodger dim light" refers to p_name = 'hot spring dodger dim light';
Question: What is the lowest supply cost for the part "hot spring dodger dim light"?
SQL: SELECT min(partsupp.ps_supplycost) FROM partsupp INNER JOIN part ON partsupp.ps_partkey = part.p_partkey WHERE part.p_name = 'hot spring dodger dim light'
Database: retails
Note: 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);
Question: What is the name of the supplier that provides the part "hot spring dodger dim light" with the lowest supply cost?
SQL: SELECT supplier.s_name FROM partsupp INNER JOIN supplier ON partsupp.ps_suppkey = supplier.s_suppkey INNER JOIN part ON partsupp.ps_partkey = part.p_partkey WHERE part.p_name = 'hot spring dodger dim light' ORDER BY partsupp.ps_supplycost LIMIT 1
Database: retails
Note: total quantity available refers to sum(ps_availqty); part "hot spring dodger dim light" refers to p_name = 'hot spring dodger dim light';
Question: What is the total quantity available by all suppliers for the part "hot spring dodger dim light"?
SQL: SELECT sum(partsupp.ps_availqty) FROM partsupp INNER JOIN part ON partsupp.ps_partkey = part.p_partkey WHERE part.p_name = 'hot spring dodger dim light'
Database: retails
Note: 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;
Question: Which supplier can provide the most number of "hot spring dodger dim light"? Please give the supplier's phone number.
SQL: SELECT supplier.s_phone FROM part INNER JOIN partsupp ON part.p_partkey = partsupp.ps_partkey INNER JOIN supplier ON partsupp.ps_suppkey = supplier.s_suppkey WHERE part.p_name = 'hot spring dodger dim light' ORDER BY partsupp.ps_availqty DESC LIMIT 1
Database: retails
Note: supplier name refers to s_name; the highest retail price refers to max(p_retailprice);
Question: Please list the names of all the suppliers for the part with the highest retail price.
SQL: SELECT supplier.s_phone FROM part INNER JOIN partsupp ON part.p_partkey = partsupp.ps_partkey INNER JOIN supplier ON partsupp.ps_suppkey = supplier.s_suppkey WHERE part.p_name = 'hot spring dodger dim light' ORDER BY part.p_size DESC LIMIT 1
Database: retails
Note: part "hot spring dodger dim light" refers to p_name = 'hot spring dodger dim light'; Vietnam refers to n_name = 'VIETNAM';
Question: How many suppliers for the part "hot spring dodger dim light" are in Vietnam?
SQL: SELECT count(supplier.s_name) FROM part INNER JOIN partsupp ON part.p_partkey = partsupp.ps_partkey INNER JOIN supplier ON partsupp.ps_suppkey = supplier.s_suppkey INNER JOIN nation ON supplier.s_nationkey = nation.n_nationkey WHERE part.p_name = 'hot spring dodger dim light' AND nation.n_name = 'VIETNAM'
Database: retails
Note: type "promo brushed steel" refers to p_type = 'PROMO BRUSHED STEEL'; in debt refers to s_acctbal < 0;
Question: Among the suppliers providing parts under the type "promo brushed steel", how many of them are in debt?
SQL: SELECT count(supplier.s_name) FROM part INNER JOIN partsupp ON part.p_partkey = partsupp.ps_partkey INNER JOIN supplier ON partsupp.ps_suppkey = supplier.s_suppkey WHERE supplier.s_acctbal < 0 AND part.p_type = 'PROMO BRUSHED STEEL'
Database: retails
Note: supplier name refers to s_name; Brand#55 refers to p_brand = 'Brand#55';
Question: Please list the names of all the suppliers for parts under Brand#55.
SQL: SELECT supplier.s_name FROM part INNER JOIN partsupp ON part.p_partkey = partsupp.ps_partkey INNER JOIN supplier ON partsupp.ps_suppkey = supplier.s_suppkey WHERE part.p_brand = 'Brand#55'
Database: retails
Note: type "promo brushed steel" refers to p_type = 'PROMO BRUSHED STEEL'; a total available quantity of under 5000 refers to sum(ps_availqty) < 5000;
Question: 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?
SQL: SELECT sum(num) FROM ( SELECT count(supplier.s_name) AS num FROM part INNER JOIN partsupp ON part.p_partkey = partsupp.ps_partkey INNER JOIN supplier ON partsupp.ps_suppkey = supplier.s_suppkey WHERE part.p_type = 'PROMO BRUSHED STEEL' GROUP BY partsupp.ps_partkey HAVING sum(partsupp.ps_availqty) < 5000 ) t
Database: retails
Note: part "hot spring dodger dim light" refers to p_name = 'hot spring dodger dim light';
Question: The part "hot spring dodger dim light" is ordered in how many orders?
SQL: SELECT count(part.p_partkey) FROM part INNER JOIN lineitem ON part.p_partkey = lineitem.l_partkey WHERE part.p_name = 'hot spring dodger dim light'
Database: retails
Note: total quantity refers to sum(l_quantity); part "hot spring dodger dim light" refers to p_name = 'hot spring dodger dim light';
Question: What is the total quantity of the part "hot spring dodger dim light" ordered in all orders?
SQL: SELECT sum(part.p_partkey) FROM part INNER JOIN lineitem ON part.p_partkey = lineitem.l_partkey WHERE part.p_name = 'hot spring dodger dim light'
Database: retails
Note: 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;
Question: Please list the order keys of all the orders that have more than 2 parts with a jumbo case container.
SQL: SELECT t.l_orderkey FROM ( SELECT lineitem.l_orderkey, count(lineitem.l_partkey) AS num FROM part INNER JOIN lineitem ON part.p_partkey = lineitem.l_partkey WHERE part.p_container = 'JUMBO CASE' GROUP BY lineitem.l_orderkey ) AS t WHERE t.num > 2
Database: retails
Note: in debt refers to s_acctbal < 0; Europe refers to r_name = 'EUROPE';
Question: Among all the suppliers in debt, how many of them are in Europe?
SQL: SELECT count(nation.n_nationkey) FROM nation INNER JOIN region ON nation.n_regionkey = region.r_regionkey INNER JOIN supplier ON nation.n_nationkey = supplier.s_nationkey WHERE region.r_name = 'EUROPE' AND supplier.s_acctbal < 0
Database: retails
Note: part "hot spring dodger dim light" refers to p_name = hot spring dodger dim light; Europe refers to r_name = 'EUROPE';
Question: Among all the suppliers providing the part "hot spring dodger dim light", how many of them are in Europe?
SQL: SELECT count(region.r_regionkey) FROM region INNER JOIN nation ON region.r_regionkey = nation.n_regionkey INNER JOIN supplier ON nation.n_nationkey = supplier.s_nationkey WHERE region.r_name = 'EUROPE'
Database: retails
Note: phone number refers to s_phone; order no.1 refers to l_orderkey = 1;
Question: Please list the phone numbers of all the suppliers for the parts ordered in order no.1.
SQL: SELECT supplier.s_phone FROM lineitem INNER JOIN supplier ON lineitem.l_suppkey = supplier.s_suppkey WHERE lineitem.l_orderkey = 1
Database: retails
Note: order no.4 refers to l_orderkey = 4; in debt refers to s_acctbal < 0;
Question: Among the suppliers for the parts ordered in order no.4, how many of them are in debt?
SQL: SELECT count(lineitem.l_linenumber) FROM lineitem INNER JOIN supplier ON lineitem.l_suppkey = supplier.s_suppkey WHERE lineitem.l_orderkey = 4 AND supplier.s_acctbal < 0
Database: retails
Note: returned refers to l_returnflag = 'R'; in debt refers to s_acctbal < 0;
Question: Among the parts that are returned, how many of them are provided by a supplier in debt?
SQL: SELECT count(lineitem.l_partkey) FROM lineitem INNER JOIN supplier ON lineitem.l_suppkey = supplier.s_suppkey WHERE lineitem.l_returnflag = 'R' AND supplier.s_acctbal < 0
Database: retails
Note: 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;
Question: On which date was the part "burnished seashell gainsboro navajo chocolate" in order no.1 shipped?
SQL: SELECT lineitem.l_shipdate FROM lineitem INNER JOIN part ON lineitem.l_partkey = part.p_partkey WHERE lineitem.l_orderkey = 1 AND part.p_name = 'burnished seashell gainsboro navajo chocolate'