context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
List all the customers' phone numbers from 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'
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
What is the total price of all orders from the customer with the phone number "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'
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
What are the shipping methods for the orders on 12/31/1994?
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'
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
What is the account balance of the supplier with the most parts?
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
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
Which nation does the supplier with the account balance of "4393.04" belong to?
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
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
What is the region with the most customers?
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
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
List the phone number of the customer who placed orders with a total price of more than $300,000.
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
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
What are the clerks of orders with line items shipped by 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'
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
What are the top 5 nations of suppliers with the lowest account balance?
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
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
List all the addresses for the suppliers of the biggest parts.
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
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
Which part and supplier have the most profit?
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
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
What proportion of suppliers are from Asia?
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
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
Please indicate the total price of order key 32.
SELECT o_totalprice FROM orders WHERE o_orderkey = 32
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
How many order keys are not applied for the discount?
SELECT COUNT(l_orderkey) FROM lineitem WHERE l_discount = 0
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
List line items shipped by truck with delivery time before 1997.
SELECT l_linenumber FROM lineitem WHERE STRFTIME('%Y', l_shipdate) < 1997 AND l_shipmode = 'truck'
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
How many line items were returned in 1998?
SELECT l_linenumber FROM lineitem WHERE STRFTIME('%Y', l_shipdate) < 1997 AND l_shipmode = 'TRUCK'
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
Which line item with the highest quantity is shipped by air?
SELECT l_linenumber FROM lineitem WHERE l_shipmode = 'AIR' ORDER BY l_quantity DESC LIMIT 1
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
List the names of customers whose accounts are in debt.
SELECT c_name FROM customer WHERE c_acctbal < 0
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
How many customers belong to the household segment in 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'
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
List the phone numbers of customers whose order priority is 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'
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
Name of customer whose order is applied with the highest 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
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
List the 5 orders with the highest total price, indicating the delivery date.
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
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
List the comments describing orders from customers in the furniture segment.
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'
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
Please indicate the names of the customers whose order with a total price over $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
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
Name customers in India with account balances over $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'
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
List the phone numbers of suppliers from 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'
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
Among the providers in Argentina, which supplier has an account that is in debt?
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'
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
How many countries belong to the Algeria region?
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'
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
Please indicate the names of customers whose orders are eligible for 10% discount with order dates between 1/1/1994 and 1/1/1995.
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
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
Calculate the percentage of countries that belong to the American region.
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
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
Calculate percentage of household segment in Indonesia.
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'
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
Please list the names of all the products under the type "promo brushed steel".
SELECT p_name FROM part WHERE p_type = 'PROMO BRUSHED STEEL'
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
What is the comment of the product "burlywood plum powder puff mint"?
SELECT p_comment FROM part WHERE p_name = 'burlywood plum powder puff mint'
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
How many parts have a retail price of over 1900?
SELECT COUNT(p_partkey) FROM part WHERE p_retailprice > 1900
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
Among the products under the type "promo brushed steel", how many of them are manufactured by Manufacturer#5?
SELECT COUNT(p_partkey) FROM part WHERE p_type = 'PROMO BRUSHED STEEL' AND p_mfgr = 'Manufacturer#5'
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
Please list all the brands that contain a part under the type "promo brushed steel".
SELECT p_brand FROM part WHERE p_type = 'PROMO BRUSHED STEEL'
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
What is the name of the product with the highest retail price?
SELECT p_name FROM part WHERE p_retailprice = ( SELECT MAX(p_retailprice) FROM part )
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
Which part has a bigger size, "pink powder drab lawn cyan" or "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
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
How many parts have a jumbo case container?
SELECT COUNT(p_partkey) FROM part WHERE p_container = 'JUMBO CASE'
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
What is the size of the smallest part in a jumbo case container?
SELECT MIN(p_size) FROM part WHERE p_container = 'JUMBO CASE'
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
How many suppliers have their accounts in debt?
SELECT COUNT(s_suppkey) FROM supplier WHERE s_acctbal < 0
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
Please list the names of the top 3 suppliers with the most amount of money in their accounts.
SELECT s_name FROM supplier ORDER BY s_acctbal DESC LIMIT 3
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
Please list the phone numbers of all the suppliers in 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'
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
Please list the names of all the suppliers for the part "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'
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
What is the lowest supply cost for the part "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'
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
What is the name of the supplier that provides the part "hot spring dodger dim light" with the lowest supply cost?
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
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
What is the total quantity available by all suppliers for the part "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'
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
Which supplier can provide the most number of "hot spring dodger dim light"? Please give the supplier's phone number.
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
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
Please list the names of all the suppliers for the part with the highest retail price.
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
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
How many suppliers for the part "hot spring dodger dim light" are in 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'
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
Among the suppliers providing parts under the type "promo brushed steel", how many of them are in debt?
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'
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
Please list the names of all the suppliers for parts under 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'
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
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?
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
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
The part "hot spring dodger dim light" is ordered in how many orders?
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'
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
What is the total quantity of the part "hot spring dodger dim light" ordered in all orders?
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'
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
Please list the order keys of all the orders that have more than 2 parts with a jumbo case container.
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
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
Among all the suppliers in debt, how many of them are in 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
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
Among all the suppliers providing the part "hot spring dodger dim light", how many of them are in 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'
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
Please list the phone numbers of all the suppliers for the parts ordered in order no.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
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
Among the suppliers for the parts ordered in order no.4, how many of them are in debt?
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
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
Among the parts that are returned, how many of them are provided by a supplier in debt?
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
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
On which date was the part "burnished seashell gainsboro navajo chocolate" in order no.1 shipped?
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'
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
What is the quantity of the part "burnished seashell gainsboro navajo chocolate" ordered in order no.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'
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
Which part is ordered in a bigger amount in order no.1, "burnished seashell gainsboro navajo chocolate" or "salmon white grey tan navy"?
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
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
What is the biggest discount among all orders for the part "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'
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
Please list all the modes of shipping for the part "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'
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
What is the average supply cost for the part "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'
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
How much higher in percentage is the highest supply cost of the part "hot spring dodger dim light" than the lowest supply cost?
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'
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
What is the profit for part no.98768 in order no.1?
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
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
What is the discounted price of the part "burnished seashell gainsboro navajo chocolate" in order no.1?
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
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
Which market segment does the customer with the highest amount of debt belongs to?
SELECT c_mktsegment FROM customer WHERE c_acctbal = ( SELECT MIN(c_acctbal) FROM customer )
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
In 1997, how many orders were shipped via mail?
SELECT COUNT(l_orderkey) FROM lineitem WHERE STRFTIME('%Y', l_shipdate) = '1997' AND l_shipmode = 'MAIL'
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
How many customers are in the furniture segment?
SELECT COUNT(c_custkey) FROM customer WHERE c_mktsegment = 'FURNITURE'
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
Among the items shipped in 1994 via truck, how many items were returned?
SELECT COUNT(l_orderkey) FROM lineitem WHERE STRFTIME('%Y', l_shipdate) = '1994' AND l_returnflag = 'R' AND l_shipmode = 'TRUCK'
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
How many customers in the machinery segment are in debt?
SELECT COUNT(c_custkey) FROM customer WHERE c_acctbal < 0 AND c_mktsegment = 'MACHINERY'
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
How many urgent orders did Clerk#000000001 handle in 1997?
SELECT COUNT(o_orderkey) FROM orders WHERE STRFTIME('%Y', o_orderdate) = '1997' AND o_clerk = 'Clerk#000000001' AND o_orderpriority = '1-URGENT'
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
What is the name of the customer whose order was delivered the longest?
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
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
How much is the total price of all the orders shipped to customers in Argentina?
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'
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
How many customers in the building segments have orders with a total price of no less than 50,000?
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
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
Which country has the least number of suppliers?
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
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
How much is the part supply cost for the medium metallic grey dodger linen?
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'
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
What are the top 2 countries with the highest number of indebted suppliers?
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
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
What are the names of the parts that have a part supply cost of at least 1,000?
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
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
What is the name of the country of the supplier with the highest debt?
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
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
Who is the clerk in charge of handling the item with the highest amount of extended price?
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
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
What are the total quantities of the items ordered by customer 101660 on 10/5/1995?
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
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
What is the total amount of tax charged for the order placed by customer 88931 on 7/13/994?
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'
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
What are the names of the parts that were ordered by customer 110942?
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
bird
CREATE TABLE retails (c_custkey integer, c_mktsegment text, c_nationkey integer, c_name text, c_address text, c_phone text, c_acctbal real, c_comment text, l_shipdate date, l_orderkey integer, l_discount real, l_extendedprice real, l_suppkey integer, l_quantity integer, l_returnflag text, l_partkey integer, l_linestatu...
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.
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
bird
CREATE TABLE ice_hockey_draft (height_id integer, height_in_cm integer, height_in_inch text, weight_id integer, weight_in_kg integer, weight_in_lbs integer, ELITEID integer, PlayerName text, birthdate text, birthyear date, birthmonth integer, birthday integer, birthplace text, nation text, height integer, weight intege...
What is the height of David Bornhammar in inches?
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'
bird
CREATE TABLE ice_hockey_draft (height_id integer, height_in_cm integer, height_in_inch text, weight_id integer, weight_in_kg integer, weight_in_lbs integer, ELITEID integer, PlayerName text, birthdate text, birthyear date, birthmonth integer, birthday integer, birthplace text, nation text, height integer, weight intege...
Please list the names of all the players with a height of over 6'2" inches.
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"'
bird
CREATE TABLE ice_hockey_draft (height_id integer, height_in_cm integer, height_in_inch text, weight_id integer, weight_in_kg integer, weight_in_lbs integer, ELITEID integer, PlayerName text, birthdate text, birthyear date, birthmonth integer, birthday integer, birthplace text, nation text, height integer, weight intege...
Among the players with a height of over 6'2" inches, how many of them were born in Sweden?
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'
bird
CREATE TABLE ice_hockey_draft (height_id integer, height_in_cm integer, height_in_inch text, weight_id integer, weight_in_kg integer, weight_in_lbs integer, ELITEID integer, PlayerName text, birthdate text, birthyear date, birthmonth integer, birthday integer, birthplace text, nation text, height integer, weight intege...
What is the name of the tallest player?
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
bird
CREATE TABLE ice_hockey_draft (height_id integer, height_in_cm integer, height_in_inch text, weight_id integer, weight_in_kg integer, weight_in_lbs integer, ELITEID integer, PlayerName text, birthdate text, birthyear date, birthmonth integer, birthday integer, birthplace text, nation text, height integer, weight intege...
How much does David Bornhammar weigh in kilograms?
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'
bird
CREATE TABLE ice_hockey_draft (height_id integer, height_in_cm integer, height_in_inch text, weight_id integer, weight_in_kg integer, weight_in_lbs integer, ELITEID integer, PlayerName text, birthdate text, birthyear date, birthmonth integer, birthday integer, birthplace text, nation text, height integer, weight intege...
How many players weigh more than 90 kg?
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
bird
CREATE TABLE ice_hockey_draft (height_id integer, height_in_cm integer, height_in_inch text, weight_id integer, weight_in_kg integer, weight_in_lbs integer, ELITEID integer, PlayerName text, birthdate text, birthyear date, birthmonth integer, birthday integer, birthplace text, nation text, height integer, weight intege...
Among the players that weigh more than 90 kg, how many of them have a position of defense?
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 AND T1.position_info = 'D'
bird
CREATE TABLE ice_hockey_draft (height_id integer, height_in_cm integer, height_in_inch text, weight_id integer, weight_in_kg integer, weight_in_lbs integer, ELITEID integer, PlayerName text, birthdate text, birthyear date, birthmonth integer, birthday integer, birthplace text, nation text, height integer, weight intege...
Among the players that weigh more than 90 kg, what is the name of the player that has the most attendance in the player's first 7 years of NHL career?
SELECT T1.PlayerName FROM PlayerInfo AS T1 INNER JOIN weight_info AS T2 ON T1.weight = T2.weight_id WHERE T2.weight_in_kg > 90 AND T1.sum_7yr_GP = ( SELECT MAX(T1.sum_7yr_GP) FROM PlayerInfo AS T1 INNER JOIN weight_info AS T2 ON T1.weight = T2.weight_id WHERE T2.weight_in_kg > 90 )
bird
CREATE TABLE ice_hockey_draft (height_id integer, height_in_cm integer, height_in_inch text, weight_id integer, weight_in_kg integer, weight_in_lbs integer, ELITEID integer, PlayerName text, birthdate text, birthyear date, birthmonth integer, birthday integer, birthplace text, nation text, height integer, weight intege...
What is the weight of the player with the longest time on ice in the player’s first 7 years of NHL career in kilograms?
SELECT T2.weight_in_kg FROM PlayerInfo AS T1 INNER JOIN weight_info AS T2 ON T1.weight = T2.weight_id WHERE T1.sum_7yr_TOI = ( SELECT MAX(t.sum_7yr_TOI) FROM PlayerInfo t )
bird
CREATE TABLE ice_hockey_draft (height_id integer, height_in_cm integer, height_in_inch text, weight_id integer, weight_in_kg integer, weight_in_lbs integer, ELITEID integer, PlayerName text, birthdate text, birthyear date, birthmonth integer, birthday integer, birthplace text, nation text, height integer, weight intege...
How much taller is David Bornhammar than Pauli Levokari in centimeters?
SELECT ( SELECT T2.height_in_cm FROM PlayerInfo AS T1 INNER JOIN height_info AS T2 ON T1.height = T2.height_id WHERE T1.PlayerName = 'David Bornhammar' ) - ( SELECT T2.height_in_cm FROM PlayerInfo AS T1 INNER JOIN height_info AS T2 ON T1.height = T2.height_id WHERE T1.PlayerName = 'Pauli Levokari' )
bird
CREATE TABLE ice_hockey_draft (height_id integer, height_in_cm integer, height_in_inch text, weight_id integer, weight_in_kg integer, weight_in_lbs integer, ELITEID integer, PlayerName text, birthdate text, birthyear date, birthmonth integer, birthday integer, birthplace text, nation text, height integer, weight intege...
Among all the players that are right-shooted, how many of them weigh over 90 kg?
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 AND T1.shoots = 'R'
bird