id
int64
0
9.43k
db_id
stringclasses
69 values
schema
stringclasses
69 values
question
stringlengths
24
325
output
stringlengths
23
804
evidence
stringlengths
0
673
filtered_schema
listlengths
0
16
6,700
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
Calculates the profit processed by Supplier No. 7414 on order No. 817154.
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_suppkey = 7414 AND T1.l_orderkey = 817154
SUBTRACT(MULTIPLY(l_extendedprice, (SUBTRACT(1, l_discount)), MULTIPLY(ps_supplycost, l_quantity))) WHERE l_suppkey = 7414 AND l_orderkey = 817154;
[ "lineitem.l_discount", "lineitem.l_extendedprice", "lineitem.l_orderkey", "lineitem.l_quantity", "lineitem.l_suppkey", "partsupp.ps_suppkey", "partsupp.ps_supplycost" ]
6,701
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
Which country has the most number of suppliers whose account is in debt?
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 T2.n_name ) AS T ORDER BY T.num LIMIT 1
country refers to n_name; the most number of suppliers whose account is in debt refers to MAX(SUM(s_acctbal < 0));
[ "T.n_name", "T.num", "nation.n_name", "nation.n_nationkey", "supplier.s_acctbal", "supplier.s_nationkey" ]
6,702
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
What is the percentage of the European countries among the given countries?
SELECT CAST(SUM(IIF(T2.r_name = 'EUROPE', 1, 0)) AS REAL) * 100 / COUNT(T1.n_name) FROM nation AS T1 INNER JOIN region AS T2 ON T1.n_regionkey = T2.r_regionkey
DIVIDE(COUNT(n_name where r_name = 'EUROPE'), COUNT(n_name)) as percentage;
[ "nation.n_name", "nation.n_regionkey", "region.r_name", "region.r_regionkey" ]
6,703
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
Give the percentage of Japanese suppliers whose account is in debt.
SELECT CAST(SUM(IIF(T2.n_name = 'JAPAN', 1, 0)) AS REAL) * 100 / COUNT(T1.s_name) FROM supplier AS T1 INNER JOIN nation AS T2 ON T1.s_nationkey = T2.n_nationkey WHERE T1.s_acctbal < 0
account is in debt if s_acctbal < 0; DIVIDE(COUNT(s_acctbal < 0 where n_name = 'JAPAN'), COUNT(s_name where n_name = 'JAPAN')) as percentage;
[ "nation.n_name", "nation.n_nationkey", "supplier.s_acctbal", "supplier.s_name", "supplier.s_nationkey" ]
6,704
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
What is the name of the customer with the highest amount of debt?
SELECT c_name FROM customer WHERE c_acctbal = ( SELECT MIN(c_acctbal) FROM customer )
customer with the highest amount of debt refers to c_name where MIN(c_acctbal);
[ "customer.c_acctbal", "customer.c_name" ]
6,705
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
How many orders were shipped in 1998?
SELECT COUNT(l_orderkey) FROM lineitem WHERE STRFTIME('%Y', l_shipdate) = '1998'
orders refer to l_orderkey; shipped in 1998 refers to year(l_shipdate) = 1998;
[ "lineitem.l_orderkey", "lineitem.l_shipdate" ]
6,706
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
How many customers are in debt?
SELECT COUNT(c_custkey) FROM customer WHERE c_acctbal < 0
customers are in debt refer to c_custkey where c_acctbal < 0;
[ "customer.c_acctbal", "customer.c_custkey" ]
6,707
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
How many items that were shipped via air were returned in 1994?
SELECT COUNT(l_linenumber) FROM lineitem WHERE l_returnflag = 'R' AND l_shipmode = 'AIR' AND STRFTIME('%Y', l_shipdate) = '1994'
items refer to l_linenumber; shipped via air in 1994 refers to year(l_shipdate) = 1994 where l_shipmode = 'AIR'; returned refer to l_returnflag = 'R';
[ "lineitem.l_linenumber", "lineitem.l_returnflag", "lineitem.l_shipdate", "lineitem.l_shipmode" ]
6,708
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
How many customers are in the automobile market segment?
SELECT COUNT(c_custkey) FROM customer WHERE c_mktsegment = 'AUTOMOBILE'
automobile market segment refers to c_mktsegment = 'AUTOMOBILE';
[ "customer.c_custkey", "customer.c_mktsegment" ]
6,709
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
What are the top 2 order keys of the item with the highest amount of extended price?
SELECT l_orderkey FROM lineitem ORDER BY l_extendedprice DESC LIMIT 2
the highest amount of extended price refers to MAX(l_extendedprice);
[ "lineitem.l_extendedprice", "lineitem.l_orderkey" ]
6,710
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
When was the order with the highest amount of total price shipped?
SELECT 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 1
when shipped refers to l_shipdate; the highest amount of total price refers to MAX(o_totalprice);
[ "lineitem.l_orderkey", "lineitem.l_shipdate", "orders.o_orderkey", "orders.o_totalprice" ]
6,711
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
In which country do most of the customers come from?
SELECT T.n_name FROM ( SELECT T2.n_name, COUNT(T1.c_custkey) AS num FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey GROUP BY T2.n_name ) AS T ORDER BY T.num DESC LIMIT 1
country refers to n_name; most of the customers refer to MAX(COUNT(c_custkey));
[ "T.n_name", "T.num", "customer.c_custkey", "customer.c_nationkey", "nation.n_name", "nation.n_nationkey" ]
6,712
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
How many urgent orders were shipped the next day?
SELECT COUNT(T2.o_orderkey) FROM lineitem AS T1 INNER JOIN orders AS T2 ON T2.o_orderkey = T1.l_orderkey WHERE JULIANDAY(T1.l_shipdate) - JULIANDAY(T2.o_orderdate) = 1 AND T2.o_orderpriority = '1-URGENT'
the order is urgent if o_orderpriority = '1-URGENT'; shipped the next day refers to SUBTRACT(l_shipdate, o_orderdate) = 1;
[ "lineitem.l_orderkey", "lineitem.l_shipdate", "orders.o_orderdate", "orders.o_orderkey", "orders.o_orderpriority" ]
6,713
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
How many in debt customers in the household market segment are from Russia?
SELECT COUNT(T1.c_custkey) FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey WHERE T1.c_acctbal < 0 AND T1.c_mktsegment = 'HOUSEHOLD' AND T2.n_name = 'RUSSIA'
in debt customers refer to c_custkey where c_acctbal < 0; c_mktsegment = 'HOUSEHOLD'; Russian is the name of the nation which refers to n_name = 'RUSSIA';
[ "customer.c_acctbal", "customer.c_custkey", "customer.c_mktsegment", "customer.c_nationkey", "nation.n_name", "nation.n_nationkey" ]
6,714
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
How many suppliers are from Japan?
SELECT COUNT(T1.c_custkey) FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey WHERE T2.n_name = 'JAPAN'
suppliers refer to s_nationkey; Japan is the name of the nation which refers to n_name = 'JAPAN';
[ "customer.c_custkey", "customer.c_nationkey", "nation.n_name", "nation.n_nationkey" ]
6,715
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
How many orders shipped via ship have a medium priority?
SELECT COUNT(T1.o_orderkey) FROM orders AS T1 INNER JOIN lineitem AS T2 ON T1.o_orderkey = T2.l_orderkey WHERE T2.l_shipmode = 'SHIP' AND T1.o_orderpriority = '3-MEDIUM'
orders shipped via ship refer to o_orderkey where l_shipmode = 'SHIP'; medium priority refers to o_orderpriority = '3-MEDIUM';
[ "lineitem.l_orderkey", "lineitem.l_shipmode", "orders.o_orderkey", "orders.o_orderpriority" ]
6,716
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
Among the customers from the United States, which market segment has the highest number of customers?
SELECT T.c_mktsegment FROM ( SELECT T1.c_mktsegment, COUNT(T1.c_custkey) AS num FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey WHERE T2.n_name = 'UNITED STATES' GROUP BY T1.c_mktsegment ) AS T ORDER BY T.num DESC LIMIT 1
the highest number of customers refer to MAX(COUNT(c_custkey)); the United States is the name of the nation which refers to n_name = 'UNITED STATES'; market segment refers to c_mktsegment;
[ "T.c_mktsegment", "T.num", "customer.c_custkey", "customer.c_mktsegment", "customer.c_nationkey", "nation.n_name", "nation.n_nationkey" ]
6,717
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
What are the countries in the region of Asia?
SELECT T1.n_name FROM nation AS T1 INNER JOIN region AS T2 ON T1.n_regionkey = T2.r_regionkey WHERE T2.r_name = 'ASIA'
countries in the region of Asia refer to n_name where r_name = 'ASIA';
[ "nation.n_name", "nation.n_regionkey", "region.r_name", "region.r_regionkey" ]
6,718
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
What are the names of the parts manufactured by manufacturer 3 that have a supply cost of 1,000?
SELECT T2.p_name FROM partsupp AS T1 INNER JOIN part AS T2 ON T1.ps_partkey = T2.p_partkey WHERE T1.ps_supplycost = 1000 AND T2.p_mfgr = 'Manufacturer#3'
names of the parts refer to p_name; manufacturer 3 refers to p_mfgr = 'Manufacturer#3'; ps_supplycost = 1000;
[ "part.p_mfgr", "part.p_name", "part.p_partkey", "partsupp.ps_partkey", "partsupp.ps_supplycost" ]
6,719
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
How many countries are there in the region whose comment description is "asymptotes sublate after the r."
SELECT COUNT(T1.n_nationkey) FROM nation AS T1 INNER JOIN region AS T2 ON T1.n_regionkey = T2.r_regionkey WHERE T2.r_comment = 'asymptotes sublate after the r'
r_comment = 'asymptotes sublate after the r'; countries refer to n_nationkey;
[ "nation.n_nationkey", "nation.n_regionkey", "region.r_comment", "region.r_regionkey" ]
6,720
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
Among the products manufactured by manufacturer 5 that have a retail price of no more than 1,000, how many products were shipped via rail?
SELECT COUNT(T1.ps_partkey) 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 WHERE T3.p_mfgr = 'Manufacturer#5' AND T3.p_retailprice < 1000 AND T2.l_shipmode = 'RAIL'
manufacturer 5 refers to p_mfgr = 'Manufacturer#5'; retail price of no more than 1,000 refers to p_retailprice < 1000; shipped via rail refers to shipmode = 'RAIL';
[ "lineitem.l_shipmode", "lineitem.l_suppkey", "part.p_mfgr", "part.p_partkey", "part.p_retailprice", "partsupp.ps_partkey", "partsupp.ps_suppkey" ]
6,721
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
How much is the profit for smoke turquoise purple blue salmon that was delivered in person on 5/7/1996?
SELECT T1.l_extendedprice * (1 - T1.l_discount) - T2.ps_supplycost * T1.l_quantity AS num FROM lineitem AS T1 INNER JOIN partsupp AS T2 ON T1.l_suppkey = T2.ps_suppkey INNER JOIN part AS T3 ON T2.ps_partkey = T3.p_partkey WHERE T1.l_receiptdate = '1996-05-07' AND T1.l_shipinstruct = 'DELIVER IN PERSON' AND T3.p_name = ...
SUBTRACT(MULTIPLY(l_extendedprice, (SUBTRACT(1, l_discount)), MULTIPLY(ps_supplycost, l_quantity))) where p_name = 'smoke turquoise purple blue salmon' and l_receiptdate = '1996-05-07' and l_shipinstruct = 'DELIVER IN PERSON';
[ "lineitem.l_discount", "lineitem.l_extendedprice", "lineitem.l_quantity", "lineitem.l_receiptdate", "lineitem.l_shipinstruct", "lineitem.l_suppkey", "part.p_name", "part.p_partkey", "partsupp.ps_partkey", "partsupp.ps_suppkey", "partsupp.ps_supplycost" ]
6,722
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
What is the average price before discount of the top 10 orders with the highest total price?
SELECT SUM(T2.l_extendedprice) / 10 FROM orders AS T1 INNER JOIN lineitem AS T2 ON T1.o_orderkey = T2.l_orderkey ORDER BY T1.o_totalprice DESC LIMIT 10
DIVIDE(SUM(l_extendedprice), 10) where MAX(o_totalprice);
[ "lineitem.l_extendedprice", "lineitem.l_orderkey", "orders.o_orderkey", "orders.o_totalprice" ]
6,723
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
Identify the names of the top 3 customers with the highest number of orders of all time and calculate for the average total price per order of each customers.
SELECT T.c_name, T.res FROM ( SELECT T2.c_name, SUM(T1.o_totalprice) / COUNT(T1.o_orderkey) AS res , COUNT(T1.o_orderkey) AS num FROM orders AS T1 INNER JOIN customer AS T2 ON T1.o_custkey = T2.c_custkey GROUP BY T1.o_custkey ) AS T ORDER BY T.num DESC LIMIT 3
customers with the highest number of orders refer to c_name where MAX(COUNT(o_orderkey)); DIVIDE(SUM(o_totalprice), COUNT(o_orderkey));
[ "T.c_name", "T.num", "T.res", "customer.c_custkey", "customer.c_name", "orders.o_custkey", "orders.o_orderkey", "orders.o_totalprice" ]
6,724
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
How many items were shipped on 4th December, 1993?
SELECT COUNT(l_linenumber) FROM lineitem WHERE l_shipdate = '1993-12-04'
items shipped on 4th December, 1993 refer to l_linenumber where l_shipdate = '1993-12-04';
[ "lineitem.l_linenumber", "lineitem.l_shipdate" ]
6,725
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
What was the order date of items with the highest total price?
SELECT o_orderdate FROM orders WHERE o_totalprice = ( SELECT MAX(o_totalprice) FROM orders )
the highest total price refers to MAX(o_totalprice);
[ "orders.o_orderdate", "orders.o_totalprice" ]
6,726
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
Calculate the percentage of customers' accounts in debt.
SELECT CAST(SUM(IIF(c_acctbal < 0, 1, 0)) AS REAL) * 100 / COUNT(c_custkey) FROM customer
DIVIDE(COUNT(c_custkey where c_acctbal < 0), COUNT(c_custkey)) as percentage;
[ "customer.c_acctbal", "customer.c_custkey" ]
6,727
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
How many part supplies were nearly out of stock?
SELECT COUNT(ps_suppkey) FROM partsupp WHERE ps_availqty < 10
supplies nearly out of stock refer to ps_partkey where ps_availqty < 10;
[ "partsupp.ps_availqty", "partsupp.ps_suppkey" ]
6,728
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
Calculate the percentage of manufactured parts by Manufacturer#3.
SELECT CAST(SUM(IIF(p_mfgr = 'Manufacturer#3', 1, 0)) AS REAL) * 100 / COUNT(p_partkey) FROM part
DIVIDE(COUNT(p_partkey where p_mfgr = 'Manufacturer#3'), COUNT(p_partkey)) as percentage;
[ "part.p_mfgr", "part.p_partkey" ]
6,729
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
List any five parts name in Medium Plated Brass.
SELECT p_name FROM part WHERE p_type = 'MEDIUM PLATED BRASS' LIMIT 5
p_type = 'MEDIUM PLATED BRASS'; parts name refer to p_name;
[ "part.p_name", "part.p_type" ]
6,730
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
Among the orders shipped in November, 1998 by air, how many orders were urgent?
SELECT COUNT(T1.o_orderkey) FROM orders AS T1 INNER JOIN lineitem AS T2 ON T1.o_orderkey = T2.l_orderkey WHERE T2.l_shipmode = 'AIR' AND T1.o_orderpriority = '1-URGENT' AND SUBSTR(T2.l_shipdate, 1, 7) = '1998-11'
orders shipped in November, 1998 refer to o_orderkey where l_shipdate LIKE '1998-11-%'; by air refers to l_shipmode = 'AIR'; the order is urgent if o_orderpriority = '1-URGENT' ;
[ "lineitem.l_orderkey", "lineitem.l_shipdate", "lineitem.l_shipmode", "orders.o_orderkey", "orders.o_orderpriority" ]
6,731
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
How many customers are there in India?
SELECT COUNT(T1.c_custkey) FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey WHERE T2.n_name = 'INDIA'
customers refer to c_custkey; India is the name of the nation which refers to n_name = 'INDIA';
[ "customer.c_custkey", "customer.c_nationkey", "nation.n_name", "nation.n_nationkey" ]
6,732
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
Among the customers from Morocco, how many customers were in debt?
SELECT COUNT(T1.c_custkey) FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey WHERE T1.c_acctbal < 0 AND T2.n_name = 'MOROCCO'
customers refer to c_custkey; Morocco is the name of the nation which refers to n_name = 'MOROCCO'; in debt refers to c_acctbal < 0;
[ "customer.c_acctbal", "customer.c_custkey", "customer.c_nationkey", "nation.n_name", "nation.n_nationkey" ]
6,733
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
List down the nation keys and names in Africa.
SELECT T1.n_name, T1.n_nationkey FROM nation AS T1 INNER JOIN region AS T2 ON T1.n_regionkey = T2.r_regionkey WHERE T2.r_name = 'AFRICA'
Africa refers to r_name = 'Africa';
[ "nation.n_name", "nation.n_nationkey", "nation.n_regionkey", "region.r_name", "region.r_regionkey" ]
6,734
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
Calculate the total price of orders by Customer#000000013.
SELECT SUM(T1.o_totalprice) FROM orders AS T1 INNER JOIN customer AS T2 ON T1.o_custkey = T2.c_custkey WHERE T2.c_name = 'Customer#000000013'
Customer#000000013 is the name of the customer which refers to c_name;
[ "customer.c_custkey", "customer.c_name", "orders.o_custkey", "orders.o_totalprice" ]
6,735
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
How many items did Customer#000021159 order? Calculate those items total charges.
SELECT COUNT(T2.o_orderkey), SUM(T3.l_extendedprice * (1 - T3.l_discount) * (1 + T3.l_tax)) FROM customer AS T1 INNER JOIN orders AS T2 ON T1.c_custkey = T2.o_custkey INNER JOIN lineitem AS T3 ON T2.o_orderkey = T3.l_orderkey WHERE T1.c_name = 'Customer#000021159' GROUP BY T3.l_linenumber
items Customer#000021159 order refer to l_linenumber where c_name = 'Customer#000021159'; SUM(MULTIPLY(MULTIPLY(l_extendedprice, SUBTRACT(1, l_discount)), SUM(1, l_tax))) where c_name = 'Customer#000021159';
[ "customer.c_custkey", "customer.c_name", "lineitem.l_discount", "lineitem.l_extendedprice", "lineitem.l_linenumber", "lineitem.l_orderkey", "lineitem.l_tax", "orders.o_custkey", "orders.o_orderkey" ]
6,736
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
Calculate the total profit made by chocolate floral blue coral cyan.
SELECT SUM(T3.l_extendedprice * (1 - T3.l_discount) - T2.ps_supplycost * T3.l_quantity) FROM part AS T1 INNER JOIN partsupp AS T2 ON T1.p_partkey = T2.ps_partkey INNER JOIN lineitem AS T3 ON T2.ps_partkey = T3.l_partkey AND T2.ps_suppkey = T3.l_suppkey WHERE T1.p_name = 'chocolate floral blue coral cyan'
SUBTRACT(MULTIPLY(l_extendedprice, (SUBTRACT(1, l_discount)), MULTIPLY(ps_supplycost, l_quantity))) where p_name = 'chocolate floral blue coral cyan';
[ "lineitem.l_discount", "lineitem.l_extendedprice", "lineitem.l_partkey", "lineitem.l_quantity", "lineitem.l_suppkey", "part.p_name", "part.p_partkey", "partsupp.ps_partkey", "partsupp.ps_suppkey", "partsupp.ps_supplycost" ]
6,737
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
Calculate the percentage of suppliers in Germany.
SELECT CAST(SUM(IIF(T2.n_name = 'GERMANY', 1, 0)) AS REAL) * 100 / COUNT(T1.s_suppkey) FROM supplier AS T1 INNER JOIN nation AS T2 ON T1.s_nationkey = T2.n_nationkey WHERE T1.s_acctbal < 0
DIVIDE(COUNT(s_suppkey where n_name = 'GERMANY'), COUNT(s_suppkey)) as percentage;
[ "nation.n_name", "nation.n_nationkey", "supplier.s_acctbal", "supplier.s_nationkey", "supplier.s_suppkey" ]
6,738
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
List the suppliers' names which supplied smoke red pale saddle plum.
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_name = 'smoke red pale saddle plum'
p_name = 'smoke red pale saddle plum'; the suppliers' names refer to s_name;
[ "part.p_name", "part.p_partkey", "partsupp.ps_partkey", "partsupp.ps_suppkey", "supplier.s_name", "supplier.s_suppkey" ]
6,739
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
Among the suppliers from Middle East region, how many suppliers were in debt?
SELECT COUNT(T3.s_name) 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 T3.s_acctbal < 0 AND T1.r_name = 'MIDDLE EAST'
suppliers from Middle East region refer to s_name where r_name = 'MIDDLE EAST'; in debt refers to s_acctbal < 0;
[ "nation.n_nationkey", "nation.n_regionkey", "region.r_name", "region.r_regionkey", "supplier.s_acctbal", "supplier.s_name", "supplier.s_nationkey" ]
6,740
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
Among the parts shipped by rail on 1st December, 1995, list part names with 10% discount.
SELECT T2.p_name FROM partsupp AS T1 INNER JOIN part AS T2 ON T1.ps_partkey = T2.p_partkey INNER JOIN lineitem AS T3 ON T1.ps_partkey = T3.l_partkey WHERE T3.l_discount = 0.1 AND T3.l_shipdate = '1995-12-01' AND T3.l_shipmode = 'RAIL'
shipped by rail on 1st December, 1995 refers to l_shipmode = 'RAIL' where l_shipdate = '1995-12-01'; part names with 10% discount refer to p_name where l_discount = 0.1;
[ "lineitem.l_discount", "lineitem.l_partkey", "lineitem.l_shipdate", "lineitem.l_shipmode", "part.p_name", "part.p_partkey", "partsupp.ps_partkey" ]
6,741
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
Among the parts supplied by Supplier#000000018, provide parts names which had supply costs above 900.
SELECT T2.p_name FROM partsupp AS T1 INNER JOIN part AS T2 ON T1.ps_partkey = T2.p_partkey INNER JOIN supplier AS T3 ON T1.ps_suppkey = T3.s_suppkey WHERE T1.ps_supplycost > 900 AND T3.s_name = 'Supplier#000000018'
Supplier#000000018 is the name of supplier which refers to s_name; supply costs above 900 refer to ps_supplycost > 900;
[ "part.p_name", "part.p_partkey", "partsupp.ps_partkey", "partsupp.ps_suppkey", "partsupp.ps_supplycost", "supplier.s_name", "supplier.s_suppkey" ]
6,742
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
How many orders were shipped in 1994?
SELECT COUNT(l_orderkey) FROM lineitem WHERE STRFTIME('%Y', l_shipdate) = '1994'
orders shipped in 1994 refer to l_orderkey where year(l_shipdate) = 1994;
[ "lineitem.l_orderkey", "lineitem.l_shipdate" ]
6,743
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
How many of the line items have been shipped by rail with a quantity less than 30?
SELECT COUNT(l_linenumber) FROM lineitem WHERE l_quantity < 30 AND l_shipmode = 'RAIL'
shipped by rail refers to l_shipmode = 'RAIL'; quantity less than 30 refers to l_quantity < 30;
[ "lineitem.l_linenumber", "lineitem.l_quantity", "lineitem.l_shipmode" ]
6,744
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
Among the customers in the furniture market segment, how many of them have a nation key of 1?
SELECT COUNT(c_custkey) FROM customer WHERE c_mktsegment = 'FURNITURE' AND c_nationkey = 1
furniture market segment refers to c_mktsegment = 'FURNITURE';
[ "customer.c_custkey", "customer.c_mktsegment", "customer.c_nationkey" ]
6,745
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
Give the phone number of the customer with the highest account balance.
SELECT c_phone FROM customer ORDER BY c_acctbal DESC LIMIT 1
phone number of the customer refers to c_phone; the highest account balance refers to MAX(c_acctbal);
[ "customer.c_acctbal", "customer.c_phone" ]
6,746
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
What is the order priority of the order with the highest total price?
SELECT o_orderpriority FROM orders WHERE o_totalprice = ( SELECT MAX(o_totalprice) FROM orders )
order with the highest total price refers to MAX(o_totalprice);
[ "orders.o_orderpriority", "orders.o_totalprice" ]
6,747
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
What is the total number of orders made by customers in United States?
SELECT COUNT(T1.o_orderkey) FROM orders AS T1 INNER JOIN customer AS T2 ON T1.o_custkey = T2.c_custkey INNER JOIN nation AS T3 ON T2.c_nationkey = T3.n_nationkey WHERE T3.n_name = 'UNITED STATES'
orders refer to o_orderkey; the United States is the name of the nation which refers to n_name = 'UNITED STATES';
[ "customer.c_custkey", "customer.c_nationkey", "nation.n_name", "nation.n_nationkey", "orders.o_custkey", "orders.o_orderkey" ]
6,748
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
Among the customers from Brazil, how many customers are in automobile market segment?
SELECT COUNT(T1.c_custkey) FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey WHERE T1.c_mktsegment = 'AUTOMOBILE' AND T2.n_name = 'BRAZIL'
customers refer to c_custkey; Brazil is the name of the nation which refers to n_name = 'BRAZIL'; c_mktsegment = 'automobile';
[ "customer.c_custkey", "customer.c_mktsegment", "customer.c_nationkey", "nation.n_name", "nation.n_nationkey" ]
6,749
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
Provide the order comments for at least 5 orders made by 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' LIMIT 5
order comments refer to o_comment; c_mktsegment = 'Furniture';
[ "customer.c_custkey", "customer.c_mktsegment", "orders.o_comment", "orders.o_custkey" ]
6,750
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
List down the countries that are located in Asia.
SELECT T1.n_name FROM nation AS T1 INNER JOIN region AS T2 ON T1.n_regionkey = T2.r_regionkey WHERE T2.r_name = 'ASIA'
countries in Asia refer to n_name where r_name = 'ASIA';
[ "nation.n_name", "nation.n_regionkey", "region.r_name", "region.r_regionkey" ]
6,751
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
Name the countries that belong in the region with comment description "furiously express accounts wake sly".
SELECT T1.n_name FROM nation AS T1 INNER JOIN region AS T2 ON T1.n_regionkey = T2.r_regionkey WHERE T2.r_comment = 'furiously express accounts wake sly'
r_comment = 'furiously express accounts wake sly';
[ "nation.n_name", "nation.n_regionkey", "region.r_comment", "region.r_regionkey" ]
6,752
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
What is the total number of suppliers from Germany?
SELECT COUNT(T1.s_suppkey) FROM supplier AS T1 INNER JOIN nation AS T2 ON T1.s_nationkey = T2.n_nationkey WHERE T2.n_name = 'GERMANY'
suppliers refer to s_suppkey; Germany is the name of the nation which refers to n_name = 'GERMANY';
[ "nation.n_name", "nation.n_nationkey", "supplier.s_nationkey", "supplier.s_suppkey" ]
6,753
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
Among the customers in Asia, how many customers are in debt?
SELECT COUNT(T1.n_name) FROM nation AS T1 INNER JOIN customer AS T2 ON T1.n_nationkey = T2.c_nationkey INNER JOIN region AS T3 ON T1.n_regionkey = T3.r_regionkey WHERE T2.c_acctbal < 0 AND T3.r_name = 'ASIA'
customers in Asia refer to n_name where r_name = 'ASIA'; customers in debt refer to c_acctbal < 0;
[ "customer.c_acctbal", "customer.c_nationkey", "nation.n_name", "nation.n_nationkey", "nation.n_regionkey", "region.r_name", "region.r_regionkey" ]
6,754
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
Provide the phone number of the customer with the highest total price in an order.
SELECT T2.c_phone FROM orders AS T1 INNER JOIN customer AS T2 ON T1.o_custkey = T2.c_custkey ORDER BY T1.o_totalprice DESC LIMIT 1
phone number of the customer refers to c_phone; the highest total price refers to MAX(o_totalprice);
[ "customer.c_custkey", "customer.c_phone", "orders.o_custkey", "orders.o_totalprice" ]
6,755
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
Among the products that have a retail price greater than 1,000, how many products were shipped via ship?
SELECT COUNT(T1.ps_suppkey) 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 WHERE T3.p_retailprice > 1000 AND T2.l_shipmode = 'SHIP'
products refer to l_partkey; retail price greater than 1,000 refers to p_retailprice > 1000; shipped via ship refers to l_shipmode = 'SHIP';
[ "lineitem.l_shipmode", "lineitem.l_suppkey", "part.p_partkey", "part.p_retailprice", "partsupp.ps_partkey", "partsupp.ps_suppkey" ]
6,756
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
What is the name and marketing segment of the customer with the total order price of 199180.63?
SELECT T2.c_name, T2.c_mktsegment FROM orders AS T1 INNER JOIN customer AS T2 ON T1.o_custkey = T2.c_custkey WHERE T1.o_totalprice = 199180.63
name of the customer refers to c_name; total order price of 199180.63 refers o_totalprice = 199180.63; marketing segment refers to c_mktsegment;
[ "customer.c_custkey", "customer.c_mktsegment", "customer.c_name", "orders.o_custkey", "orders.o_totalprice" ]
6,757
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
Provide the nation and region of the customer with the address of wH55UnX7 VI?
SELECT T1.n_name, T3.r_name FROM nation AS T1 INNER JOIN customer AS T2 ON T1.n_nationkey = T2.c_nationkey INNER JOIN region AS T3 ON T1.n_regionkey = T3.r_regionkey WHERE T2.c_address = 'wH55UnX7 VI'
nation refers to n_name; region refers to r_name; address of wH55UnX7 VI refers to c_address = 'wH55UnX7 VI';
[ "customer.c_address", "customer.c_nationkey", "nation.n_name", "nation.n_nationkey", "nation.n_regionkey", "region.r_name", "region.r_regionkey" ]
6,758
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
Among all the customers in Brazil, how many of them have an account balance of less than 1000?
SELECT COUNT(T1.c_custkey) FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey WHERE T2.n_name = 'BRAZIL' AND T1.c_acctbal < 1000
customers refer to c_custkey; Brazil is the name of the nation which refers to n_name = 'BRAZIL'; account balance of less than 1000 refers to c_acctbal < 1000;
[ "customer.c_acctbal", "customer.c_custkey", "customer.c_nationkey", "nation.n_name", "nation.n_nationkey" ]
6,759
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
List the country name of the customers in the building marketing segment with an account balance greater than 80% of the average account balance of all customers.
SELECT T2.n_name FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey INNER JOIN ( SELECT AVG(c_acctbal) * 0.8 AS avg_acctbal FROM customer ) AS T3 WHERE T1.c_acctbal > T3.avg_acctbal
country name refers to n_name; building marketing segment refers to c_mktsegment = 'BUILDING'; account balance greater than 80% of the average account balance of all customers refers to c_acctbal > MULTIPLY(AVG(c_acctbal), 0.8);
[ "T3.avg_acctbal", "customer.c_acctbal", "customer.c_nationkey", "nation.n_name", "nation.n_nationkey" ]
6,760
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
Among the customers with an account balance lower than 4000, what is the percentage of the customers in the US?
SELECT CAST(SUM(IIF(T2.n_name = 'United States', 1, 0)) AS REAL) * 100 / COUNT(T1.c_custkey) FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey WHERE T1.c_acctbal < 4000
DIVIDE(COUNT(c_custkey where n_name = 'United States' and c_acctbal < 4000), COUNT(c_custkey where c_acctbal < 4000)) as percentage;
[ "customer.c_acctbal", "customer.c_custkey", "customer.c_nationkey", "nation.n_name", "nation.n_nationkey" ]
6,761
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
Give the name and phone number of the customers who have more than 9000 account balance.
SELECT c_name, c_phone FROM customer WHERE c_acctbal > 9000
the name of the customer refers to c_name; phone number of the customer refers to c_phone; have more than 9000 account balance refers to c_acctbal > 9000;
[ "customer.c_acctbal", "customer.c_name", "customer.c_phone" ]
6,762
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
What is the average number of items shipped each day in April of 1994?
SELECT AVG(l_linenumber) FROM lineitem WHERE l_shipdate BETWEEN '1994-01-01' AND '1994-01-30'
AVG(l_linenumber) where l_shipdate between '1994-01-01' and '1994-01-30';
[ "lineitem.l_linenumber", "lineitem.l_shipdate" ]
6,763
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
List the order key of the orders with a total price between 200000 and 300000.
SELECT o_orderkey FROM orders WHERE o_totalprice BETWEEN 200000 AND 300000
orders with a total price between 200000 and 300000 refer to o_totalprice between 200000 and 300000;
[ "orders.o_orderkey", "orders.o_totalprice" ]
6,764
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
Find and list the part key of the parts which has an above-average retail price.
SELECT p_partkey FROM part WHERE p_retailprice > ( SELECT AVG(p_retailprice) FROM part )
part key of the parts which has an above-average retail price refer to p_partkey where p_retailprice > AVG(p_retailprice);
[ "part.p_partkey", "part.p_retailprice" ]
6,765
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
Calculate the percentage of part supply that costs more than 500.
SELECT CAST(SUM(IIF(ps_supplycost > 500, 1, 0)) AS REAL) * 100 / COUNT(ps_suppkey) FROM partsupp
DIVIDE(COUNT(ps_suppkey where ps_supplycost > 500)), COUNT(ps_suppkey) as percentage;
[ "partsupp.ps_suppkey", "partsupp.ps_supplycost" ]
6,766
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
Find the supply key of the top ten suppliers with the most account balance, and list the supply key along with the account balance in descending order of account balance.
SELECT s_suppkey, s_acctbal FROM supplier ORDER BY s_acctbal DESC LIMIT 10
supply key refers to s_suppkey; the most amount account balance refers to MAX(s_acctbal);
[ "supplier.s_acctbal", "supplier.s_suppkey" ]
6,767
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
How many customers who are not in debt ordered an urgent order?
SELECT COUNT(T2.c_custkey) FROM orders AS T1 INNER JOIN customer AS T2 ON T1.o_custkey = T2.c_custkey WHERE T2.c_acctbal > 0 AND T1.o_orderpriority = '1-URGENT'
customers who are not in debt refer to c_custkey where c_acctbal > 0; the order is urgent if o_orderpriority = '1-URGENT' ;
[ "customer.c_acctbal", "customer.c_custkey", "orders.o_custkey", "orders.o_orderpriority" ]
6,768
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
List the name and phone number of customers in India who have an above-average account balance.
SELECT T1.c_name, T1.c_phone FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey WHERE T1.c_acctbal > ( SELECT AVG(c_acctbal) FROM customer ) ORDER BY T1.c_name
name of customer refers to c_name; phone number of customer refers to c_phone; customers in India who have an above-average account balance refer to n_name = 'INDIA' and c_acctbal > AVG(c_acctbal);
[ "customer.c_acctbal", "customer.c_name", "customer.c_nationkey", "customer.c_phone", "nation.n_nationkey" ]
6,769
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
In the parts supply by Supplier#000000654, list the top five parts with the most supply cost in descending order of supply cost.
SELECT T2.ps_partkey FROM supplier AS T1 INNER JOIN partsupp AS T2 ON T1.s_suppkey = T2.ps_suppkey WHERE T1.s_name = 'Supplier#000000654' ORDER BY T2.ps_supplycost DESC LIMIT 5
Supplier#000000654 is the name of the supplier which refers to s_name; parts with the most supply cost refer to ps_partkey where MAX(ps_supplycost);
[ "partsupp.ps_partkey", "partsupp.ps_suppkey", "partsupp.ps_supplycost", "supplier.s_name", "supplier.s_suppkey" ]
6,770
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
What percentage of customers from France is in the automobile segment?
SELECT CAST(SUM(IIF(T1.c_mktsegment = 'AUTOMOBILE', 1, 0)) AS REAL) * 100 / COUNT(T1.c_name) FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey WHERE T2.n_name = 'FRANCE'
DIVIDE(COUNT(c_name where c_mktsegment = 'AUTOMOBILE' and n_name = 'FRANCE'), COUNT(c_name where n_name = 'FRANCE')) as percentage;
[ "customer.c_mktsegment", "customer.c_name", "customer.c_nationkey", "nation.n_name", "nation.n_nationkey" ]
6,771
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
Name the part which is most profitable.
SELECT T.p_name FROM ( SELECT T3.p_name , T2.l_extendedprice * (1 - T2.l_discount) - T1.ps_supplycost * T2.l_quantity AS num 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 ) AS T ORDER BY T.num DESC LIMIT 1
profit can be calculated as SUBTRACT(MULTIPLY(l_extendedprice, (SUBTRACT(1, l_discount)), MULTIPLY(ps_supplycost, l_quantity))); part which is most profitable refers to p_name where MAX(profit);
[ "T.num", "T.p_name", "lineitem.l_discount", "lineitem.l_extendedprice", "lineitem.l_quantity", "lineitem.l_suppkey", "part.p_name", "part.p_partkey", "partsupp.ps_partkey", "partsupp.ps_suppkey", "partsupp.ps_supplycost" ]
6,772
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
List the names of the countries with the below-average number of customers in ascending order of customer numbers.
SELECT T2.n_name FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey GROUP BY T2.n_name HAVING COUNT(T1.c_name) > ( SELECT COUNT(customer.c_name) / COUNT(DISTINCT nation.n_name) FROM customer INNER JOIN nation ON customer.c_nationkey = nation.n_nationkey ) ORDER BY COUNT(T1.c_name)
the names of countries with the below-average number of customers refer to n_name where COUNT(c_name) < DIVIDE(COUNT(c_name)), COUNT(n_name);
[ "customer.c_name", "customer.c_nationkey", "nation.n_name", "nation.n_nationkey" ]
6,773
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
What percentage of customers from the African region is in the household segment?
SELECT CAST(SUM(IIF(T2.r_name = 'AFRICA', 1, 0)) AS REAL) * 100 / COUNT(T1.n_nationkey) FROM nation AS T1 INNER JOIN region AS T2 ON T1.n_regionkey = T2.r_regionkey INNER JOIN customer AS T3 ON T1.n_nationkey = T3.c_nationkey WHERE T3.c_mktsegment = 'HOUSEHOLD'
DIVIDE(COUNT(c_custkey where c_mktsegment = 'HOUSEHOLD' and r_name = 'AFRICA'), COUNT(c_custkey where r_name = 'AFRICA')) as percentage;
[ "customer.c_mktsegment", "customer.c_nationkey", "nation.n_nationkey", "nation.n_regionkey", "region.r_name", "region.r_regionkey" ]
6,774
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
List the name of the top ten items with the most quantity available in the descending order of availability.
SELECT T1.p_name FROM part AS T1 INNER JOIN partsupp AS T2 ON T1.p_partkey = T2.ps_partkey ORDER BY T2.ps_availqty DESC LIMIT 10
items with the most quantity available refer to p_name where MAX(ps_availqty);
[ "part.p_name", "part.p_partkey", "partsupp.ps_availqty", "partsupp.ps_partkey" ]
6,775
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
Calculate the difference in the average retail price of parts shipped via ship and air.
SELECT (CAST(SUM(IIF(T3.l_shipmode = 'SHIP', T1.p_retailprice, 0)) AS REAL) / SUM(IIF(T3.l_shipmode = 'SHIP', 1, 0))) - (CAST(SUM(IIF(T3.l_shipmode = 'AIR', T1.p_retailprice, 0)) AS REAL) / SUM(IIF(T3.l_shipmode = 'AIR', 1, 0))) FROM part AS T1 INNER JOIN partsupp AS T2 ON T1.p_partkey = T2.ps_partkey INNER JOIN lineit...
SUBTRACT(DIVIDE(SUM(p_retailprice where l_shipmode = 'SHIP'), COUNT(l_shipmode = 'SHIP')), DIVIDE(SUM(p_retailprice where l_shipmode = 'AIR'), COUNT(l_shipmode = 'AIR')));
[ "lineitem.l_shipmode", "lineitem.l_suppkey", "part.p_partkey", "part.p_retailprice", "partsupp.ps_partkey", "partsupp.ps_suppkey" ]
6,776
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
What is the average discount for the parts made by Manufacturer#5?
SELECT AVG(T3.l_discount) FROM part AS T1 INNER JOIN partsupp AS T2 ON T1.p_partkey = T2.ps_partkey INNER JOIN lineitem AS T3 ON T2.ps_suppkey = T3.l_suppkey WHERE T1.p_mfgr = 'Manufacturer#5'
DIVIDE(SUM(l_discount), COUNT(l_partkey)) where p_mfgr = 'Manufacturer#5';
[ "lineitem.l_discount", "lineitem.l_suppkey", "part.p_mfgr", "part.p_partkey", "partsupp.ps_partkey", "partsupp.ps_suppkey" ]
6,777
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
In the parts shipped by rail, how many are of medium priority?
SELECT COUNT(T2.l_partkey) FROM orders AS T1 INNER JOIN lineitem AS T2 ON T1.o_orderkey = T2.l_orderkey WHERE T2.l_shipmode = 'RAIL' AND T1.o_orderpriority = '3-MEDIUM'
parts shipped by rail refer to l_partkey where l_shipmode = 'RAIL'; medium priority refers to o_orderpriority = '3-MEDIUM';
[ "lineitem.l_orderkey", "lineitem.l_partkey", "lineitem.l_shipmode", "orders.o_orderkey", "orders.o_orderpriority" ]
6,778
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
Among the suppliers in the European region, what percentage have a below-average account balance?
SELECT CAST(SUM(IIF(T3.s_acctbal < ( SELECT AVG(supplier.s_acctbal) FROM supplier ), 1, 0)) AS REAL) * 100 / 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'
DIVIDE(COUNT(s_acctbal < AVG(s_acctbal)), COUNT(s_suppkey)) as percentage where r_name = 'EUROPE';
[ "nation.n_nationkey", "nation.n_regionkey", "region.r_name", "region.r_regionkey", "supplier.s_acctbal", "supplier.s_nationkey" ]
6,779
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
Calculate the difference in the average number of low-priority orders shipped by truck in each month of 1995 and 1996.
SELECT (CAST(SUM(IIF(STRFTIME('%Y', T2.l_shipdate) = 1995, 1, 0)) AS REAL) / 12) - (CAST(SUM(IIF(STRFTIME('%Y', T2.l_shipdate) = 1996, 1, 0)) AS REAL) / 12) FROM orders AS T1 INNER JOIN lineitem AS T2 ON T1.o_orderkey = T2.l_orderkey WHERE T1.o_orderpriority = '5-LOW' AND T2.l_shipmode = 'TRUCK'
SUBTRACT(DIVIDE(SUM(l_orderkey where year(l_shipdate) = 1995), 12), DIVIDE(SUM(l_orderkey where year(l_shipdate) = 1996), 12)) where o_orderpriority = '5-LOW';
[ "lineitem.l_orderkey", "lineitem.l_shipdate", "lineitem.l_shipmode", "orders.o_orderkey", "orders.o_orderpriority" ]
6,780
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
List by their id all customers who have a debit balance in their accounts.
SELECT c_custkey FROM customer WHERE c_acctbal < 0
customers who have a debt balance refer to c_custkey where c_acctbal < 0;
[ "customer.c_acctbal", "customer.c_custkey" ]
6,781
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
List by order number the 3 items with the lowest price after applying the discount.
SELECT l_orderkey FROM lineitem ORDER BY l_extendedprice * (1 - l_discount) LIMIT 3
order number refers to l_orderkey; the lowest price after applying the discount refers to MIN(MULTIPLY(l_extendedprice), SUBTRACT(1, l_discount));
[ "lineitem.l_discount", "lineitem.l_extendedprice", "lineitem.l_orderkey" ]
6,782
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
How many orders of more than 10 items have been returned?
SELECT COUNT(l_linenumber) FROM lineitem WHERE l_quantity > 10 AND l_returnflag = 'R'
more than 10 items have been returned refer to l_returnflag = 'R' where l_quantity > 10; orders refer to l_orderkey;
[ "lineitem.l_linenumber", "lineitem.l_quantity", "lineitem.l_returnflag" ]
6,783
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
What is the total price charged for orders shipped by air without shipping instructions?
SELECT l_extendedprice * (1 - l_discount) * (1 + l_tax) AS totalprice FROM lineitem WHERE l_shipmode = 'AIR' AND l_shipinstruct = 'NONE'
SUM(MULTIPLY(MULTIPLY(l_extendedprice, SUBTRACT(1, l_discount)), SUM(1, l_tax))) where l_shipmode = 'AIR' and l_shipinstruct = 'NONE';
[ "lineitem.l_discount", "lineitem.l_extendedprice", "lineitem.l_shipinstruct", "lineitem.l_shipmode", "lineitem.l_tax" ]
6,784
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
Of the orders with a lower delivery priority, how many have an urgent priority order?
SELECT COUNT(o_orderkey) FROM orders WHERE o_orderpriority = '1-URGENT' GROUP BY o_orderdate ORDER BY o_orderdate DESC LIMIT 1
an urgent priority order refers to o_orderkey where o_orderpriority = '1-URGENT'; earlier orderdate have higher priority in delivery; lower delivery priority refers to MAX(o_orderdate);
[ "orders.o_orderdate", "orders.o_orderkey", "orders.o_orderpriority" ]
6,785
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
How many suppliers from Egypt have a debit balance?
SELECT COUNT(T1.s_suppkey) FROM supplier AS T1 INNER JOIN nation AS T2 ON T1.s_nationkey = T2.n_nationkey WHERE T1.s_acctbal < 0 AND T2.n_name = 'EGYPT'
suppliers refer to s_suppkey; Egypt is the name of the nation which refers to n_name = 'EGYPT'; the balance is in debt if s_acctbal < 0;
[ "nation.n_name", "nation.n_nationkey", "supplier.s_acctbal", "supplier.s_nationkey", "supplier.s_suppkey" ]
6,786
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
How many items shipped by REG AIR were ordered on March 22, 1995?
SELECT COUNT(T1.o_orderkey) FROM orders AS T1 INNER JOIN lineitem AS T2 ON T1.o_orderkey = T2.l_orderkey WHERE T2.l_shipmode = 'REG AIR' AND T1.o_orderdate = '1995-03-22'
items shipped by REG AIR refer to l_linenumber where l_shipmode = 'REG AIR'; ordered on March 22, 1995 refers to o_orderdate = '1995-03-22';
[ "lineitem.l_orderkey", "lineitem.l_shipmode", "orders.o_orderdate", "orders.o_orderkey" ]
6,787
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
How many European suppliers are there?
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'
European suppliers refer to s_suppkey where r_name = 'EUROPE';
[ "nation.n_nationkey", "nation.n_regionkey", "region.r_name", "region.r_regionkey", "supplier.s_nationkey" ]
6,788
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
To which segment belongs the customer that made the most orders in April 1994?
SELECT T.c_mktsegment FROM ( SELECT T2.c_mktsegment, COUNT(T1.o_orderkey) AS num FROM orders AS T1 INNER JOIN customer AS T2 ON T1.o_custkey = T2.c_custkey WHERE T1.o_orderdate LIKE '1994-04-%' GROUP BY T1.o_custkey ) AS T ORDER BY T.num DESC LIMIT 1
segment refers to c_mktsegment; customer made the most orders in April 1994 refers to c_custkey where o_orderdate LIKE '1994-04-%' and MAX(COUNT(o_orderkey));
[ "T.c_mktsegment", "T.num", "customer.c_custkey", "customer.c_mktsegment", "orders.o_custkey", "orders.o_orderdate", "orders.o_orderkey" ]
6,789
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
Lists all parts supplied by Supplier#000000034.
SELECT T3.p_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 T2.s_name = 'Supplier#000000034'
part refers to p_name; Supplier#000000034 refers to s_name = 'Supplier#000000034'
[ "part.p_name", "part.p_partkey", "partsupp.ps_partkey", "partsupp.ps_suppkey", "supplier.s_name", "supplier.s_suppkey" ]
6,790
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
What are the cost prices of large burnished copper?
SELECT T2.ps_supplycost FROM part AS T1 INNER JOIN partsupp AS T2 ON T1.p_partkey = T2.ps_partkey WHERE T1.p_type = 'LARGE BURNISHED COPPER'
cost price refers to ps_supplycost; large burnished copper refers to p_type = 'LARGE BURNISHED COPPER'
[ "part.p_partkey", "part.p_type", "partsupp.ps_partkey", "partsupp.ps_supplycost" ]
6,791
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
How many clients from Mozambique required orders with a low priority order?
SELECT COUNT(T1.c_custkey) 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 = 'MOZAMBIQUE' AND T3.o_orderpriority = '5-LOW'
Mozambique refers to n_name = 'MOZAMBIQUE'; low priority order refers to o_orderpriority = '5-LOW'
[ "customer.c_custkey", "customer.c_nationkey", "nation.n_name", "nation.n_nationkey", "orders.o_custkey", "orders.o_orderpriority" ]
6,792
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
Indicate the name of the product that is close to being sold out and that has the lowest cost price.
SELECT T1.p_name FROM part AS T1 INNER JOIN partsupp AS T2 ON T1.p_partkey = T2.ps_partkey WHERE T2.ps_availqty < 10 ORDER BY T2.ps_supplycost LIMIT 1
name of the product refers to p_name; close to being sold out refers to ps_availqty < 10; the lowest cost price refers to min(ps_supplycost)
[ "part.p_name", "part.p_partkey", "partsupp.ps_availqty", "partsupp.ps_partkey", "partsupp.ps_supplycost" ]
6,793
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
How many different clerks have served the customer with the address uFTe2u518et8Q8UC?
SELECT COUNT(T1.o_clerk) FROM orders AS T1 INNER JOIN customer AS T2 ON T1.o_custkey = T2.c_custkey WHERE T2.c_address = 'uFTe2u518et8Q8UC'
clerk who have served the customer refers to o_clerk
[ "customer.c_address", "customer.c_custkey", "orders.o_clerk", "orders.o_custkey" ]
6,794
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
Indicate the name of the parts without discount.
SELECT T3.p_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 WHERE T2.l_discount = 0.0000
name of the part refers to p_name; without discount refers to l_discount = 0.0000
[ "lineitem.l_discount", "lineitem.l_suppkey", "part.p_name", "part.p_partkey", "partsupp.ps_partkey", "partsupp.ps_suppkey" ]
6,795
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
How many suppliers from Germany have left a comment with 'carefully regular packages'?
SELECT COUNT(T1.s_suppkey) FROM supplier AS T1 INNER JOIN nation AS T2 ON T1.s_nationkey = T2.n_nationkey WHERE T2.n_name = 'GERMANY' AND T1.s_comment LIKE '%carefully regular packages%'
Germany is nation name which refers to n_name = 'GERMANY'; comment with 'carefully regular packages' refers to s_comment LIKE 'carefully regular packages%'
[ "nation.n_name", "nation.n_nationkey", "supplier.s_comment", "supplier.s_nationkey", "supplier.s_suppkey" ]
6,796
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
How many products shipped on 19/11/1994 were ordered on 21/09/1994?
SELECT COUNT(T2.l_partkey) FROM orders AS T1 INNER JOIN lineitem AS T2 ON T1.o_orderkey = T2.l_orderkey WHERE T1.o_orderdate = '1994-09-21' AND T2.l_shipdate = '1994-11-19'
shipped on 19/11/1994 refers to l_shipdate = '1994-11-19'; ordered on 21/09/1994 refers to o_orderdate = '1994-09-21'
[ "lineitem.l_orderkey", "lineitem.l_partkey", "lineitem.l_shipdate", "orders.o_orderdate", "orders.o_orderkey" ]
6,797
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
Calculate the average profit of prom brushed steel products.
SELECT SUM(T2.l_extendedprice * (1 - T2.l_discount) - T1.ps_supplycost * T2.l_quantity) / COUNT(T1.ps_partkey) 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 WHERE T3.p_type = 'PROMO BRUSHED STEEL'
prom brushed steel refers to p_type = 'PROMO BRUSHED STEEL'; average profit = divide(sum(subtract(multiply(l_extendedprice, subtract(1, l_discount)), multiply(ps_supplycost, l_quantity))), count(ps_partkey))
[ "lineitem.l_discount", "lineitem.l_extendedprice", "lineitem.l_quantity", "lineitem.l_suppkey", "part.p_partkey", "part.p_type", "partsupp.ps_partkey", "partsupp.ps_suppkey", "partsupp.ps_supplycost" ]
6,798
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
What percentage of customers engaged in the household segment are from Iran?
SELECT CAST(SUM(IIF(T2.n_name = 'IRAN', 1, 0)) AS REAL) * 100 / COUNT(T2.n_name) FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey WHERE T1.c_mktsegment = 'HOUSEHOLD'
the household segment refers to c_mktsegment = 'HOUSEHOLD'; Iran is nation name which refers to n_name = 'IRAN'; percentage = divide(count(c_custkey where n_name = 'IRAN'), count(c_custkey)) where c_mktsegment = 'HOUSEHOLD' * 100%
[ "customer.c_mktsegment", "customer.c_nationkey", "nation.n_name", "nation.n_nationkey" ]
6,799
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
Please state the segment, the name, the address, and the phone number of customer number 3.
SELECT c_mktsegment, c_name, c_address, c_phone FROM customer WHERE c_custkey = 3
segment refers to c_mktsegment; name refers to c_name; address refers to c_address; phone number refers to c_phone; customer number 3 refers to c_custkey = 3
[ "customer.c_address", "customer.c_custkey", "customer.c_mktsegment", "customer.c_name", "customer.c_phone" ]