input stringlengths 122 2.7k | output stringlengths 24 805 |
|---|---|
[INST] Here is a database schema:
lineitem :
l_shipdate [ DATE ]
l_orderkey [ INTEGER ] lineitem.l_orderkey = orders.o_orderkey
l_discount [ REAL ]
l_extendedprice [ REAL ]
l_suppkey [ INTEGER ] lineitem.l_suppkey = partsupp.ps_suppkey
l_quantity [ INTEGER ]
l_returnflag [ TEXT ]
l_partkey [ INTEGER ] lineitem.l_partke... | 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; |
[INST] Here is a database schema:
nation :
n_nationkey [ INTEGER ] primary_key
n_name [ TEXT ]
n_regionkey [ INTEGER ] nation.n_regionkey = region.r_regionkey
n_comment [ TEXT ]
supplier :
s_suppkey [ INTEGER ] primary_key
s_nationkey [ INTEGER ] supplier.s_nationkey = nation.n_nationkey
s_comment [ TEXT ]
s_name [ TEX... | 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; |
[INST] Here is a database schema:
nation :
n_nationkey [ INTEGER ] primary_key
n_name [ TEXT ]
n_regionkey [ INTEGER ] nation.n_regionkey = region.r_regionkey
n_comment [ TEXT ]
region :
r_regionkey [ INTEGER ] primary_key
r_name [ TEXT ]
r_comment [ TEXT ]
Please write me a SQL statement that answers the following qu... | 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; |
[INST] Here is a database schema:
nation :
n_nationkey [ INTEGER ] primary_key
n_name [ TEXT ]
n_regionkey [ INTEGER ] nation.n_regionkey = region.r_regionkey
n_comment [ TEXT ]
supplier :
s_suppkey [ INTEGER ] primary_key
s_nationkey [ INTEGER ] supplier.s_nationkey = nation.n_nationkey
s_comment [ TEXT ]
s_name [ TEX... | 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; |
[INST] Here is a database schema:
customer :
c_custkey [ INTEGER ] primary_key
c_mktsegment [ TEXT ]
c_nationkey [ INTEGER ] customer.c_nationkey = nation.n_nationkey
c_name [ TEXT ]
c_address [ TEXT ]
c_phone [ TEXT ]
c_acctbal [ REAL ]
c_comment [ TEXT ]
Please write me a SQL statement that answers the following que... | SELECT c_name FROM customer WHERE c_acctbal = ( SELECT MIN(c_acctbal) FROM customer ); |
[INST] Here is a database schema:
lineitem :
l_shipdate [ DATE ]
l_orderkey [ INTEGER ] lineitem.l_orderkey = orders.o_orderkey
l_discount [ REAL ]
l_extendedprice [ REAL ]
l_suppkey [ INTEGER ] lineitem.l_suppkey = partsupp.ps_suppkey
l_quantity [ INTEGER ]
l_returnflag [ TEXT ]
l_partkey [ INTEGER ] lineitem.l_partke... | SELECT COUNT(l_orderkey) FROM lineitem WHERE STRFTIME('%Y', l_shipdate) = '1998'; |
[INST] Here is a database schema:
customer :
c_custkey [ INTEGER ] primary_key
c_mktsegment [ TEXT ]
c_nationkey [ INTEGER ] customer.c_nationkey = nation.n_nationkey
c_name [ TEXT ]
c_address [ TEXT ]
c_phone [ TEXT ]
c_acctbal [ REAL ]
c_comment [ TEXT ]
Please write me a SQL statement that answers the following que... | SELECT COUNT(c_custkey) FROM customer WHERE c_acctbal < 0; |
[INST] Here is a database schema:
lineitem :
l_shipdate [ DATE ]
l_orderkey [ INTEGER ] lineitem.l_orderkey = orders.o_orderkey
l_discount [ REAL ]
l_extendedprice [ REAL ]
l_suppkey [ INTEGER ] lineitem.l_suppkey = partsupp.ps_suppkey
l_quantity [ INTEGER ]
l_returnflag [ TEXT ]
l_partkey [ INTEGER ] lineitem.l_partke... | SELECT COUNT(l_linenumber) FROM lineitem WHERE l_returnflag = 'R' AND l_shipmode = 'AIR' AND STRFTIME('%Y', l_shipdate) = '1994'; |
[INST] Here is a database schema:
customer :
c_custkey [ INTEGER ] primary_key
c_mktsegment [ TEXT ]
c_nationkey [ INTEGER ] customer.c_nationkey = nation.n_nationkey
c_name [ TEXT ]
c_address [ TEXT ]
c_phone [ TEXT ]
c_acctbal [ REAL ]
c_comment [ TEXT ]
Please write me a SQL statement that answers the following que... | SELECT COUNT(c_custkey) FROM customer WHERE c_mktsegment = 'AUTOMOBILE'; |
[INST] Here is a database schema:
lineitem :
l_shipdate [ DATE ]
l_orderkey [ INTEGER ] lineitem.l_orderkey = orders.o_orderkey
l_discount [ REAL ]
l_extendedprice [ REAL ]
l_suppkey [ INTEGER ] lineitem.l_suppkey = partsupp.ps_suppkey
l_quantity [ INTEGER ]
l_returnflag [ TEXT ]
l_partkey [ INTEGER ] lineitem.l_partke... | SELECT l_orderkey FROM lineitem ORDER BY l_extendedprice DESC LIMIT 2; |
[INST] Here is a database schema:
lineitem :
l_shipdate [ DATE ]
l_orderkey [ INTEGER ] lineitem.l_orderkey = orders.o_orderkey
l_discount [ REAL ]
l_extendedprice [ REAL ]
l_suppkey [ INTEGER ] lineitem.l_suppkey = partsupp.ps_suppkey
l_quantity [ INTEGER ]
l_returnflag [ TEXT ]
l_partkey [ INTEGER ] lineitem.l_partke... | 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; |
[INST] Here is a database schema:
customer :
c_custkey [ INTEGER ] primary_key
c_mktsegment [ TEXT ]
c_nationkey [ INTEGER ] customer.c_nationkey = nation.n_nationkey
c_name [ TEXT ]
c_address [ TEXT ]
c_phone [ TEXT ]
c_acctbal [ REAL ]
c_comment [ TEXT ]
nation :
n_nationkey [ INTEGER ] primary_key
n_name [ TEXT ]
n_... | 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; |
[INST] Here is a database schema:
lineitem :
l_shipdate [ DATE ]
l_orderkey [ INTEGER ] lineitem.l_orderkey = orders.o_orderkey
l_discount [ REAL ]
l_extendedprice [ REAL ]
l_suppkey [ INTEGER ] lineitem.l_suppkey = partsupp.ps_suppkey
l_quantity [ INTEGER ]
l_returnflag [ TEXT ]
l_partkey [ INTEGER ] lineitem.l_partke... | 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'; |
[INST] Here is a database schema:
customer :
c_custkey [ INTEGER ] primary_key
c_mktsegment [ TEXT ]
c_nationkey [ INTEGER ] customer.c_nationkey = nation.n_nationkey
c_name [ TEXT ]
c_address [ TEXT ]
c_phone [ TEXT ]
c_acctbal [ REAL ]
c_comment [ TEXT ]
nation :
n_nationkey [ INTEGER ] primary_key
n_name [ TEXT ]
n_... | 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'; |
[INST] Here is a database schema:
customer :
c_custkey [ INTEGER ] primary_key
c_mktsegment [ TEXT ]
c_nationkey [ INTEGER ] customer.c_nationkey = nation.n_nationkey
c_name [ TEXT ]
c_address [ TEXT ]
c_phone [ TEXT ]
c_acctbal [ REAL ]
c_comment [ TEXT ]
nation :
n_nationkey [ INTEGER ] primary_key
n_name [ TEXT ]
n_... | 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'; |
[INST] Here is a database schema:
lineitem :
l_shipdate [ DATE ]
l_orderkey [ INTEGER ] lineitem.l_orderkey = orders.o_orderkey
l_discount [ REAL ]
l_extendedprice [ REAL ]
l_suppkey [ INTEGER ] lineitem.l_suppkey = partsupp.ps_suppkey
l_quantity [ INTEGER ]
l_returnflag [ TEXT ]
l_partkey [ INTEGER ] lineitem.l_partke... | 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'; |
[INST] Here is a database schema:
customer :
c_custkey [ INTEGER ] primary_key
c_mktsegment [ TEXT ]
c_nationkey [ INTEGER ] customer.c_nationkey = nation.n_nationkey
c_name [ TEXT ]
c_address [ TEXT ]
c_phone [ TEXT ]
c_acctbal [ REAL ]
c_comment [ TEXT ]
nation :
n_nationkey [ INTEGER ] primary_key
n_name [ TEXT ]
n_... | 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; |
[INST] Here is a database schema:
nation :
n_nationkey [ INTEGER ] primary_key
n_name [ TEXT ]
n_regionkey [ INTEGER ] nation.n_regionkey = region.r_regionkey
n_comment [ TEXT ]
region :
r_regionkey [ INTEGER ] primary_key
r_name [ TEXT ]
r_comment [ TEXT ]
Please write me a SQL statement that answers the following qu... | 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'; |
[INST] Here is a database schema:
part :
p_partkey [ INTEGER ] primary_key
p_type [ TEXT ]
p_size [ INTEGER ]
p_brand [ TEXT ]
p_name [ TEXT ]
p_container [ TEXT ]
p_mfgr [ TEXT ]
p_retailprice [ REAL ]
p_comment [ TEXT ]
partsupp :
ps_partkey [ INTEGER ] partsupp.ps_partkey = part.p_partkey
ps_suppkey [ INTEGER ] part... | 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'; |
[INST] Here is a database schema:
nation :
n_nationkey [ INTEGER ] primary_key
n_name [ TEXT ]
n_regionkey [ INTEGER ] nation.n_regionkey = region.r_regionkey
n_comment [ TEXT ]
region :
r_regionkey [ INTEGER ] primary_key
r_name [ TEXT ]
r_comment [ TEXT ]
Please write me a SQL statement that answers the following qu... | 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'; |
[INST] Here is a database schema:
lineitem :
l_shipdate [ DATE ]
l_orderkey [ INTEGER ] lineitem.l_orderkey = orders.o_orderkey
l_discount [ REAL ]
l_extendedprice [ REAL ]
l_suppkey [ INTEGER ] lineitem.l_suppkey = partsupp.ps_suppkey
l_quantity [ INTEGER ]
l_returnflag [ TEXT ]
l_partkey [ INTEGER ] lineitem.l_partke... | 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'; |
[INST] Here is a database schema:
lineitem :
l_shipdate [ DATE ]
l_orderkey [ INTEGER ] lineitem.l_orderkey = orders.o_orderkey
l_discount [ REAL ]
l_extendedprice [ REAL ]
l_suppkey [ INTEGER ] lineitem.l_suppkey = partsupp.ps_suppkey
l_quantity [ INTEGER ]
l_returnflag [ TEXT ]
l_partkey [ INTEGER ] lineitem.l_partke... | 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 = ... |
[INST] Here is a database schema:
lineitem :
l_shipdate [ DATE ]
l_orderkey [ INTEGER ] lineitem.l_orderkey = orders.o_orderkey
l_discount [ REAL ]
l_extendedprice [ REAL ]
l_suppkey [ INTEGER ] lineitem.l_suppkey = partsupp.ps_suppkey
l_quantity [ INTEGER ]
l_returnflag [ TEXT ]
l_partkey [ INTEGER ] lineitem.l_partke... | 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; |
[INST] Here is a database schema:
customer :
c_custkey [ INTEGER ] primary_key
c_mktsegment [ TEXT ]
c_nationkey [ INTEGER ] customer.c_nationkey = nation.n_nationkey
c_name [ TEXT ]
c_address [ TEXT ]
c_phone [ TEXT ]
c_acctbal [ REAL ]
c_comment [ TEXT ]
orders :
o_orderdate [ DATE ]
o_orderkey [ INTEGER ] primary_ke... | 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; |
[INST] Here is a database schema:
lineitem :
l_shipdate [ DATE ]
l_orderkey [ INTEGER ] lineitem.l_orderkey = orders.o_orderkey
l_discount [ REAL ]
l_extendedprice [ REAL ]
l_suppkey [ INTEGER ] lineitem.l_suppkey = partsupp.ps_suppkey
l_quantity [ INTEGER ]
l_returnflag [ TEXT ]
l_partkey [ INTEGER ] lineitem.l_partke... | SELECT COUNT(l_linenumber) FROM lineitem WHERE l_shipdate = '1993-12-04'; |
[INST] Here is a database schema:
orders :
o_orderdate [ DATE ]
o_orderkey [ INTEGER ] primary_key
o_custkey [ INTEGER ] orders.o_custkey = customer.c_custkey
o_orderpriority [ TEXT ]
o_shippriority [ INTEGER ]
o_clerk [ TEXT ]
o_orderstatus [ TEXT ]
o_totalprice [ REAL ]
o_comment [ TEXT ]
Please write me a SQL state... | SELECT o_orderdate FROM orders WHERE o_totalprice = ( SELECT MAX(o_totalprice) FROM orders ); |
[INST] Here is a database schema:
customer :
c_custkey [ INTEGER ] primary_key
c_mktsegment [ TEXT ]
c_nationkey [ INTEGER ] customer.c_nationkey = nation.n_nationkey
c_name [ TEXT ]
c_address [ TEXT ]
c_phone [ TEXT ]
c_acctbal [ REAL ]
c_comment [ TEXT ]
Please write me a SQL statement that answers the following que... | SELECT CAST(SUM(IIF(c_acctbal < 0, 1, 0)) AS REAL) * 100 / COUNT(c_custkey) FROM customer; |
[INST] Here is a database schema:
partsupp :
ps_partkey [ INTEGER ] partsupp.ps_partkey = part.p_partkey
ps_suppkey [ INTEGER ] partsupp.ps_suppkey = supplier.s_suppkey
ps_supplycost [ REAL ]
ps_availqty [ INTEGER ]
ps_comment [ TEXT ]
Please write me a SQL statement that answers the following question: How many part ... | SELECT COUNT(ps_suppkey) FROM partsupp WHERE ps_availqty < 10; |
[INST] Here is a database schema:
part :
p_partkey [ INTEGER ] primary_key
p_type [ TEXT ]
p_size [ INTEGER ]
p_brand [ TEXT ]
p_name [ TEXT ]
p_container [ TEXT ]
p_mfgr [ TEXT ]
p_retailprice [ REAL ]
p_comment [ TEXT ]
Please write me a SQL statement that answers the following question: Calculate the percentage of ... | SELECT CAST(SUM(IIF(p_mfgr = 'Manufacturer#3', 1, 0)) AS REAL) * 100 / COUNT(p_partkey) FROM part; |
[INST] Here is a database schema:
part :
p_partkey [ INTEGER ] primary_key
p_type [ TEXT ]
p_size [ INTEGER ]
p_brand [ TEXT ]
p_name [ TEXT ]
p_container [ TEXT ]
p_mfgr [ TEXT ]
p_retailprice [ REAL ]
p_comment [ TEXT ]
Please write me a SQL statement that answers the following question: List any five parts name in ... | SELECT p_name FROM part WHERE p_type = 'MEDIUM PLATED BRASS' LIMIT 5; |
[INST] Here is a database schema:
lineitem :
l_shipdate [ DATE ]
l_orderkey [ INTEGER ] lineitem.l_orderkey = orders.o_orderkey
l_discount [ REAL ]
l_extendedprice [ REAL ]
l_suppkey [ INTEGER ] lineitem.l_suppkey = partsupp.ps_suppkey
l_quantity [ INTEGER ]
l_returnflag [ TEXT ]
l_partkey [ INTEGER ] lineitem.l_partke... | 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'; |
[INST] Here is a database schema:
customer :
c_custkey [ INTEGER ] primary_key
c_mktsegment [ TEXT ]
c_nationkey [ INTEGER ] customer.c_nationkey = nation.n_nationkey
c_name [ TEXT ]
c_address [ TEXT ]
c_phone [ TEXT ]
c_acctbal [ REAL ]
c_comment [ TEXT ]
nation :
n_nationkey [ INTEGER ] primary_key
n_name [ TEXT ]
n_... | 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'; |
[INST] Here is a database schema:
customer :
c_custkey [ INTEGER ] primary_key
c_mktsegment [ TEXT ]
c_nationkey [ INTEGER ] customer.c_nationkey = nation.n_nationkey
c_name [ TEXT ]
c_address [ TEXT ]
c_phone [ TEXT ]
c_acctbal [ REAL ]
c_comment [ TEXT ]
nation :
n_nationkey [ INTEGER ] primary_key
n_name [ TEXT ]
n_... | 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'; |
[INST] Here is a database schema:
nation :
n_nationkey [ INTEGER ] primary_key
n_name [ TEXT ]
n_regionkey [ INTEGER ] nation.n_regionkey = region.r_regionkey
n_comment [ TEXT ]
region :
r_regionkey [ INTEGER ] primary_key
r_name [ TEXT ]
r_comment [ TEXT ]
Please write me a SQL statement that answers the following qu... | 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'; |
[INST] Here is a database schema:
customer :
c_custkey [ INTEGER ] primary_key
c_mktsegment [ TEXT ]
c_nationkey [ INTEGER ] customer.c_nationkey = nation.n_nationkey
c_name [ TEXT ]
c_address [ TEXT ]
c_phone [ TEXT ]
c_acctbal [ REAL ]
c_comment [ TEXT ]
orders :
o_orderdate [ DATE ]
o_orderkey [ INTEGER ] primary_ke... | 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'; |
[INST] Here is a database schema:
customer :
c_custkey [ INTEGER ] primary_key
c_mktsegment [ TEXT ]
c_nationkey [ INTEGER ] customer.c_nationkey = nation.n_nationkey
c_name [ TEXT ]
c_address [ TEXT ]
c_phone [ TEXT ]
c_acctbal [ REAL ]
c_comment [ TEXT ]
lineitem :
l_shipdate [ DATE ]
l_orderkey [ INTEGER ] lineitem.... | 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; |
[INST] Here is a database schema:
lineitem :
l_shipdate [ DATE ]
l_orderkey [ INTEGER ] lineitem.l_orderkey = orders.o_orderkey
l_discount [ REAL ]
l_extendedprice [ REAL ]
l_suppkey [ INTEGER ] lineitem.l_suppkey = partsupp.ps_suppkey
l_quantity [ INTEGER ]
l_returnflag [ TEXT ]
l_partkey [ INTEGER ] lineitem.l_partke... | 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'; |
[INST] Here is a database schema:
nation :
n_nationkey [ INTEGER ] primary_key
n_name [ TEXT ]
n_regionkey [ INTEGER ] nation.n_regionkey = region.r_regionkey
n_comment [ TEXT ]
supplier :
s_suppkey [ INTEGER ] primary_key
s_nationkey [ INTEGER ] supplier.s_nationkey = nation.n_nationkey
s_comment [ TEXT ]
s_name [ TEX... | 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; |
[INST] Here is a database schema:
part :
p_partkey [ INTEGER ] primary_key
p_type [ TEXT ]
p_size [ INTEGER ]
p_brand [ TEXT ]
p_name [ TEXT ]
p_container [ TEXT ]
p_mfgr [ TEXT ]
p_retailprice [ REAL ]
p_comment [ TEXT ]
partsupp :
ps_partkey [ INTEGER ] partsupp.ps_partkey = part.p_partkey
ps_suppkey [ INTEGER ] part... | 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'; |
[INST] Here is a database schema:
nation :
n_nationkey [ INTEGER ] primary_key
n_name [ TEXT ]
n_regionkey [ INTEGER ] nation.n_regionkey = region.r_regionkey
n_comment [ TEXT ]
region :
r_regionkey [ INTEGER ] primary_key
r_name [ TEXT ]
r_comment [ TEXT ]
supplier :
s_suppkey [ INTEGER ] primary_key
s_nationkey [ INT... | 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'; |
[INST] Here is a database schema:
lineitem :
l_shipdate [ DATE ]
l_orderkey [ INTEGER ] lineitem.l_orderkey = orders.o_orderkey
l_discount [ REAL ]
l_extendedprice [ REAL ]
l_suppkey [ INTEGER ] lineitem.l_suppkey = partsupp.ps_suppkey
l_quantity [ INTEGER ]
l_returnflag [ TEXT ]
l_partkey [ INTEGER ] lineitem.l_partke... | 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'; |
[INST] Here is a database schema:
part :
p_partkey [ INTEGER ] primary_key
p_type [ TEXT ]
p_size [ INTEGER ]
p_brand [ TEXT ]
p_name [ TEXT ]
p_container [ TEXT ]
p_mfgr [ TEXT ]
p_retailprice [ REAL ]
p_comment [ TEXT ]
partsupp :
ps_partkey [ INTEGER ] partsupp.ps_partkey = part.p_partkey
ps_suppkey [ INTEGER ] part... | 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'; |
[INST] Here is a database schema:
lineitem :
l_shipdate [ DATE ]
l_orderkey [ INTEGER ] lineitem.l_orderkey = orders.o_orderkey
l_discount [ REAL ]
l_extendedprice [ REAL ]
l_suppkey [ INTEGER ] lineitem.l_suppkey = partsupp.ps_suppkey
l_quantity [ INTEGER ]
l_returnflag [ TEXT ]
l_partkey [ INTEGER ] lineitem.l_partke... | SELECT COUNT(l_orderkey) FROM lineitem WHERE STRFTIME('%Y', l_shipdate) = '1994'; |
[INST] Here is a database schema:
lineitem :
l_shipdate [ DATE ]
l_orderkey [ INTEGER ] lineitem.l_orderkey = orders.o_orderkey
l_discount [ REAL ]
l_extendedprice [ REAL ]
l_suppkey [ INTEGER ] lineitem.l_suppkey = partsupp.ps_suppkey
l_quantity [ INTEGER ]
l_returnflag [ TEXT ]
l_partkey [ INTEGER ] lineitem.l_partke... | SELECT COUNT(l_linenumber) FROM lineitem WHERE l_quantity < 30 AND l_shipmode = 'RAIL'; |
[INST] Here is a database schema:
customer :
c_custkey [ INTEGER ] primary_key
c_mktsegment [ TEXT ]
c_nationkey [ INTEGER ] customer.c_nationkey = nation.n_nationkey
c_name [ TEXT ]
c_address [ TEXT ]
c_phone [ TEXT ]
c_acctbal [ REAL ]
c_comment [ TEXT ]
Please write me a SQL statement that answers the following que... | SELECT COUNT(c_custkey) FROM customer WHERE c_mktsegment = 'FURNITURE' AND c_nationkey = 1; |
[INST] Here is a database schema:
customer :
c_custkey [ INTEGER ] primary_key
c_mktsegment [ TEXT ]
c_nationkey [ INTEGER ] customer.c_nationkey = nation.n_nationkey
c_name [ TEXT ]
c_address [ TEXT ]
c_phone [ TEXT ]
c_acctbal [ REAL ]
c_comment [ TEXT ]
Please write me a SQL statement that answers the following que... | SELECT c_phone FROM customer ORDER BY c_acctbal DESC LIMIT 1; |
[INST] Here is a database schema:
orders :
o_orderdate [ DATE ]
o_orderkey [ INTEGER ] primary_key
o_custkey [ INTEGER ] orders.o_custkey = customer.c_custkey
o_orderpriority [ TEXT ]
o_shippriority [ INTEGER ]
o_clerk [ TEXT ]
o_orderstatus [ TEXT ]
o_totalprice [ REAL ]
o_comment [ TEXT ]
Please write me a SQL state... | SELECT o_orderpriority FROM orders WHERE o_totalprice = ( SELECT MAX(o_totalprice) FROM orders ); |
[INST] Here is a database schema:
customer :
c_custkey [ INTEGER ] primary_key
c_mktsegment [ TEXT ]
c_nationkey [ INTEGER ] customer.c_nationkey = nation.n_nationkey
c_name [ TEXT ]
c_address [ TEXT ]
c_phone [ TEXT ]
c_acctbal [ REAL ]
c_comment [ TEXT ]
nation :
n_nationkey [ INTEGER ] primary_key
n_name [ TEXT ]
n_... | 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'; |
[INST] Here is a database schema:
customer :
c_custkey [ INTEGER ] primary_key
c_mktsegment [ TEXT ]
c_nationkey [ INTEGER ] customer.c_nationkey = nation.n_nationkey
c_name [ TEXT ]
c_address [ TEXT ]
c_phone [ TEXT ]
c_acctbal [ REAL ]
c_comment [ TEXT ]
nation :
n_nationkey [ INTEGER ] primary_key
n_name [ TEXT ]
n_... | 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'; |
[INST] Here is a database schema:
customer :
c_custkey [ INTEGER ] primary_key
c_mktsegment [ TEXT ]
c_nationkey [ INTEGER ] customer.c_nationkey = nation.n_nationkey
c_name [ TEXT ]
c_address [ TEXT ]
c_phone [ TEXT ]
c_acctbal [ REAL ]
c_comment [ TEXT ]
orders :
o_orderdate [ DATE ]
o_orderkey [ INTEGER ] primary_ke... | 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; |
[INST] Here is a database schema:
nation :
n_nationkey [ INTEGER ] primary_key
n_name [ TEXT ]
n_regionkey [ INTEGER ] nation.n_regionkey = region.r_regionkey
n_comment [ TEXT ]
region :
r_regionkey [ INTEGER ] primary_key
r_name [ TEXT ]
r_comment [ TEXT ]
Please write me a SQL statement that answers the following qu... | 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'; |
[INST] Here is a database schema:
nation :
n_nationkey [ INTEGER ] primary_key
n_name [ TEXT ]
n_regionkey [ INTEGER ] nation.n_regionkey = region.r_regionkey
n_comment [ TEXT ]
region :
r_regionkey [ INTEGER ] primary_key
r_name [ TEXT ]
r_comment [ TEXT ]
Please write me a SQL statement that answers the following qu... | 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'; |
[INST] Here is a database schema:
nation :
n_nationkey [ INTEGER ] primary_key
n_name [ TEXT ]
n_regionkey [ INTEGER ] nation.n_regionkey = region.r_regionkey
n_comment [ TEXT ]
supplier :
s_suppkey [ INTEGER ] primary_key
s_nationkey [ INTEGER ] supplier.s_nationkey = nation.n_nationkey
s_comment [ TEXT ]
s_name [ TEX... | 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'; |
[INST] Here is a database schema:
customer :
c_custkey [ INTEGER ] primary_key
c_mktsegment [ TEXT ]
c_nationkey [ INTEGER ] customer.c_nationkey = nation.n_nationkey
c_name [ TEXT ]
c_address [ TEXT ]
c_phone [ TEXT ]
c_acctbal [ REAL ]
c_comment [ TEXT ]
nation :
n_nationkey [ INTEGER ] primary_key
n_name [ TEXT ]
n_... | 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'; |
[INST] Here is a database schema:
customer :
c_custkey [ INTEGER ] primary_key
c_mktsegment [ TEXT ]
c_nationkey [ INTEGER ] customer.c_nationkey = nation.n_nationkey
c_name [ TEXT ]
c_address [ TEXT ]
c_phone [ TEXT ]
c_acctbal [ REAL ]
c_comment [ TEXT ]
orders :
o_orderdate [ DATE ]
o_orderkey [ INTEGER ] primary_ke... | 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; |
[INST] Here is a database schema:
lineitem :
l_shipdate [ DATE ]
l_orderkey [ INTEGER ] lineitem.l_orderkey = orders.o_orderkey
l_discount [ REAL ]
l_extendedprice [ REAL ]
l_suppkey [ INTEGER ] lineitem.l_suppkey = partsupp.ps_suppkey
l_quantity [ INTEGER ]
l_returnflag [ TEXT ]
l_partkey [ INTEGER ] lineitem.l_partke... | 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'; |
[INST] Here is a database schema:
customer :
c_custkey [ INTEGER ] primary_key
c_mktsegment [ TEXT ]
c_nationkey [ INTEGER ] customer.c_nationkey = nation.n_nationkey
c_name [ TEXT ]
c_address [ TEXT ]
c_phone [ TEXT ]
c_acctbal [ REAL ]
c_comment [ TEXT ]
orders :
o_orderdate [ DATE ]
o_orderkey [ INTEGER ] primary_ke... | 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; |
[INST] Here is a database schema:
customer :
c_custkey [ INTEGER ] primary_key
c_mktsegment [ TEXT ]
c_nationkey [ INTEGER ] customer.c_nationkey = nation.n_nationkey
c_name [ TEXT ]
c_address [ TEXT ]
c_phone [ TEXT ]
c_acctbal [ REAL ]
c_comment [ TEXT ]
nation :
n_nationkey [ INTEGER ] primary_key
n_name [ TEXT ]
n_... | 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'; |
[INST] Here is a database schema:
customer :
c_custkey [ INTEGER ] primary_key
c_mktsegment [ TEXT ]
c_nationkey [ INTEGER ] customer.c_nationkey = nation.n_nationkey
c_name [ TEXT ]
c_address [ TEXT ]
c_phone [ TEXT ]
c_acctbal [ REAL ]
c_comment [ TEXT ]
nation :
n_nationkey [ INTEGER ] primary_key
n_name [ TEXT ]
n_... | 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; |
[INST] Here is a database schema:
customer :
c_custkey [ INTEGER ] primary_key
c_mktsegment [ TEXT ]
c_nationkey [ INTEGER ] customer.c_nationkey = nation.n_nationkey
c_name [ TEXT ]
c_address [ TEXT ]
c_phone [ TEXT ]
c_acctbal [ REAL ]
c_comment [ TEXT ]
nation :
n_nationkey [ INTEGER ] primary_key
n_name [ TEXT ]
n_... | 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; |
[INST] Here is a database schema:
customer :
c_custkey [ INTEGER ] primary_key
c_mktsegment [ TEXT ]
c_nationkey [ INTEGER ] customer.c_nationkey = nation.n_nationkey
c_name [ TEXT ]
c_address [ TEXT ]
c_phone [ TEXT ]
c_acctbal [ REAL ]
c_comment [ TEXT ]
nation :
n_nationkey [ INTEGER ] primary_key
n_name [ TEXT ]
n_... | 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; |
[INST] Here is a database schema:
customer :
c_custkey [ INTEGER ] primary_key
c_mktsegment [ TEXT ]
c_nationkey [ INTEGER ] customer.c_nationkey = nation.n_nationkey
c_name [ TEXT ]
c_address [ TEXT ]
c_phone [ TEXT ]
c_acctbal [ REAL ]
c_comment [ TEXT ]
Please write me a SQL statement that answers the following que... | SELECT c_name, c_phone FROM customer WHERE c_acctbal > 9000; |
[INST] Here is a database schema:
lineitem :
l_shipdate [ DATE ]
l_orderkey [ INTEGER ] lineitem.l_orderkey = orders.o_orderkey
l_discount [ REAL ]
l_extendedprice [ REAL ]
l_suppkey [ INTEGER ] lineitem.l_suppkey = partsupp.ps_suppkey
l_quantity [ INTEGER ]
l_returnflag [ TEXT ]
l_partkey [ INTEGER ] lineitem.l_partke... | SELECT AVG(l_linenumber) FROM lineitem WHERE l_shipdate BETWEEN '1994-01-01' AND '1994-01-30'; |
[INST] Here is a database schema:
orders :
o_orderdate [ DATE ]
o_orderkey [ INTEGER ] primary_key
o_custkey [ INTEGER ] orders.o_custkey = customer.c_custkey
o_orderpriority [ TEXT ]
o_shippriority [ INTEGER ]
o_clerk [ TEXT ]
o_orderstatus [ TEXT ]
o_totalprice [ REAL ]
o_comment [ TEXT ]
Please write me a SQL state... | SELECT o_orderkey FROM orders WHERE o_totalprice BETWEEN 200000 AND 300000; |
[INST] Here is a database schema:
part :
p_partkey [ INTEGER ] primary_key
p_type [ TEXT ]
p_size [ INTEGER ]
p_brand [ TEXT ]
p_name [ TEXT ]
p_container [ TEXT ]
p_mfgr [ TEXT ]
p_retailprice [ REAL ]
p_comment [ TEXT ]
Please write me a SQL statement that answers the following question: Find and list the part key o... | SELECT p_partkey FROM part WHERE p_retailprice > ( SELECT AVG(p_retailprice) FROM part ); |
[INST] Here is a database schema:
partsupp :
ps_partkey [ INTEGER ] partsupp.ps_partkey = part.p_partkey
ps_suppkey [ INTEGER ] partsupp.ps_suppkey = supplier.s_suppkey
ps_supplycost [ REAL ]
ps_availqty [ INTEGER ]
ps_comment [ TEXT ]
Please write me a SQL statement that answers the following question: Calculate the ... | SELECT CAST(SUM(IIF(ps_supplycost > 500, 1, 0)) AS REAL) * 100 / COUNT(ps_suppkey) FROM partsupp; |
[INST] Here is a database schema:
supplier :
s_suppkey [ INTEGER ] primary_key
s_nationkey [ INTEGER ] supplier.s_nationkey = nation.n_nationkey
s_comment [ TEXT ]
s_name [ TEXT ]
s_address [ TEXT ]
s_phone [ TEXT ]
s_acctbal [ REAL ]
Please write me a SQL statement that answers the following question: Find the supply... | SELECT s_suppkey, s_acctbal FROM supplier ORDER BY s_acctbal DESC LIMIT 10; |
[INST] Here is a database schema:
customer :
c_custkey [ INTEGER ] primary_key
c_mktsegment [ TEXT ]
c_nationkey [ INTEGER ] customer.c_nationkey = nation.n_nationkey
c_name [ TEXT ]
c_address [ TEXT ]
c_phone [ TEXT ]
c_acctbal [ REAL ]
c_comment [ TEXT ]
orders :
o_orderdate [ DATE ]
o_orderkey [ INTEGER ] primary_ke... | 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'; |
[INST] Here is a database schema:
customer :
c_custkey [ INTEGER ] primary_key
c_mktsegment [ TEXT ]
c_nationkey [ INTEGER ] customer.c_nationkey = nation.n_nationkey
c_name [ TEXT ]
c_address [ TEXT ]
c_phone [ TEXT ]
c_acctbal [ REAL ]
c_comment [ TEXT ]
nation :
n_nationkey [ INTEGER ] primary_key
n_name [ TEXT ]
n_... | 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; |
[INST] Here is a database schema:
partsupp :
ps_partkey [ INTEGER ] partsupp.ps_partkey = part.p_partkey
ps_suppkey [ INTEGER ] partsupp.ps_suppkey = supplier.s_suppkey
ps_supplycost [ REAL ]
ps_availqty [ INTEGER ]
ps_comment [ TEXT ]
supplier :
s_suppkey [ INTEGER ] primary_key
s_nationkey [ INTEGER ] supplier.s_nati... | 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; |
[INST] Here is a database schema:
customer :
c_custkey [ INTEGER ] primary_key
c_mktsegment [ TEXT ]
c_nationkey [ INTEGER ] customer.c_nationkey = nation.n_nationkey
c_name [ TEXT ]
c_address [ TEXT ]
c_phone [ TEXT ]
c_acctbal [ REAL ]
c_comment [ TEXT ]
nation :
n_nationkey [ INTEGER ] primary_key
n_name [ TEXT ]
n_... | 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'; |
[INST] Here is a database schema:
lineitem :
l_shipdate [ DATE ]
l_orderkey [ INTEGER ] lineitem.l_orderkey = orders.o_orderkey
l_discount [ REAL ]
l_extendedprice [ REAL ]
l_suppkey [ INTEGER ] lineitem.l_suppkey = partsupp.ps_suppkey
l_quantity [ INTEGER ]
l_returnflag [ TEXT ]
l_partkey [ INTEGER ] lineitem.l_partke... | 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; |
[INST] Here is a database schema:
customer :
c_custkey [ INTEGER ] primary_key
c_mktsegment [ TEXT ]
c_nationkey [ INTEGER ] customer.c_nationkey = nation.n_nationkey
c_name [ TEXT ]
c_address [ TEXT ]
c_phone [ TEXT ]
c_acctbal [ REAL ]
c_comment [ TEXT ]
nation :
n_nationkey [ INTEGER ] primary_key
n_name [ TEXT ]
n_... | 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); |
[INST] Here is a database schema:
customer :
c_custkey [ INTEGER ] primary_key
c_mktsegment [ TEXT ]
c_nationkey [ INTEGER ] customer.c_nationkey = nation.n_nationkey
c_name [ TEXT ]
c_address [ TEXT ]
c_phone [ TEXT ]
c_acctbal [ REAL ]
c_comment [ TEXT ]
nation :
n_nationkey [ INTEGER ] primary_key
n_name [ TEXT ]
n_... | 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'; |
[INST] Here is a database schema:
part :
p_partkey [ INTEGER ] primary_key
p_type [ TEXT ]
p_size [ INTEGER ]
p_brand [ TEXT ]
p_name [ TEXT ]
p_container [ TEXT ]
p_mfgr [ TEXT ]
p_retailprice [ REAL ]
p_comment [ TEXT ]
partsupp :
ps_partkey [ INTEGER ] partsupp.ps_partkey = part.p_partkey
ps_suppkey [ INTEGER ] part... | 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; |
[INST] Here is a database schema:
lineitem :
l_shipdate [ DATE ]
l_orderkey [ INTEGER ] lineitem.l_orderkey = orders.o_orderkey
l_discount [ REAL ]
l_extendedprice [ REAL ]
l_suppkey [ INTEGER ] lineitem.l_suppkey = partsupp.ps_suppkey
l_quantity [ INTEGER ]
l_returnflag [ TEXT ]
l_partkey [ INTEGER ] lineitem.l_partke... | 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... |
[INST] Here is a database schema:
lineitem :
l_shipdate [ DATE ]
l_orderkey [ INTEGER ] lineitem.l_orderkey = orders.o_orderkey
l_discount [ REAL ]
l_extendedprice [ REAL ]
l_suppkey [ INTEGER ] lineitem.l_suppkey = partsupp.ps_suppkey
l_quantity [ INTEGER ]
l_returnflag [ TEXT ]
l_partkey [ INTEGER ] lineitem.l_partke... | 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'; |
[INST] Here is a database schema:
lineitem :
l_shipdate [ DATE ]
l_orderkey [ INTEGER ] lineitem.l_orderkey = orders.o_orderkey
l_discount [ REAL ]
l_extendedprice [ REAL ]
l_suppkey [ INTEGER ] lineitem.l_suppkey = partsupp.ps_suppkey
l_quantity [ INTEGER ]
l_returnflag [ TEXT ]
l_partkey [ INTEGER ] lineitem.l_partke... | 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'; |
[INST] Here is a database schema:
nation :
n_nationkey [ INTEGER ] primary_key
n_name [ TEXT ]
n_regionkey [ INTEGER ] nation.n_regionkey = region.r_regionkey
n_comment [ TEXT ]
region :
r_regionkey [ INTEGER ] primary_key
r_name [ TEXT ]
r_comment [ TEXT ]
supplier :
s_suppkey [ INTEGER ] primary_key
s_nationkey [ INT... | 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'; |
[INST] Here is a database schema:
lineitem :
l_shipdate [ DATE ]
l_orderkey [ INTEGER ] lineitem.l_orderkey = orders.o_orderkey
l_discount [ REAL ]
l_extendedprice [ REAL ]
l_suppkey [ INTEGER ] lineitem.l_suppkey = partsupp.ps_suppkey
l_quantity [ INTEGER ]
l_returnflag [ TEXT ]
l_partkey [ INTEGER ] lineitem.l_partke... | 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'; |
[INST] Here is a database schema:
customer :
c_custkey [ INTEGER ] primary_key
c_mktsegment [ TEXT ]
c_nationkey [ INTEGER ] customer.c_nationkey = nation.n_nationkey
c_name [ TEXT ]
c_address [ TEXT ]
c_phone [ TEXT ]
c_acctbal [ REAL ]
c_comment [ TEXT ]
Please write me a SQL statement that answers the following que... | SELECT c_custkey FROM customer WHERE c_acctbal < 0; |
[INST] Here is a database schema:
lineitem :
l_shipdate [ DATE ]
l_orderkey [ INTEGER ] lineitem.l_orderkey = orders.o_orderkey
l_discount [ REAL ]
l_extendedprice [ REAL ]
l_suppkey [ INTEGER ] lineitem.l_suppkey = partsupp.ps_suppkey
l_quantity [ INTEGER ]
l_returnflag [ TEXT ]
l_partkey [ INTEGER ] lineitem.l_partke... | SELECT l_orderkey FROM lineitem ORDER BY l_extendedprice * (1 - l_discount) LIMIT 3; |
[INST] Here is a database schema:
lineitem :
l_shipdate [ DATE ]
l_orderkey [ INTEGER ] lineitem.l_orderkey = orders.o_orderkey
l_discount [ REAL ]
l_extendedprice [ REAL ]
l_suppkey [ INTEGER ] lineitem.l_suppkey = partsupp.ps_suppkey
l_quantity [ INTEGER ]
l_returnflag [ TEXT ]
l_partkey [ INTEGER ] lineitem.l_partke... | SELECT COUNT(l_linenumber) FROM lineitem WHERE l_quantity > 10 AND l_returnflag = 'R'; |
[INST] Here is a database schema:
lineitem :
l_shipdate [ DATE ]
l_orderkey [ INTEGER ] lineitem.l_orderkey = orders.o_orderkey
l_discount [ REAL ]
l_extendedprice [ REAL ]
l_suppkey [ INTEGER ] lineitem.l_suppkey = partsupp.ps_suppkey
l_quantity [ INTEGER ]
l_returnflag [ TEXT ]
l_partkey [ INTEGER ] lineitem.l_partke... | SELECT l_extendedprice * (1 - l_discount) * (1 + l_tax) AS totalprice FROM lineitem WHERE l_shipmode = 'AIR' AND l_shipinstruct = 'NONE'; |
[INST] Here is a database schema:
orders :
o_orderdate [ DATE ]
o_orderkey [ INTEGER ] primary_key
o_custkey [ INTEGER ] orders.o_custkey = customer.c_custkey
o_orderpriority [ TEXT ]
o_shippriority [ INTEGER ]
o_clerk [ TEXT ]
o_orderstatus [ TEXT ]
o_totalprice [ REAL ]
o_comment [ TEXT ]
Please write me a SQL state... | SELECT COUNT(o_orderkey) FROM orders WHERE o_orderpriority = '1-URGENT' GROUP BY o_orderdate ORDER BY o_orderdate DESC LIMIT 1; |
[INST] Here is a database schema:
nation :
n_nationkey [ INTEGER ] primary_key
n_name [ TEXT ]
n_regionkey [ INTEGER ] nation.n_regionkey = region.r_regionkey
n_comment [ TEXT ]
supplier :
s_suppkey [ INTEGER ] primary_key
s_nationkey [ INTEGER ] supplier.s_nationkey = nation.n_nationkey
s_comment [ TEXT ]
s_name [ TEX... | 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'; |
[INST] Here is a database schema:
lineitem :
l_shipdate [ DATE ]
l_orderkey [ INTEGER ] lineitem.l_orderkey = orders.o_orderkey
l_discount [ REAL ]
l_extendedprice [ REAL ]
l_suppkey [ INTEGER ] lineitem.l_suppkey = partsupp.ps_suppkey
l_quantity [ INTEGER ]
l_returnflag [ TEXT ]
l_partkey [ INTEGER ] lineitem.l_partke... | 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'; |
[INST] Here is a database schema:
nation :
n_nationkey [ INTEGER ] primary_key
n_name [ TEXT ]
n_regionkey [ INTEGER ] nation.n_regionkey = region.r_regionkey
n_comment [ TEXT ]
region :
r_regionkey [ INTEGER ] primary_key
r_name [ TEXT ]
r_comment [ TEXT ]
supplier :
s_suppkey [ INTEGER ] primary_key
s_nationkey [ INT... | 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'; |
[INST] Here is a database schema:
customer :
c_custkey [ INTEGER ] primary_key
c_mktsegment [ TEXT ]
c_nationkey [ INTEGER ] customer.c_nationkey = nation.n_nationkey
c_name [ TEXT ]
c_address [ TEXT ]
c_phone [ TEXT ]
c_acctbal [ REAL ]
c_comment [ TEXT ]
orders :
o_orderdate [ DATE ]
o_orderkey [ INTEGER ] primary_ke... | 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; |
[INST] Here is a database schema:
part :
p_partkey [ INTEGER ] primary_key
p_type [ TEXT ]
p_size [ INTEGER ]
p_brand [ TEXT ]
p_name [ TEXT ]
p_container [ TEXT ]
p_mfgr [ TEXT ]
p_retailprice [ REAL ]
p_comment [ TEXT ]
partsupp :
ps_partkey [ INTEGER ] partsupp.ps_partkey = part.p_partkey
ps_suppkey [ INTEGER ] part... | 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'; |
[INST] Here is a database schema:
part :
p_partkey [ INTEGER ] primary_key
p_type [ TEXT ]
p_size [ INTEGER ]
p_brand [ TEXT ]
p_name [ TEXT ]
p_container [ TEXT ]
p_mfgr [ TEXT ]
p_retailprice [ REAL ]
p_comment [ TEXT ]
partsupp :
ps_partkey [ INTEGER ] partsupp.ps_partkey = part.p_partkey
ps_suppkey [ INTEGER ] part... | 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'; |
[INST] Here is a database schema:
customer :
c_custkey [ INTEGER ] primary_key
c_mktsegment [ TEXT ]
c_nationkey [ INTEGER ] customer.c_nationkey = nation.n_nationkey
c_name [ TEXT ]
c_address [ TEXT ]
c_phone [ TEXT ]
c_acctbal [ REAL ]
c_comment [ TEXT ]
nation :
n_nationkey [ INTEGER ] primary_key
n_name [ TEXT ]
n_... | 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'; |
[INST] Here is a database schema:
part :
p_partkey [ INTEGER ] primary_key
p_type [ TEXT ]
p_size [ INTEGER ]
p_brand [ TEXT ]
p_name [ TEXT ]
p_container [ TEXT ]
p_mfgr [ TEXT ]
p_retailprice [ REAL ]
p_comment [ TEXT ]
partsupp :
ps_partkey [ INTEGER ] partsupp.ps_partkey = part.p_partkey
ps_suppkey [ INTEGER ] part... | 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; |
[INST] Here is a database schema:
customer :
c_custkey [ INTEGER ] primary_key
c_mktsegment [ TEXT ]
c_nationkey [ INTEGER ] customer.c_nationkey = nation.n_nationkey
c_name [ TEXT ]
c_address [ TEXT ]
c_phone [ TEXT ]
c_acctbal [ REAL ]
c_comment [ TEXT ]
orders :
o_orderdate [ DATE ]
o_orderkey [ INTEGER ] primary_ke... | 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'; |
[INST] Here is a database schema:
lineitem :
l_shipdate [ DATE ]
l_orderkey [ INTEGER ] lineitem.l_orderkey = orders.o_orderkey
l_discount [ REAL ]
l_extendedprice [ REAL ]
l_suppkey [ INTEGER ] lineitem.l_suppkey = partsupp.ps_suppkey
l_quantity [ INTEGER ]
l_returnflag [ TEXT ]
l_partkey [ INTEGER ] lineitem.l_partke... | 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; |
[INST] Here is a database schema:
nation :
n_nationkey [ INTEGER ] primary_key
n_name [ TEXT ]
n_regionkey [ INTEGER ] nation.n_regionkey = region.r_regionkey
n_comment [ TEXT ]
supplier :
s_suppkey [ INTEGER ] primary_key
s_nationkey [ INTEGER ] supplier.s_nationkey = nation.n_nationkey
s_comment [ TEXT ]
s_name [ TEX... | 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%'; |
[INST] Here is a database schema:
lineitem :
l_shipdate [ DATE ]
l_orderkey [ INTEGER ] lineitem.l_orderkey = orders.o_orderkey
l_discount [ REAL ]
l_extendedprice [ REAL ]
l_suppkey [ INTEGER ] lineitem.l_suppkey = partsupp.ps_suppkey
l_quantity [ INTEGER ]
l_returnflag [ TEXT ]
l_partkey [ INTEGER ] lineitem.l_partke... | 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'; |
[INST] Here is a database schema:
lineitem :
l_shipdate [ DATE ]
l_orderkey [ INTEGER ] lineitem.l_orderkey = orders.o_orderkey
l_discount [ REAL ]
l_extendedprice [ REAL ]
l_suppkey [ INTEGER ] lineitem.l_suppkey = partsupp.ps_suppkey
l_quantity [ INTEGER ]
l_returnflag [ TEXT ]
l_partkey [ INTEGER ] lineitem.l_partke... | 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'; |
[INST] Here is a database schema:
customer :
c_custkey [ INTEGER ] primary_key
c_mktsegment [ TEXT ]
c_nationkey [ INTEGER ] customer.c_nationkey = nation.n_nationkey
c_name [ TEXT ]
c_address [ TEXT ]
c_phone [ TEXT ]
c_acctbal [ REAL ]
c_comment [ TEXT ]
nation :
n_nationkey [ INTEGER ] primary_key
n_name [ TEXT ]
n_... | 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'; |
[INST] Here is a database schema:
customer :
c_custkey [ INTEGER ] primary_key
c_mktsegment [ TEXT ]
c_nationkey [ INTEGER ] customer.c_nationkey = nation.n_nationkey
c_name [ TEXT ]
c_address [ TEXT ]
c_phone [ TEXT ]
c_acctbal [ REAL ]
c_comment [ TEXT ]
Please write me a SQL statement that answers the following que... | SELECT c_mktsegment, c_name, c_address, c_phone FROM customer WHERE c_custkey = 3; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.