q_id int64 0 9.43k | input_ids listlengths 450 49.1k | attention_mask listlengths 450 49.1k | labels listlengths 450 49.1k | input_text stringlengths 1.82k 193k | output_text stringlengths 51 837 | input_prompt stringclasses 215 values |
|---|---|---|---|---|---|---|
5,635 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE city
(
city_id INTEGER
primary key,
city_name TEXT,
state TEXT,
population INTEGER,
area REAL
)
/*
1 example row:
SELECT * FROM city LIMIT 1;
city_id || city_name || state ||population ||area
100 ||Union City ||New Jersey || 67088 || 1.3
*/
/* column definitions {
"city_id": "unique identifier for the city",
"city_name": "name of the city",
"state": "state in which the city is",
"population ": "population of the city",
"area": "square miles the city covers"
}*/
CREATE TABLE customer
(
cust_id INTEGER
primary key,
cust_name TEXT,
annual_revenue INTEGER,
cust_type TEXT,
address TEXT,
city TEXT,
state TEXT,
zip REAL,
phone TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
cust_id || cust_name ||annual_revenue || cust_type || address || city ||state || zip || phone
193 ||Advanced Fabricators || 39588651 ||manufacturer ||5141 Summit Boulevard ||West Palm Beach || FL ||33415.0 ||(561) 683-3535
*/
/* column definitions {
"cust_id": "Unique identifier for the customer",
"cust_name": "Business name of the customer",
"annual_revenue": "Annual revenue of the customer",
"cust_type": "Whether the customer is a manufacturer or a wholes",
"address": "Physical street address of the customer",
"city": "City of the customer's address",
"state": "State of the customer's address",
"zip": "Postal code of the customer's address",
"phone": "Telephone number to reach the customer"
}*/
CREATE TABLE driver
(
driver_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
address TEXT,
city TEXT,
state TEXT,
zip_code INTEGER,
phone TEXT
)
/*
1 example row:
SELECT * FROM driver LIMIT 1;
driver_id ||first_name ||last_name || address || city ||state ||zip_code || phone
20 || Sue || Newell ||268 Richmond Ave ||Memphis || TN || 38106 ||(901) 774-6569
*/
/* column definitions {
"driver_id": "Unique identifier for the driver",
"first_name": "First given name of the driver",
"last_name": "Family name of the driver",
"address": "Street address of the driver's home",
"city": "City the driver lives in",
"state": "State the driver lives in",
"zip_code": "postal code of the driver's address",
"phone": "telephone number of the driver"
}*/
CREATE TABLE truck
(
truck_id INTEGER
primary key,
make TEXT,
model_year INTEGER
)
/*
1 example row:
SELECT * FROM truck LIMIT 1;
truck_id || make ||model_year
1 ||Peterbilt || 2005
*/
/* column definitions {
"truck_id": "Unique identifier of the truck table",
"make": "The brand of the truck",
"model_year": "The year the truck was manufactured"
}*/
CREATE TABLE shipment
(
ship_id INTEGER
primary key,
cust_id INTEGER,
weight REAL,
truck_id INTEGER,
driver_id INTEGER,
city_id INTEGER,
ship_date TEXT,
foreign key (cust_id) references customer(cust_id),
foreign key (city_id) references city(city_id),
foreign key (driver_id) references driver(driver_id),
foreign key (truck_id) references truck(truck_id)
)
/*
1 example row:
SELECT * FROM shipment LIMIT 1;
ship_id ||cust_id ||weight ||truck_id ||driver_id ||city_id || ship_date
1000 || 3660 ||3528.0 || 1 || 23 || 137 ||2016-01-08
*/
/* column definitions {
"ship_id": "Unique identifier of the shipment",
"cust_id": "A reference to the customer table that indicates which customer the shipment is for",
"weight": "The number of pounds being transported on the shipment",
"truck_id": "A reference to the truck table that indicates which truck is used in the shipment",
"driver_id": "A reference to the driver table that indicates which driver transported the goods in the shipment",
"city_id": "A reference to the city table that indicates the destination of the shipment",
"ship_date": "the date the items were received by the driver"
}*/
### Question
What is the first name of the driver who transported shipment id 1028?
Clarification: shipment id 1028 refers to ship_id = 1028
| [query_database(**{'query': 'SELECT T2.first_name, T2.last_name FROM shipment AS T1 INNER JOIN driver AS T2 ON T1.driver_id = T2.driver_id WHERE T1.ship_id = 1028'})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE city
(
city_id INTEGER
primary key,
city_name TEXT,
state TEXT,
population INTEGER,
area REAL
)
/*
1 example row:
SELECT * FROM city LIMIT 1;
city_id || city_name || state ||population ||area
100 ||Union City ||New Jersey || 67088 || 1.3
*/
/* column definitions {
"city_id": "unique identifier for the city",
"city_name": "name of the city",
"state": "state in which the city is",
"population ": "population of the city",
"area": "square miles the city covers"
}*/
CREATE TABLE customer
(
cust_id INTEGER
primary key,
cust_name TEXT,
annual_revenue INTEGER,
cust_type TEXT,
address TEXT,
city TEXT,
state TEXT,
zip REAL,
phone TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
cust_id || cust_name ||annual_revenue || cust_type || address || city ||state || zip || phone
193 ||Advanced Fabricators || 39588651 ||manufacturer ||5141 Summit Boulevard ||West Palm Beach || FL ||33415.0 ||(561) 683-3535
*/
/* column definitions {
"cust_id": "Unique identifier for the customer",
"cust_name": "Business name of the customer",
"annual_revenue": "Annual revenue of the customer",
"cust_type": "Whether the customer is a manufacturer or a wholes",
"address": "Physical street address of the customer",
"city": "City of the customer's address",
"state": "State of the customer's address",
"zip": "Postal code of the customer's address",
"phone": "Telephone number to reach the customer"
}*/
CREATE TABLE driver
(
driver_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
address TEXT,
city TEXT,
state TEXT,
zip_code INTEGER,
phone TEXT
)
/*
1 example row:
SELECT * FROM driver LIMIT 1;
driver_id ||first_name ||last_name || address || city ||state ||zip_code || phone
20 || Sue || Newell ||268 Richmond Ave ||Memphis || TN || 38106 ||(901) 774-6569
*/
/* column definitions {
"driver_id": "Unique identifier for the driver",
"first_name": "First given name of the driver",
"last_name": "Family name of the driver",
"address": "Street address of the driver's home",
"city": "City the driver lives in",
"state": "State the driver lives in",
"zip_code": "postal code of the driver's address",
"phone": "telephone number of the driver"
}*/
CREATE TABLE truck
(
truck_id INTEGER
primary key,
make TEXT,
model_year INTEGER
)
/*
1 example row:
SELECT * FROM truck LIMIT 1;
truck_id || make ||model_year
1 ||Peterbilt || 2005
*/
/* column definitions {
"truck_id": "Unique identifier of the truck table",
"make": "The brand of the truck",
"model_year": "The year the truck was manufactured"
}*/
CREATE TABLE shipment
(
ship_id INTEGER
primary key,
cust_id INTEGER,
weight REAL,
truck_id INTEGER,
driver_id INTEGER,
city_id INTEGER,
ship_date TEXT,
foreign key (cust_id) references customer(cust_id),
foreign key (city_id) references city(city_id),
foreign key (driver_id) references driver(driver_id),
foreign key (truck_id) references truck(truck_id)
)
/*
1 example row:
SELECT * FROM shipment LIMIT 1;
ship_id ||cust_id ||weight ||truck_id ||driver_id ||city_id || ship_date
1000 || 3660 ||3528.0 || 1 || 23 || 137 ||2016-01-08
*/
/* column definitions {
"ship_id": "Unique identifier of the shipment",
"cust_id": "A reference to the customer table that indicates which customer the shipment is for",
"weight": "The number of pounds being transported on the shipment",
"truck_id": "A reference to the truck table that indicates which truck is used in the shipment",
"driver_id": "A reference to the driver table that indicates which driver transported the goods in the shipment",
"city_id": "A reference to the city table that indicates the destination of the shipment",
"ship_date": "the date the items were received by the driver"
}*/
|
5,639 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE city
(
city_id INTEGER
primary key,
city_name TEXT,
state TEXT,
population INTEGER,
area REAL
)
/*
1 example row:
SELECT * FROM city LIMIT 1;
city_id || city_name || state ||population ||area
100 ||Union City ||New Jersey || 67088 || 1.3
*/
/* column definitions {
"city_id": "unique identifier for the city",
"city_name": "name of the city",
"state": "state in which the city is",
"population ": "population of the city",
"area": "square miles the city covers"
}*/
CREATE TABLE customer
(
cust_id INTEGER
primary key,
cust_name TEXT,
annual_revenue INTEGER,
cust_type TEXT,
address TEXT,
city TEXT,
state TEXT,
zip REAL,
phone TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
cust_id || cust_name ||annual_revenue || cust_type || address || city ||state || zip || phone
193 ||Advanced Fabricators || 39588651 ||manufacturer ||5141 Summit Boulevard ||West Palm Beach || FL ||33415.0 ||(561) 683-3535
*/
/* column definitions {
"cust_id": "Unique identifier for the customer",
"cust_name": "Business name of the customer",
"annual_revenue": "Annual revenue of the customer",
"cust_type": "Whether the customer is a manufacturer or a wholes",
"address": "Physical street address of the customer",
"city": "City of the customer's address",
"state": "State of the customer's address",
"zip": "Postal code of the customer's address",
"phone": "Telephone number to reach the customer"
}*/
CREATE TABLE driver
(
driver_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
address TEXT,
city TEXT,
state TEXT,
zip_code INTEGER,
phone TEXT
)
/*
1 example row:
SELECT * FROM driver LIMIT 1;
driver_id ||first_name ||last_name || address || city ||state ||zip_code || phone
20 || Sue || Newell ||268 Richmond Ave ||Memphis || TN || 38106 ||(901) 774-6569
*/
/* column definitions {
"driver_id": "Unique identifier for the driver",
"first_name": "First given name of the driver",
"last_name": "Family name of the driver",
"address": "Street address of the driver's home",
"city": "City the driver lives in",
"state": "State the driver lives in",
"zip_code": "postal code of the driver's address",
"phone": "telephone number of the driver"
}*/
CREATE TABLE truck
(
truck_id INTEGER
primary key,
make TEXT,
model_year INTEGER
)
/*
1 example row:
SELECT * FROM truck LIMIT 1;
truck_id || make ||model_year
1 ||Peterbilt || 2005
*/
/* column definitions {
"truck_id": "Unique identifier of the truck table",
"make": "The brand of the truck",
"model_year": "The year the truck was manufactured"
}*/
CREATE TABLE shipment
(
ship_id INTEGER
primary key,
cust_id INTEGER,
weight REAL,
truck_id INTEGER,
driver_id INTEGER,
city_id INTEGER,
ship_date TEXT,
foreign key (cust_id) references customer(cust_id),
foreign key (city_id) references city(city_id),
foreign key (driver_id) references driver(driver_id),
foreign key (truck_id) references truck(truck_id)
)
/*
1 example row:
SELECT * FROM shipment LIMIT 1;
ship_id ||cust_id ||weight ||truck_id ||driver_id ||city_id || ship_date
1000 || 3660 ||3528.0 || 1 || 23 || 137 ||2016-01-08
*/
/* column definitions {
"ship_id": "Unique identifier of the shipment",
"cust_id": "A reference to the customer table that indicates which customer the shipment is for",
"weight": "The number of pounds being transported on the shipment",
"truck_id": "A reference to the truck table that indicates which truck is used in the shipment",
"driver_id": "A reference to the driver table that indicates which driver transported the goods in the shipment",
"city_id": "A reference to the city table that indicates the destination of the shipment",
"ship_date": "the date the items were received by the driver"
}*/
### Question
What is the average annual revenue of customers who have shipment weight of less than 65000 pounds?
Clarification: weight of less than 65000 pounds refers to weight < 65000; average annual revenue refers to AVG(annual_revenue)
| [query_database(**{'query': 'SELECT AVG(T1.annual_revenue) FROM customer AS T1 INNER JOIN shipment AS T2 ON T1.cust_id = T2.cust_id WHERE T2.weight < 65000'})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE city
(
city_id INTEGER
primary key,
city_name TEXT,
state TEXT,
population INTEGER,
area REAL
)
/*
1 example row:
SELECT * FROM city LIMIT 1;
city_id || city_name || state ||population ||area
100 ||Union City ||New Jersey || 67088 || 1.3
*/
/* column definitions {
"city_id": "unique identifier for the city",
"city_name": "name of the city",
"state": "state in which the city is",
"population ": "population of the city",
"area": "square miles the city covers"
}*/
CREATE TABLE customer
(
cust_id INTEGER
primary key,
cust_name TEXT,
annual_revenue INTEGER,
cust_type TEXT,
address TEXT,
city TEXT,
state TEXT,
zip REAL,
phone TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
cust_id || cust_name ||annual_revenue || cust_type || address || city ||state || zip || phone
193 ||Advanced Fabricators || 39588651 ||manufacturer ||5141 Summit Boulevard ||West Palm Beach || FL ||33415.0 ||(561) 683-3535
*/
/* column definitions {
"cust_id": "Unique identifier for the customer",
"cust_name": "Business name of the customer",
"annual_revenue": "Annual revenue of the customer",
"cust_type": "Whether the customer is a manufacturer or a wholes",
"address": "Physical street address of the customer",
"city": "City of the customer's address",
"state": "State of the customer's address",
"zip": "Postal code of the customer's address",
"phone": "Telephone number to reach the customer"
}*/
CREATE TABLE driver
(
driver_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
address TEXT,
city TEXT,
state TEXT,
zip_code INTEGER,
phone TEXT
)
/*
1 example row:
SELECT * FROM driver LIMIT 1;
driver_id ||first_name ||last_name || address || city ||state ||zip_code || phone
20 || Sue || Newell ||268 Richmond Ave ||Memphis || TN || 38106 ||(901) 774-6569
*/
/* column definitions {
"driver_id": "Unique identifier for the driver",
"first_name": "First given name of the driver",
"last_name": "Family name of the driver",
"address": "Street address of the driver's home",
"city": "City the driver lives in",
"state": "State the driver lives in",
"zip_code": "postal code of the driver's address",
"phone": "telephone number of the driver"
}*/
CREATE TABLE truck
(
truck_id INTEGER
primary key,
make TEXT,
model_year INTEGER
)
/*
1 example row:
SELECT * FROM truck LIMIT 1;
truck_id || make ||model_year
1 ||Peterbilt || 2005
*/
/* column definitions {
"truck_id": "Unique identifier of the truck table",
"make": "The brand of the truck",
"model_year": "The year the truck was manufactured"
}*/
CREATE TABLE shipment
(
ship_id INTEGER
primary key,
cust_id INTEGER,
weight REAL,
truck_id INTEGER,
driver_id INTEGER,
city_id INTEGER,
ship_date TEXT,
foreign key (cust_id) references customer(cust_id),
foreign key (city_id) references city(city_id),
foreign key (driver_id) references driver(driver_id),
foreign key (truck_id) references truck(truck_id)
)
/*
1 example row:
SELECT * FROM shipment LIMIT 1;
ship_id ||cust_id ||weight ||truck_id ||driver_id ||city_id || ship_date
1000 || 3660 ||3528.0 || 1 || 23 || 137 ||2016-01-08
*/
/* column definitions {
"ship_id": "Unique identifier of the shipment",
"cust_id": "A reference to the customer table that indicates which customer the shipment is for",
"weight": "The number of pounds being transported on the shipment",
"truck_id": "A reference to the truck table that indicates which truck is used in the shipment",
"driver_id": "A reference to the driver table that indicates which driver transported the goods in the shipment",
"city_id": "A reference to the city table that indicates the destination of the shipment",
"ship_date": "the date the items were received by the driver"
}*/
|
5,643 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE city
(
city_id INTEGER
primary key,
city_name TEXT,
state TEXT,
population INTEGER,
area REAL
)
/*
1 example row:
SELECT * FROM city LIMIT 1;
city_id || city_name || state ||population ||area
100 ||Union City ||New Jersey || 67088 || 1.3
*/
/* column definitions {
"city_id": "unique identifier for the city",
"city_name": "name of the city",
"state": "state in which the city is",
"population ": "population of the city",
"area": "square miles the city covers"
}*/
CREATE TABLE customer
(
cust_id INTEGER
primary key,
cust_name TEXT,
annual_revenue INTEGER,
cust_type TEXT,
address TEXT,
city TEXT,
state TEXT,
zip REAL,
phone TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
cust_id || cust_name ||annual_revenue || cust_type || address || city ||state || zip || phone
193 ||Advanced Fabricators || 39588651 ||manufacturer ||5141 Summit Boulevard ||West Palm Beach || FL ||33415.0 ||(561) 683-3535
*/
/* column definitions {
"cust_id": "Unique identifier for the customer",
"cust_name": "Business name of the customer",
"annual_revenue": "Annual revenue of the customer",
"cust_type": "Whether the customer is a manufacturer or a wholes",
"address": "Physical street address of the customer",
"city": "City of the customer's address",
"state": "State of the customer's address",
"zip": "Postal code of the customer's address",
"phone": "Telephone number to reach the customer"
}*/
CREATE TABLE driver
(
driver_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
address TEXT,
city TEXT,
state TEXT,
zip_code INTEGER,
phone TEXT
)
/*
1 example row:
SELECT * FROM driver LIMIT 1;
driver_id ||first_name ||last_name || address || city ||state ||zip_code || phone
20 || Sue || Newell ||268 Richmond Ave ||Memphis || TN || 38106 ||(901) 774-6569
*/
/* column definitions {
"driver_id": "Unique identifier for the driver",
"first_name": "First given name of the driver",
"last_name": "Family name of the driver",
"address": "Street address of the driver's home",
"city": "City the driver lives in",
"state": "State the driver lives in",
"zip_code": "postal code of the driver's address",
"phone": "telephone number of the driver"
}*/
CREATE TABLE truck
(
truck_id INTEGER
primary key,
make TEXT,
model_year INTEGER
)
/*
1 example row:
SELECT * FROM truck LIMIT 1;
truck_id || make ||model_year
1 ||Peterbilt || 2005
*/
/* column definitions {
"truck_id": "Unique identifier of the truck table",
"make": "The brand of the truck",
"model_year": "The year the truck was manufactured"
}*/
CREATE TABLE shipment
(
ship_id INTEGER
primary key,
cust_id INTEGER,
weight REAL,
truck_id INTEGER,
driver_id INTEGER,
city_id INTEGER,
ship_date TEXT,
foreign key (cust_id) references customer(cust_id),
foreign key (city_id) references city(city_id),
foreign key (driver_id) references driver(driver_id),
foreign key (truck_id) references truck(truck_id)
)
/*
1 example row:
SELECT * FROM shipment LIMIT 1;
ship_id ||cust_id ||weight ||truck_id ||driver_id ||city_id || ship_date
1000 || 3660 ||3528.0 || 1 || 23 || 137 ||2016-01-08
*/
/* column definitions {
"ship_id": "Unique identifier of the shipment",
"cust_id": "A reference to the customer table that indicates which customer the shipment is for",
"weight": "The number of pounds being transported on the shipment",
"truck_id": "A reference to the truck table that indicates which truck is used in the shipment",
"driver_id": "A reference to the driver table that indicates which driver transported the goods in the shipment",
"city_id": "A reference to the city table that indicates the destination of the shipment",
"ship_date": "the date the items were received by the driver"
}*/
### Question
What is the brand and model of truck used in shipment id 1055?
Clarification: shipment id 1055 refers to ship_id = 1055; brand refers to make; model refers to model_year
| [query_database(**{'query': 'SELECT T1.make, T1.model_year FROM truck AS T1 INNER JOIN shipment AS T2 ON T1.truck_id = T2.truck_id WHERE T2.ship_id = '1055''})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE city
(
city_id INTEGER
primary key,
city_name TEXT,
state TEXT,
population INTEGER,
area REAL
)
/*
1 example row:
SELECT * FROM city LIMIT 1;
city_id || city_name || state ||population ||area
100 ||Union City ||New Jersey || 67088 || 1.3
*/
/* column definitions {
"city_id": "unique identifier for the city",
"city_name": "name of the city",
"state": "state in which the city is",
"population ": "population of the city",
"area": "square miles the city covers"
}*/
CREATE TABLE customer
(
cust_id INTEGER
primary key,
cust_name TEXT,
annual_revenue INTEGER,
cust_type TEXT,
address TEXT,
city TEXT,
state TEXT,
zip REAL,
phone TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
cust_id || cust_name ||annual_revenue || cust_type || address || city ||state || zip || phone
193 ||Advanced Fabricators || 39588651 ||manufacturer ||5141 Summit Boulevard ||West Palm Beach || FL ||33415.0 ||(561) 683-3535
*/
/* column definitions {
"cust_id": "Unique identifier for the customer",
"cust_name": "Business name of the customer",
"annual_revenue": "Annual revenue of the customer",
"cust_type": "Whether the customer is a manufacturer or a wholes",
"address": "Physical street address of the customer",
"city": "City of the customer's address",
"state": "State of the customer's address",
"zip": "Postal code of the customer's address",
"phone": "Telephone number to reach the customer"
}*/
CREATE TABLE driver
(
driver_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
address TEXT,
city TEXT,
state TEXT,
zip_code INTEGER,
phone TEXT
)
/*
1 example row:
SELECT * FROM driver LIMIT 1;
driver_id ||first_name ||last_name || address || city ||state ||zip_code || phone
20 || Sue || Newell ||268 Richmond Ave ||Memphis || TN || 38106 ||(901) 774-6569
*/
/* column definitions {
"driver_id": "Unique identifier for the driver",
"first_name": "First given name of the driver",
"last_name": "Family name of the driver",
"address": "Street address of the driver's home",
"city": "City the driver lives in",
"state": "State the driver lives in",
"zip_code": "postal code of the driver's address",
"phone": "telephone number of the driver"
}*/
CREATE TABLE truck
(
truck_id INTEGER
primary key,
make TEXT,
model_year INTEGER
)
/*
1 example row:
SELECT * FROM truck LIMIT 1;
truck_id || make ||model_year
1 ||Peterbilt || 2005
*/
/* column definitions {
"truck_id": "Unique identifier of the truck table",
"make": "The brand of the truck",
"model_year": "The year the truck was manufactured"
}*/
CREATE TABLE shipment
(
ship_id INTEGER
primary key,
cust_id INTEGER,
weight REAL,
truck_id INTEGER,
driver_id INTEGER,
city_id INTEGER,
ship_date TEXT,
foreign key (cust_id) references customer(cust_id),
foreign key (city_id) references city(city_id),
foreign key (driver_id) references driver(driver_id),
foreign key (truck_id) references truck(truck_id)
)
/*
1 example row:
SELECT * FROM shipment LIMIT 1;
ship_id ||cust_id ||weight ||truck_id ||driver_id ||city_id || ship_date
1000 || 3660 ||3528.0 || 1 || 23 || 137 ||2016-01-08
*/
/* column definitions {
"ship_id": "Unique identifier of the shipment",
"cust_id": "A reference to the customer table that indicates which customer the shipment is for",
"weight": "The number of pounds being transported on the shipment",
"truck_id": "A reference to the truck table that indicates which truck is used in the shipment",
"driver_id": "A reference to the driver table that indicates which driver transported the goods in the shipment",
"city_id": "A reference to the city table that indicates the destination of the shipment",
"ship_date": "the date the items were received by the driver"
}*/
|
5,647 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE city
(
city_id INTEGER
primary key,
city_name TEXT,
state TEXT,
population INTEGER,
area REAL
)
/*
1 example row:
SELECT * FROM city LIMIT 1;
city_id || city_name || state ||population ||area
100 ||Union City ||New Jersey || 67088 || 1.3
*/
/* column definitions {
"city_id": "unique identifier for the city",
"city_name": "name of the city",
"state": "state in which the city is",
"population ": "population of the city",
"area": "square miles the city covers"
}*/
CREATE TABLE customer
(
cust_id INTEGER
primary key,
cust_name TEXT,
annual_revenue INTEGER,
cust_type TEXT,
address TEXT,
city TEXT,
state TEXT,
zip REAL,
phone TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
cust_id || cust_name ||annual_revenue || cust_type || address || city ||state || zip || phone
193 ||Advanced Fabricators || 39588651 ||manufacturer ||5141 Summit Boulevard ||West Palm Beach || FL ||33415.0 ||(561) 683-3535
*/
/* column definitions {
"cust_id": "Unique identifier for the customer",
"cust_name": "Business name of the customer",
"annual_revenue": "Annual revenue of the customer",
"cust_type": "Whether the customer is a manufacturer or a wholes",
"address": "Physical street address of the customer",
"city": "City of the customer's address",
"state": "State of the customer's address",
"zip": "Postal code of the customer's address",
"phone": "Telephone number to reach the customer"
}*/
CREATE TABLE driver
(
driver_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
address TEXT,
city TEXT,
state TEXT,
zip_code INTEGER,
phone TEXT
)
/*
1 example row:
SELECT * FROM driver LIMIT 1;
driver_id ||first_name ||last_name || address || city ||state ||zip_code || phone
20 || Sue || Newell ||268 Richmond Ave ||Memphis || TN || 38106 ||(901) 774-6569
*/
/* column definitions {
"driver_id": "Unique identifier for the driver",
"first_name": "First given name of the driver",
"last_name": "Family name of the driver",
"address": "Street address of the driver's home",
"city": "City the driver lives in",
"state": "State the driver lives in",
"zip_code": "postal code of the driver's address",
"phone": "telephone number of the driver"
}*/
CREATE TABLE truck
(
truck_id INTEGER
primary key,
make TEXT,
model_year INTEGER
)
/*
1 example row:
SELECT * FROM truck LIMIT 1;
truck_id || make ||model_year
1 ||Peterbilt || 2005
*/
/* column definitions {
"truck_id": "Unique identifier of the truck table",
"make": "The brand of the truck",
"model_year": "The year the truck was manufactured"
}*/
CREATE TABLE shipment
(
ship_id INTEGER
primary key,
cust_id INTEGER,
weight REAL,
truck_id INTEGER,
driver_id INTEGER,
city_id INTEGER,
ship_date TEXT,
foreign key (cust_id) references customer(cust_id),
foreign key (city_id) references city(city_id),
foreign key (driver_id) references driver(driver_id),
foreign key (truck_id) references truck(truck_id)
)
/*
1 example row:
SELECT * FROM shipment LIMIT 1;
ship_id ||cust_id ||weight ||truck_id ||driver_id ||city_id || ship_date
1000 || 3660 ||3528.0 || 1 || 23 || 137 ||2016-01-08
*/
/* column definitions {
"ship_id": "Unique identifier of the shipment",
"cust_id": "A reference to the customer table that indicates which customer the shipment is for",
"weight": "The number of pounds being transported on the shipment",
"truck_id": "A reference to the truck table that indicates which truck is used in the shipment",
"driver_id": "A reference to the driver table that indicates which driver transported the goods in the shipment",
"city_id": "A reference to the city table that indicates the destination of the shipment",
"ship_date": "the date the items were received by the driver"
}*/
### Question
How many cities are in Connecticut?
Clarification: "Connecticut" is the state
| [query_database(**{'query': 'SELECT COUNT(*) FROM city WHERE state = 'Connecticut''})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE city
(
city_id INTEGER
primary key,
city_name TEXT,
state TEXT,
population INTEGER,
area REAL
)
/*
1 example row:
SELECT * FROM city LIMIT 1;
city_id || city_name || state ||population ||area
100 ||Union City ||New Jersey || 67088 || 1.3
*/
/* column definitions {
"city_id": "unique identifier for the city",
"city_name": "name of the city",
"state": "state in which the city is",
"population ": "population of the city",
"area": "square miles the city covers"
}*/
CREATE TABLE customer
(
cust_id INTEGER
primary key,
cust_name TEXT,
annual_revenue INTEGER,
cust_type TEXT,
address TEXT,
city TEXT,
state TEXT,
zip REAL,
phone TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
cust_id || cust_name ||annual_revenue || cust_type || address || city ||state || zip || phone
193 ||Advanced Fabricators || 39588651 ||manufacturer ||5141 Summit Boulevard ||West Palm Beach || FL ||33415.0 ||(561) 683-3535
*/
/* column definitions {
"cust_id": "Unique identifier for the customer",
"cust_name": "Business name of the customer",
"annual_revenue": "Annual revenue of the customer",
"cust_type": "Whether the customer is a manufacturer or a wholes",
"address": "Physical street address of the customer",
"city": "City of the customer's address",
"state": "State of the customer's address",
"zip": "Postal code of the customer's address",
"phone": "Telephone number to reach the customer"
}*/
CREATE TABLE driver
(
driver_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
address TEXT,
city TEXT,
state TEXT,
zip_code INTEGER,
phone TEXT
)
/*
1 example row:
SELECT * FROM driver LIMIT 1;
driver_id ||first_name ||last_name || address || city ||state ||zip_code || phone
20 || Sue || Newell ||268 Richmond Ave ||Memphis || TN || 38106 ||(901) 774-6569
*/
/* column definitions {
"driver_id": "Unique identifier for the driver",
"first_name": "First given name of the driver",
"last_name": "Family name of the driver",
"address": "Street address of the driver's home",
"city": "City the driver lives in",
"state": "State the driver lives in",
"zip_code": "postal code of the driver's address",
"phone": "telephone number of the driver"
}*/
CREATE TABLE truck
(
truck_id INTEGER
primary key,
make TEXT,
model_year INTEGER
)
/*
1 example row:
SELECT * FROM truck LIMIT 1;
truck_id || make ||model_year
1 ||Peterbilt || 2005
*/
/* column definitions {
"truck_id": "Unique identifier of the truck table",
"make": "The brand of the truck",
"model_year": "The year the truck was manufactured"
}*/
CREATE TABLE shipment
(
ship_id INTEGER
primary key,
cust_id INTEGER,
weight REAL,
truck_id INTEGER,
driver_id INTEGER,
city_id INTEGER,
ship_date TEXT,
foreign key (cust_id) references customer(cust_id),
foreign key (city_id) references city(city_id),
foreign key (driver_id) references driver(driver_id),
foreign key (truck_id) references truck(truck_id)
)
/*
1 example row:
SELECT * FROM shipment LIMIT 1;
ship_id ||cust_id ||weight ||truck_id ||driver_id ||city_id || ship_date
1000 || 3660 ||3528.0 || 1 || 23 || 137 ||2016-01-08
*/
/* column definitions {
"ship_id": "Unique identifier of the shipment",
"cust_id": "A reference to the customer table that indicates which customer the shipment is for",
"weight": "The number of pounds being transported on the shipment",
"truck_id": "A reference to the truck table that indicates which truck is used in the shipment",
"driver_id": "A reference to the driver table that indicates which driver transported the goods in the shipment",
"city_id": "A reference to the city table that indicates the destination of the shipment",
"ship_date": "the date the items were received by the driver"
}*/
|
5,651 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE city
(
city_id INTEGER
primary key,
city_name TEXT,
state TEXT,
population INTEGER,
area REAL
)
/*
1 example row:
SELECT * FROM city LIMIT 1;
city_id || city_name || state ||population ||area
100 ||Union City ||New Jersey || 67088 || 1.3
*/
/* column definitions {
"city_id": "unique identifier for the city",
"city_name": "name of the city",
"state": "state in which the city is",
"population ": "population of the city",
"area": "square miles the city covers"
}*/
CREATE TABLE customer
(
cust_id INTEGER
primary key,
cust_name TEXT,
annual_revenue INTEGER,
cust_type TEXT,
address TEXT,
city TEXT,
state TEXT,
zip REAL,
phone TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
cust_id || cust_name ||annual_revenue || cust_type || address || city ||state || zip || phone
193 ||Advanced Fabricators || 39588651 ||manufacturer ||5141 Summit Boulevard ||West Palm Beach || FL ||33415.0 ||(561) 683-3535
*/
/* column definitions {
"cust_id": "Unique identifier for the customer",
"cust_name": "Business name of the customer",
"annual_revenue": "Annual revenue of the customer",
"cust_type": "Whether the customer is a manufacturer or a wholes",
"address": "Physical street address of the customer",
"city": "City of the customer's address",
"state": "State of the customer's address",
"zip": "Postal code of the customer's address",
"phone": "Telephone number to reach the customer"
}*/
CREATE TABLE driver
(
driver_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
address TEXT,
city TEXT,
state TEXT,
zip_code INTEGER,
phone TEXT
)
/*
1 example row:
SELECT * FROM driver LIMIT 1;
driver_id ||first_name ||last_name || address || city ||state ||zip_code || phone
20 || Sue || Newell ||268 Richmond Ave ||Memphis || TN || 38106 ||(901) 774-6569
*/
/* column definitions {
"driver_id": "Unique identifier for the driver",
"first_name": "First given name of the driver",
"last_name": "Family name of the driver",
"address": "Street address of the driver's home",
"city": "City the driver lives in",
"state": "State the driver lives in",
"zip_code": "postal code of the driver's address",
"phone": "telephone number of the driver"
}*/
CREATE TABLE truck
(
truck_id INTEGER
primary key,
make TEXT,
model_year INTEGER
)
/*
1 example row:
SELECT * FROM truck LIMIT 1;
truck_id || make ||model_year
1 ||Peterbilt || 2005
*/
/* column definitions {
"truck_id": "Unique identifier of the truck table",
"make": "The brand of the truck",
"model_year": "The year the truck was manufactured"
}*/
CREATE TABLE shipment
(
ship_id INTEGER
primary key,
cust_id INTEGER,
weight REAL,
truck_id INTEGER,
driver_id INTEGER,
city_id INTEGER,
ship_date TEXT,
foreign key (cust_id) references customer(cust_id),
foreign key (city_id) references city(city_id),
foreign key (driver_id) references driver(driver_id),
foreign key (truck_id) references truck(truck_id)
)
/*
1 example row:
SELECT * FROM shipment LIMIT 1;
ship_id ||cust_id ||weight ||truck_id ||driver_id ||city_id || ship_date
1000 || 3660 ||3528.0 || 1 || 23 || 137 ||2016-01-08
*/
/* column definitions {
"ship_id": "Unique identifier of the shipment",
"cust_id": "A reference to the customer table that indicates which customer the shipment is for",
"weight": "The number of pounds being transported on the shipment",
"truck_id": "A reference to the truck table that indicates which truck is used in the shipment",
"driver_id": "A reference to the driver table that indicates which driver transported the goods in the shipment",
"city_id": "A reference to the city table that indicates the destination of the shipment",
"ship_date": "the date the items were received by the driver"
}*/
### Question
How many shipments were shipped to customers living in California in year 2016?
Clarification: living in California refers to state = 'CA'; in year 2016 refers to CAST(ship_date AS DATE) = 2016
| [query_database(**{'query': 'SELECT COUNT(*) AS per FROM customer AS T1 INNER JOIN shipment AS T2 ON T1.cust_id = T2.cust_id WHERE STRFTIME('%Y', T2.ship_date) = '2016' AND T1.state = 'CA''})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE city
(
city_id INTEGER
primary key,
city_name TEXT,
state TEXT,
population INTEGER,
area REAL
)
/*
1 example row:
SELECT * FROM city LIMIT 1;
city_id || city_name || state ||population ||area
100 ||Union City ||New Jersey || 67088 || 1.3
*/
/* column definitions {
"city_id": "unique identifier for the city",
"city_name": "name of the city",
"state": "state in which the city is",
"population ": "population of the city",
"area": "square miles the city covers"
}*/
CREATE TABLE customer
(
cust_id INTEGER
primary key,
cust_name TEXT,
annual_revenue INTEGER,
cust_type TEXT,
address TEXT,
city TEXT,
state TEXT,
zip REAL,
phone TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
cust_id || cust_name ||annual_revenue || cust_type || address || city ||state || zip || phone
193 ||Advanced Fabricators || 39588651 ||manufacturer ||5141 Summit Boulevard ||West Palm Beach || FL ||33415.0 ||(561) 683-3535
*/
/* column definitions {
"cust_id": "Unique identifier for the customer",
"cust_name": "Business name of the customer",
"annual_revenue": "Annual revenue of the customer",
"cust_type": "Whether the customer is a manufacturer or a wholes",
"address": "Physical street address of the customer",
"city": "City of the customer's address",
"state": "State of the customer's address",
"zip": "Postal code of the customer's address",
"phone": "Telephone number to reach the customer"
}*/
CREATE TABLE driver
(
driver_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
address TEXT,
city TEXT,
state TEXT,
zip_code INTEGER,
phone TEXT
)
/*
1 example row:
SELECT * FROM driver LIMIT 1;
driver_id ||first_name ||last_name || address || city ||state ||zip_code || phone
20 || Sue || Newell ||268 Richmond Ave ||Memphis || TN || 38106 ||(901) 774-6569
*/
/* column definitions {
"driver_id": "Unique identifier for the driver",
"first_name": "First given name of the driver",
"last_name": "Family name of the driver",
"address": "Street address of the driver's home",
"city": "City the driver lives in",
"state": "State the driver lives in",
"zip_code": "postal code of the driver's address",
"phone": "telephone number of the driver"
}*/
CREATE TABLE truck
(
truck_id INTEGER
primary key,
make TEXT,
model_year INTEGER
)
/*
1 example row:
SELECT * FROM truck LIMIT 1;
truck_id || make ||model_year
1 ||Peterbilt || 2005
*/
/* column definitions {
"truck_id": "Unique identifier of the truck table",
"make": "The brand of the truck",
"model_year": "The year the truck was manufactured"
}*/
CREATE TABLE shipment
(
ship_id INTEGER
primary key,
cust_id INTEGER,
weight REAL,
truck_id INTEGER,
driver_id INTEGER,
city_id INTEGER,
ship_date TEXT,
foreign key (cust_id) references customer(cust_id),
foreign key (city_id) references city(city_id),
foreign key (driver_id) references driver(driver_id),
foreign key (truck_id) references truck(truck_id)
)
/*
1 example row:
SELECT * FROM shipment LIMIT 1;
ship_id ||cust_id ||weight ||truck_id ||driver_id ||city_id || ship_date
1000 || 3660 ||3528.0 || 1 || 23 || 137 ||2016-01-08
*/
/* column definitions {
"ship_id": "Unique identifier of the shipment",
"cust_id": "A reference to the customer table that indicates which customer the shipment is for",
"weight": "The number of pounds being transported on the shipment",
"truck_id": "A reference to the truck table that indicates which truck is used in the shipment",
"driver_id": "A reference to the driver table that indicates which driver transported the goods in the shipment",
"city_id": "A reference to the city table that indicates the destination of the shipment",
"ship_date": "the date the items were received by the driver"
}*/
|
5,655 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE city
(
city_id INTEGER
primary key,
city_name TEXT,
state TEXT,
population INTEGER,
area REAL
)
/*
1 example row:
SELECT * FROM city LIMIT 1;
city_id || city_name || state ||population ||area
100 ||Union City ||New Jersey || 67088 || 1.3
*/
/* column definitions {
"city_id": "unique identifier for the city",
"city_name": "name of the city",
"state": "state in which the city is",
"population ": "population of the city",
"area": "square miles the city covers"
}*/
CREATE TABLE customer
(
cust_id INTEGER
primary key,
cust_name TEXT,
annual_revenue INTEGER,
cust_type TEXT,
address TEXT,
city TEXT,
state TEXT,
zip REAL,
phone TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
cust_id || cust_name ||annual_revenue || cust_type || address || city ||state || zip || phone
193 ||Advanced Fabricators || 39588651 ||manufacturer ||5141 Summit Boulevard ||West Palm Beach || FL ||33415.0 ||(561) 683-3535
*/
/* column definitions {
"cust_id": "Unique identifier for the customer",
"cust_name": "Business name of the customer",
"annual_revenue": "Annual revenue of the customer",
"cust_type": "Whether the customer is a manufacturer or a wholes",
"address": "Physical street address of the customer",
"city": "City of the customer's address",
"state": "State of the customer's address",
"zip": "Postal code of the customer's address",
"phone": "Telephone number to reach the customer"
}*/
CREATE TABLE driver
(
driver_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
address TEXT,
city TEXT,
state TEXT,
zip_code INTEGER,
phone TEXT
)
/*
1 example row:
SELECT * FROM driver LIMIT 1;
driver_id ||first_name ||last_name || address || city ||state ||zip_code || phone
20 || Sue || Newell ||268 Richmond Ave ||Memphis || TN || 38106 ||(901) 774-6569
*/
/* column definitions {
"driver_id": "Unique identifier for the driver",
"first_name": "First given name of the driver",
"last_name": "Family name of the driver",
"address": "Street address of the driver's home",
"city": "City the driver lives in",
"state": "State the driver lives in",
"zip_code": "postal code of the driver's address",
"phone": "telephone number of the driver"
}*/
CREATE TABLE truck
(
truck_id INTEGER
primary key,
make TEXT,
model_year INTEGER
)
/*
1 example row:
SELECT * FROM truck LIMIT 1;
truck_id || make ||model_year
1 ||Peterbilt || 2005
*/
/* column definitions {
"truck_id": "Unique identifier of the truck table",
"make": "The brand of the truck",
"model_year": "The year the truck was manufactured"
}*/
CREATE TABLE shipment
(
ship_id INTEGER
primary key,
cust_id INTEGER,
weight REAL,
truck_id INTEGER,
driver_id INTEGER,
city_id INTEGER,
ship_date TEXT,
foreign key (cust_id) references customer(cust_id),
foreign key (city_id) references city(city_id),
foreign key (driver_id) references driver(driver_id),
foreign key (truck_id) references truck(truck_id)
)
/*
1 example row:
SELECT * FROM shipment LIMIT 1;
ship_id ||cust_id ||weight ||truck_id ||driver_id ||city_id || ship_date
1000 || 3660 ||3528.0 || 1 || 23 || 137 ||2016-01-08
*/
/* column definitions {
"ship_id": "Unique identifier of the shipment",
"cust_id": "A reference to the customer table that indicates which customer the shipment is for",
"weight": "The number of pounds being transported on the shipment",
"truck_id": "A reference to the truck table that indicates which truck is used in the shipment",
"driver_id": "A reference to the driver table that indicates which driver transported the goods in the shipment",
"city_id": "A reference to the city table that indicates the destination of the shipment",
"ship_date": "the date the items were received by the driver"
}*/
### Question
What is the shipment ID of the heaviest shipment that Zachery Hicks transported?
Clarification: shipment ID refers to ship_id; heaviest shipment refers to Max(weight)
| [query_database(**{'query': 'SELECT T1.ship_id FROM shipment AS T1 INNER JOIN driver AS T2 ON T1.driver_id = T2.driver_id WHERE T2.first_name = 'Zachery' AND T2.last_name = 'Hicks' ORDER BY T1.weight DESC LIMIT 1'})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE city
(
city_id INTEGER
primary key,
city_name TEXT,
state TEXT,
population INTEGER,
area REAL
)
/*
1 example row:
SELECT * FROM city LIMIT 1;
city_id || city_name || state ||population ||area
100 ||Union City ||New Jersey || 67088 || 1.3
*/
/* column definitions {
"city_id": "unique identifier for the city",
"city_name": "name of the city",
"state": "state in which the city is",
"population ": "population of the city",
"area": "square miles the city covers"
}*/
CREATE TABLE customer
(
cust_id INTEGER
primary key,
cust_name TEXT,
annual_revenue INTEGER,
cust_type TEXT,
address TEXT,
city TEXT,
state TEXT,
zip REAL,
phone TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
cust_id || cust_name ||annual_revenue || cust_type || address || city ||state || zip || phone
193 ||Advanced Fabricators || 39588651 ||manufacturer ||5141 Summit Boulevard ||West Palm Beach || FL ||33415.0 ||(561) 683-3535
*/
/* column definitions {
"cust_id": "Unique identifier for the customer",
"cust_name": "Business name of the customer",
"annual_revenue": "Annual revenue of the customer",
"cust_type": "Whether the customer is a manufacturer or a wholes",
"address": "Physical street address of the customer",
"city": "City of the customer's address",
"state": "State of the customer's address",
"zip": "Postal code of the customer's address",
"phone": "Telephone number to reach the customer"
}*/
CREATE TABLE driver
(
driver_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
address TEXT,
city TEXT,
state TEXT,
zip_code INTEGER,
phone TEXT
)
/*
1 example row:
SELECT * FROM driver LIMIT 1;
driver_id ||first_name ||last_name || address || city ||state ||zip_code || phone
20 || Sue || Newell ||268 Richmond Ave ||Memphis || TN || 38106 ||(901) 774-6569
*/
/* column definitions {
"driver_id": "Unique identifier for the driver",
"first_name": "First given name of the driver",
"last_name": "Family name of the driver",
"address": "Street address of the driver's home",
"city": "City the driver lives in",
"state": "State the driver lives in",
"zip_code": "postal code of the driver's address",
"phone": "telephone number of the driver"
}*/
CREATE TABLE truck
(
truck_id INTEGER
primary key,
make TEXT,
model_year INTEGER
)
/*
1 example row:
SELECT * FROM truck LIMIT 1;
truck_id || make ||model_year
1 ||Peterbilt || 2005
*/
/* column definitions {
"truck_id": "Unique identifier of the truck table",
"make": "The brand of the truck",
"model_year": "The year the truck was manufactured"
}*/
CREATE TABLE shipment
(
ship_id INTEGER
primary key,
cust_id INTEGER,
weight REAL,
truck_id INTEGER,
driver_id INTEGER,
city_id INTEGER,
ship_date TEXT,
foreign key (cust_id) references customer(cust_id),
foreign key (city_id) references city(city_id),
foreign key (driver_id) references driver(driver_id),
foreign key (truck_id) references truck(truck_id)
)
/*
1 example row:
SELECT * FROM shipment LIMIT 1;
ship_id ||cust_id ||weight ||truck_id ||driver_id ||city_id || ship_date
1000 || 3660 ||3528.0 || 1 || 23 || 137 ||2016-01-08
*/
/* column definitions {
"ship_id": "Unique identifier of the shipment",
"cust_id": "A reference to the customer table that indicates which customer the shipment is for",
"weight": "The number of pounds being transported on the shipment",
"truck_id": "A reference to the truck table that indicates which truck is used in the shipment",
"driver_id": "A reference to the driver table that indicates which driver transported the goods in the shipment",
"city_id": "A reference to the city table that indicates the destination of the shipment",
"ship_date": "the date the items were received by the driver"
}*/
|
5,659 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE city
(
city_id INTEGER
primary key,
city_name TEXT,
state TEXT,
population INTEGER,
area REAL
)
/*
1 example row:
SELECT * FROM city LIMIT 1;
city_id || city_name || state ||population ||area
100 ||Union City ||New Jersey || 67088 || 1.3
*/
/* column definitions {
"city_id": "unique identifier for the city",
"city_name": "name of the city",
"state": "state in which the city is",
"population ": "population of the city",
"area": "square miles the city covers"
}*/
CREATE TABLE customer
(
cust_id INTEGER
primary key,
cust_name TEXT,
annual_revenue INTEGER,
cust_type TEXT,
address TEXT,
city TEXT,
state TEXT,
zip REAL,
phone TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
cust_id || cust_name ||annual_revenue || cust_type || address || city ||state || zip || phone
193 ||Advanced Fabricators || 39588651 ||manufacturer ||5141 Summit Boulevard ||West Palm Beach || FL ||33415.0 ||(561) 683-3535
*/
/* column definitions {
"cust_id": "Unique identifier for the customer",
"cust_name": "Business name of the customer",
"annual_revenue": "Annual revenue of the customer",
"cust_type": "Whether the customer is a manufacturer or a wholes",
"address": "Physical street address of the customer",
"city": "City of the customer's address",
"state": "State of the customer's address",
"zip": "Postal code of the customer's address",
"phone": "Telephone number to reach the customer"
}*/
CREATE TABLE driver
(
driver_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
address TEXT,
city TEXT,
state TEXT,
zip_code INTEGER,
phone TEXT
)
/*
1 example row:
SELECT * FROM driver LIMIT 1;
driver_id ||first_name ||last_name || address || city ||state ||zip_code || phone
20 || Sue || Newell ||268 Richmond Ave ||Memphis || TN || 38106 ||(901) 774-6569
*/
/* column definitions {
"driver_id": "Unique identifier for the driver",
"first_name": "First given name of the driver",
"last_name": "Family name of the driver",
"address": "Street address of the driver's home",
"city": "City the driver lives in",
"state": "State the driver lives in",
"zip_code": "postal code of the driver's address",
"phone": "telephone number of the driver"
}*/
CREATE TABLE truck
(
truck_id INTEGER
primary key,
make TEXT,
model_year INTEGER
)
/*
1 example row:
SELECT * FROM truck LIMIT 1;
truck_id || make ||model_year
1 ||Peterbilt || 2005
*/
/* column definitions {
"truck_id": "Unique identifier of the truck table",
"make": "The brand of the truck",
"model_year": "The year the truck was manufactured"
}*/
CREATE TABLE shipment
(
ship_id INTEGER
primary key,
cust_id INTEGER,
weight REAL,
truck_id INTEGER,
driver_id INTEGER,
city_id INTEGER,
ship_date TEXT,
foreign key (cust_id) references customer(cust_id),
foreign key (city_id) references city(city_id),
foreign key (driver_id) references driver(driver_id),
foreign key (truck_id) references truck(truck_id)
)
/*
1 example row:
SELECT * FROM shipment LIMIT 1;
ship_id ||cust_id ||weight ||truck_id ||driver_id ||city_id || ship_date
1000 || 3660 ||3528.0 || 1 || 23 || 137 ||2016-01-08
*/
/* column definitions {
"ship_id": "Unique identifier of the shipment",
"cust_id": "A reference to the customer table that indicates which customer the shipment is for",
"weight": "The number of pounds being transported on the shipment",
"truck_id": "A reference to the truck table that indicates which truck is used in the shipment",
"driver_id": "A reference to the driver table that indicates which driver transported the goods in the shipment",
"city_id": "A reference to the city table that indicates the destination of the shipment",
"ship_date": "the date the items were received by the driver"
}*/
### Question
In which city did the heaviest shipment transported?
Clarification: heaviest shipment refers to Max(weight); city refers to city_name
| [query_database(**{'query': 'SELECT T2.city_name FROM shipment AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id ORDER BY T1.weight DESC LIMIT 1'})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE city
(
city_id INTEGER
primary key,
city_name TEXT,
state TEXT,
population INTEGER,
area REAL
)
/*
1 example row:
SELECT * FROM city LIMIT 1;
city_id || city_name || state ||population ||area
100 ||Union City ||New Jersey || 67088 || 1.3
*/
/* column definitions {
"city_id": "unique identifier for the city",
"city_name": "name of the city",
"state": "state in which the city is",
"population ": "population of the city",
"area": "square miles the city covers"
}*/
CREATE TABLE customer
(
cust_id INTEGER
primary key,
cust_name TEXT,
annual_revenue INTEGER,
cust_type TEXT,
address TEXT,
city TEXT,
state TEXT,
zip REAL,
phone TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
cust_id || cust_name ||annual_revenue || cust_type || address || city ||state || zip || phone
193 ||Advanced Fabricators || 39588651 ||manufacturer ||5141 Summit Boulevard ||West Palm Beach || FL ||33415.0 ||(561) 683-3535
*/
/* column definitions {
"cust_id": "Unique identifier for the customer",
"cust_name": "Business name of the customer",
"annual_revenue": "Annual revenue of the customer",
"cust_type": "Whether the customer is a manufacturer or a wholes",
"address": "Physical street address of the customer",
"city": "City of the customer's address",
"state": "State of the customer's address",
"zip": "Postal code of the customer's address",
"phone": "Telephone number to reach the customer"
}*/
CREATE TABLE driver
(
driver_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
address TEXT,
city TEXT,
state TEXT,
zip_code INTEGER,
phone TEXT
)
/*
1 example row:
SELECT * FROM driver LIMIT 1;
driver_id ||first_name ||last_name || address || city ||state ||zip_code || phone
20 || Sue || Newell ||268 Richmond Ave ||Memphis || TN || 38106 ||(901) 774-6569
*/
/* column definitions {
"driver_id": "Unique identifier for the driver",
"first_name": "First given name of the driver",
"last_name": "Family name of the driver",
"address": "Street address of the driver's home",
"city": "City the driver lives in",
"state": "State the driver lives in",
"zip_code": "postal code of the driver's address",
"phone": "telephone number of the driver"
}*/
CREATE TABLE truck
(
truck_id INTEGER
primary key,
make TEXT,
model_year INTEGER
)
/*
1 example row:
SELECT * FROM truck LIMIT 1;
truck_id || make ||model_year
1 ||Peterbilt || 2005
*/
/* column definitions {
"truck_id": "Unique identifier of the truck table",
"make": "The brand of the truck",
"model_year": "The year the truck was manufactured"
}*/
CREATE TABLE shipment
(
ship_id INTEGER
primary key,
cust_id INTEGER,
weight REAL,
truck_id INTEGER,
driver_id INTEGER,
city_id INTEGER,
ship_date TEXT,
foreign key (cust_id) references customer(cust_id),
foreign key (city_id) references city(city_id),
foreign key (driver_id) references driver(driver_id),
foreign key (truck_id) references truck(truck_id)
)
/*
1 example row:
SELECT * FROM shipment LIMIT 1;
ship_id ||cust_id ||weight ||truck_id ||driver_id ||city_id || ship_date
1000 || 3660 ||3528.0 || 1 || 23 || 137 ||2016-01-08
*/
/* column definitions {
"ship_id": "Unique identifier of the shipment",
"cust_id": "A reference to the customer table that indicates which customer the shipment is for",
"weight": "The number of pounds being transported on the shipment",
"truck_id": "A reference to the truck table that indicates which truck is used in the shipment",
"driver_id": "A reference to the driver table that indicates which driver transported the goods in the shipment",
"city_id": "A reference to the city table that indicates the destination of the shipment",
"ship_date": "the date the items were received by the driver"
}*/
|
5,663 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE city
(
city_id INTEGER
primary key,
city_name TEXT,
state TEXT,
population INTEGER,
area REAL
)
/*
1 example row:
SELECT * FROM city LIMIT 1;
city_id || city_name || state ||population ||area
100 ||Union City ||New Jersey || 67088 || 1.3
*/
/* column definitions {
"city_id": "unique identifier for the city",
"city_name": "name of the city",
"state": "state in which the city is",
"population ": "population of the city",
"area": "square miles the city covers"
}*/
CREATE TABLE customer
(
cust_id INTEGER
primary key,
cust_name TEXT,
annual_revenue INTEGER,
cust_type TEXT,
address TEXT,
city TEXT,
state TEXT,
zip REAL,
phone TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
cust_id || cust_name ||annual_revenue || cust_type || address || city ||state || zip || phone
193 ||Advanced Fabricators || 39588651 ||manufacturer ||5141 Summit Boulevard ||West Palm Beach || FL ||33415.0 ||(561) 683-3535
*/
/* column definitions {
"cust_id": "Unique identifier for the customer",
"cust_name": "Business name of the customer",
"annual_revenue": "Annual revenue of the customer",
"cust_type": "Whether the customer is a manufacturer or a wholes",
"address": "Physical street address of the customer",
"city": "City of the customer's address",
"state": "State of the customer's address",
"zip": "Postal code of the customer's address",
"phone": "Telephone number to reach the customer"
}*/
CREATE TABLE driver
(
driver_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
address TEXT,
city TEXT,
state TEXT,
zip_code INTEGER,
phone TEXT
)
/*
1 example row:
SELECT * FROM driver LIMIT 1;
driver_id ||first_name ||last_name || address || city ||state ||zip_code || phone
20 || Sue || Newell ||268 Richmond Ave ||Memphis || TN || 38106 ||(901) 774-6569
*/
/* column definitions {
"driver_id": "Unique identifier for the driver",
"first_name": "First given name of the driver",
"last_name": "Family name of the driver",
"address": "Street address of the driver's home",
"city": "City the driver lives in",
"state": "State the driver lives in",
"zip_code": "postal code of the driver's address",
"phone": "telephone number of the driver"
}*/
CREATE TABLE truck
(
truck_id INTEGER
primary key,
make TEXT,
model_year INTEGER
)
/*
1 example row:
SELECT * FROM truck LIMIT 1;
truck_id || make ||model_year
1 ||Peterbilt || 2005
*/
/* column definitions {
"truck_id": "Unique identifier of the truck table",
"make": "The brand of the truck",
"model_year": "The year the truck was manufactured"
}*/
CREATE TABLE shipment
(
ship_id INTEGER
primary key,
cust_id INTEGER,
weight REAL,
truck_id INTEGER,
driver_id INTEGER,
city_id INTEGER,
ship_date TEXT,
foreign key (cust_id) references customer(cust_id),
foreign key (city_id) references city(city_id),
foreign key (driver_id) references driver(driver_id),
foreign key (truck_id) references truck(truck_id)
)
/*
1 example row:
SELECT * FROM shipment LIMIT 1;
ship_id ||cust_id ||weight ||truck_id ||driver_id ||city_id || ship_date
1000 || 3660 ||3528.0 || 1 || 23 || 137 ||2016-01-08
*/
/* column definitions {
"ship_id": "Unique identifier of the shipment",
"cust_id": "A reference to the customer table that indicates which customer the shipment is for",
"weight": "The number of pounds being transported on the shipment",
"truck_id": "A reference to the truck table that indicates which truck is used in the shipment",
"driver_id": "A reference to the driver table that indicates which driver transported the goods in the shipment",
"city_id": "A reference to the city table that indicates the destination of the shipment",
"ship_date": "the date the items were received by the driver"
}*/
### Question
How many shipments were shipped by the driver named Zachary Hicks?
Clarification:
| [query_database(**{'query': 'SELECT COUNT(*) FROM shipment AS T1 INNER JOIN driver AS T2 ON T1.driver_id = T2.driver_id WHERE T1.driver_id = 23'})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE city
(
city_id INTEGER
primary key,
city_name TEXT,
state TEXT,
population INTEGER,
area REAL
)
/*
1 example row:
SELECT * FROM city LIMIT 1;
city_id || city_name || state ||population ||area
100 ||Union City ||New Jersey || 67088 || 1.3
*/
/* column definitions {
"city_id": "unique identifier for the city",
"city_name": "name of the city",
"state": "state in which the city is",
"population ": "population of the city",
"area": "square miles the city covers"
}*/
CREATE TABLE customer
(
cust_id INTEGER
primary key,
cust_name TEXT,
annual_revenue INTEGER,
cust_type TEXT,
address TEXT,
city TEXT,
state TEXT,
zip REAL,
phone TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
cust_id || cust_name ||annual_revenue || cust_type || address || city ||state || zip || phone
193 ||Advanced Fabricators || 39588651 ||manufacturer ||5141 Summit Boulevard ||West Palm Beach || FL ||33415.0 ||(561) 683-3535
*/
/* column definitions {
"cust_id": "Unique identifier for the customer",
"cust_name": "Business name of the customer",
"annual_revenue": "Annual revenue of the customer",
"cust_type": "Whether the customer is a manufacturer or a wholes",
"address": "Physical street address of the customer",
"city": "City of the customer's address",
"state": "State of the customer's address",
"zip": "Postal code of the customer's address",
"phone": "Telephone number to reach the customer"
}*/
CREATE TABLE driver
(
driver_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
address TEXT,
city TEXT,
state TEXT,
zip_code INTEGER,
phone TEXT
)
/*
1 example row:
SELECT * FROM driver LIMIT 1;
driver_id ||first_name ||last_name || address || city ||state ||zip_code || phone
20 || Sue || Newell ||268 Richmond Ave ||Memphis || TN || 38106 ||(901) 774-6569
*/
/* column definitions {
"driver_id": "Unique identifier for the driver",
"first_name": "First given name of the driver",
"last_name": "Family name of the driver",
"address": "Street address of the driver's home",
"city": "City the driver lives in",
"state": "State the driver lives in",
"zip_code": "postal code of the driver's address",
"phone": "telephone number of the driver"
}*/
CREATE TABLE truck
(
truck_id INTEGER
primary key,
make TEXT,
model_year INTEGER
)
/*
1 example row:
SELECT * FROM truck LIMIT 1;
truck_id || make ||model_year
1 ||Peterbilt || 2005
*/
/* column definitions {
"truck_id": "Unique identifier of the truck table",
"make": "The brand of the truck",
"model_year": "The year the truck was manufactured"
}*/
CREATE TABLE shipment
(
ship_id INTEGER
primary key,
cust_id INTEGER,
weight REAL,
truck_id INTEGER,
driver_id INTEGER,
city_id INTEGER,
ship_date TEXT,
foreign key (cust_id) references customer(cust_id),
foreign key (city_id) references city(city_id),
foreign key (driver_id) references driver(driver_id),
foreign key (truck_id) references truck(truck_id)
)
/*
1 example row:
SELECT * FROM shipment LIMIT 1;
ship_id ||cust_id ||weight ||truck_id ||driver_id ||city_id || ship_date
1000 || 3660 ||3528.0 || 1 || 23 || 137 ||2016-01-08
*/
/* column definitions {
"ship_id": "Unique identifier of the shipment",
"cust_id": "A reference to the customer table that indicates which customer the shipment is for",
"weight": "The number of pounds being transported on the shipment",
"truck_id": "A reference to the truck table that indicates which truck is used in the shipment",
"driver_id": "A reference to the driver table that indicates which driver transported the goods in the shipment",
"city_id": "A reference to the city table that indicates the destination of the shipment",
"ship_date": "the date the items were received by the driver"
}*/
|
5,667 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE city
(
city_id INTEGER
primary key,
city_name TEXT,
state TEXT,
population INTEGER,
area REAL
)
/*
1 example row:
SELECT * FROM city LIMIT 1;
city_id || city_name || state ||population ||area
100 ||Union City ||New Jersey || 67088 || 1.3
*/
/* column definitions {
"city_id": "unique identifier for the city",
"city_name": "name of the city",
"state": "state in which the city is",
"population ": "population of the city",
"area": "square miles the city covers"
}*/
CREATE TABLE customer
(
cust_id INTEGER
primary key,
cust_name TEXT,
annual_revenue INTEGER,
cust_type TEXT,
address TEXT,
city TEXT,
state TEXT,
zip REAL,
phone TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
cust_id || cust_name ||annual_revenue || cust_type || address || city ||state || zip || phone
193 ||Advanced Fabricators || 39588651 ||manufacturer ||5141 Summit Boulevard ||West Palm Beach || FL ||33415.0 ||(561) 683-3535
*/
/* column definitions {
"cust_id": "Unique identifier for the customer",
"cust_name": "Business name of the customer",
"annual_revenue": "Annual revenue of the customer",
"cust_type": "Whether the customer is a manufacturer or a wholes",
"address": "Physical street address of the customer",
"city": "City of the customer's address",
"state": "State of the customer's address",
"zip": "Postal code of the customer's address",
"phone": "Telephone number to reach the customer"
}*/
CREATE TABLE driver
(
driver_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
address TEXT,
city TEXT,
state TEXT,
zip_code INTEGER,
phone TEXT
)
/*
1 example row:
SELECT * FROM driver LIMIT 1;
driver_id ||first_name ||last_name || address || city ||state ||zip_code || phone
20 || Sue || Newell ||268 Richmond Ave ||Memphis || TN || 38106 ||(901) 774-6569
*/
/* column definitions {
"driver_id": "Unique identifier for the driver",
"first_name": "First given name of the driver",
"last_name": "Family name of the driver",
"address": "Street address of the driver's home",
"city": "City the driver lives in",
"state": "State the driver lives in",
"zip_code": "postal code of the driver's address",
"phone": "telephone number of the driver"
}*/
CREATE TABLE truck
(
truck_id INTEGER
primary key,
make TEXT,
model_year INTEGER
)
/*
1 example row:
SELECT * FROM truck LIMIT 1;
truck_id || make ||model_year
1 ||Peterbilt || 2005
*/
/* column definitions {
"truck_id": "Unique identifier of the truck table",
"make": "The brand of the truck",
"model_year": "The year the truck was manufactured"
}*/
CREATE TABLE shipment
(
ship_id INTEGER
primary key,
cust_id INTEGER,
weight REAL,
truck_id INTEGER,
driver_id INTEGER,
city_id INTEGER,
ship_date TEXT,
foreign key (cust_id) references customer(cust_id),
foreign key (city_id) references city(city_id),
foreign key (driver_id) references driver(driver_id),
foreign key (truck_id) references truck(truck_id)
)
/*
1 example row:
SELECT * FROM shipment LIMIT 1;
ship_id ||cust_id ||weight ||truck_id ||driver_id ||city_id || ship_date
1000 || 3660 ||3528.0 || 1 || 23 || 137 ||2016-01-08
*/
/* column definitions {
"ship_id": "Unique identifier of the shipment",
"cust_id": "A reference to the customer table that indicates which customer the shipment is for",
"weight": "The number of pounds being transported on the shipment",
"truck_id": "A reference to the truck table that indicates which truck is used in the shipment",
"driver_id": "A reference to the driver table that indicates which driver transported the goods in the shipment",
"city_id": "A reference to the city table that indicates the destination of the shipment",
"ship_date": "the date the items were received by the driver"
}*/
### Question
What model year of truck delivered the ship ID 1233?
Clarification:
| [query_database(**{'query': 'SELECT T1.model_year FROM truck AS T1 INNER JOIN shipment AS T2 ON T1.truck_id = T2.truck_id WHERE T2.ship_id = '1233''})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE city
(
city_id INTEGER
primary key,
city_name TEXT,
state TEXT,
population INTEGER,
area REAL
)
/*
1 example row:
SELECT * FROM city LIMIT 1;
city_id || city_name || state ||population ||area
100 ||Union City ||New Jersey || 67088 || 1.3
*/
/* column definitions {
"city_id": "unique identifier for the city",
"city_name": "name of the city",
"state": "state in which the city is",
"population ": "population of the city",
"area": "square miles the city covers"
}*/
CREATE TABLE customer
(
cust_id INTEGER
primary key,
cust_name TEXT,
annual_revenue INTEGER,
cust_type TEXT,
address TEXT,
city TEXT,
state TEXT,
zip REAL,
phone TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
cust_id || cust_name ||annual_revenue || cust_type || address || city ||state || zip || phone
193 ||Advanced Fabricators || 39588651 ||manufacturer ||5141 Summit Boulevard ||West Palm Beach || FL ||33415.0 ||(561) 683-3535
*/
/* column definitions {
"cust_id": "Unique identifier for the customer",
"cust_name": "Business name of the customer",
"annual_revenue": "Annual revenue of the customer",
"cust_type": "Whether the customer is a manufacturer or a wholes",
"address": "Physical street address of the customer",
"city": "City of the customer's address",
"state": "State of the customer's address",
"zip": "Postal code of the customer's address",
"phone": "Telephone number to reach the customer"
}*/
CREATE TABLE driver
(
driver_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
address TEXT,
city TEXT,
state TEXT,
zip_code INTEGER,
phone TEXT
)
/*
1 example row:
SELECT * FROM driver LIMIT 1;
driver_id ||first_name ||last_name || address || city ||state ||zip_code || phone
20 || Sue || Newell ||268 Richmond Ave ||Memphis || TN || 38106 ||(901) 774-6569
*/
/* column definitions {
"driver_id": "Unique identifier for the driver",
"first_name": "First given name of the driver",
"last_name": "Family name of the driver",
"address": "Street address of the driver's home",
"city": "City the driver lives in",
"state": "State the driver lives in",
"zip_code": "postal code of the driver's address",
"phone": "telephone number of the driver"
}*/
CREATE TABLE truck
(
truck_id INTEGER
primary key,
make TEXT,
model_year INTEGER
)
/*
1 example row:
SELECT * FROM truck LIMIT 1;
truck_id || make ||model_year
1 ||Peterbilt || 2005
*/
/* column definitions {
"truck_id": "Unique identifier of the truck table",
"make": "The brand of the truck",
"model_year": "The year the truck was manufactured"
}*/
CREATE TABLE shipment
(
ship_id INTEGER
primary key,
cust_id INTEGER,
weight REAL,
truck_id INTEGER,
driver_id INTEGER,
city_id INTEGER,
ship_date TEXT,
foreign key (cust_id) references customer(cust_id),
foreign key (city_id) references city(city_id),
foreign key (driver_id) references driver(driver_id),
foreign key (truck_id) references truck(truck_id)
)
/*
1 example row:
SELECT * FROM shipment LIMIT 1;
ship_id ||cust_id ||weight ||truck_id ||driver_id ||city_id || ship_date
1000 || 3660 ||3528.0 || 1 || 23 || 137 ||2016-01-08
*/
/* column definitions {
"ship_id": "Unique identifier of the shipment",
"cust_id": "A reference to the customer table that indicates which customer the shipment is for",
"weight": "The number of pounds being transported on the shipment",
"truck_id": "A reference to the truck table that indicates which truck is used in the shipment",
"driver_id": "A reference to the driver table that indicates which driver transported the goods in the shipment",
"city_id": "A reference to the city table that indicates the destination of the shipment",
"ship_date": "the date the items were received by the driver"
}*/
|
5,671 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE city
(
city_id INTEGER
primary key,
city_name TEXT,
state TEXT,
population INTEGER,
area REAL
)
/*
1 example row:
SELECT * FROM city LIMIT 1;
city_id || city_name || state ||population ||area
100 ||Union City ||New Jersey || 67088 || 1.3
*/
/* column definitions {
"city_id": "unique identifier for the city",
"city_name": "name of the city",
"state": "state in which the city is",
"population ": "population of the city",
"area": "square miles the city covers"
}*/
CREATE TABLE customer
(
cust_id INTEGER
primary key,
cust_name TEXT,
annual_revenue INTEGER,
cust_type TEXT,
address TEXT,
city TEXT,
state TEXT,
zip REAL,
phone TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
cust_id || cust_name ||annual_revenue || cust_type || address || city ||state || zip || phone
193 ||Advanced Fabricators || 39588651 ||manufacturer ||5141 Summit Boulevard ||West Palm Beach || FL ||33415.0 ||(561) 683-3535
*/
/* column definitions {
"cust_id": "Unique identifier for the customer",
"cust_name": "Business name of the customer",
"annual_revenue": "Annual revenue of the customer",
"cust_type": "Whether the customer is a manufacturer or a wholes",
"address": "Physical street address of the customer",
"city": "City of the customer's address",
"state": "State of the customer's address",
"zip": "Postal code of the customer's address",
"phone": "Telephone number to reach the customer"
}*/
CREATE TABLE driver
(
driver_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
address TEXT,
city TEXT,
state TEXT,
zip_code INTEGER,
phone TEXT
)
/*
1 example row:
SELECT * FROM driver LIMIT 1;
driver_id ||first_name ||last_name || address || city ||state ||zip_code || phone
20 || Sue || Newell ||268 Richmond Ave ||Memphis || TN || 38106 ||(901) 774-6569
*/
/* column definitions {
"driver_id": "Unique identifier for the driver",
"first_name": "First given name of the driver",
"last_name": "Family name of the driver",
"address": "Street address of the driver's home",
"city": "City the driver lives in",
"state": "State the driver lives in",
"zip_code": "postal code of the driver's address",
"phone": "telephone number of the driver"
}*/
CREATE TABLE truck
(
truck_id INTEGER
primary key,
make TEXT,
model_year INTEGER
)
/*
1 example row:
SELECT * FROM truck LIMIT 1;
truck_id || make ||model_year
1 ||Peterbilt || 2005
*/
/* column definitions {
"truck_id": "Unique identifier of the truck table",
"make": "The brand of the truck",
"model_year": "The year the truck was manufactured"
}*/
CREATE TABLE shipment
(
ship_id INTEGER
primary key,
cust_id INTEGER,
weight REAL,
truck_id INTEGER,
driver_id INTEGER,
city_id INTEGER,
ship_date TEXT,
foreign key (cust_id) references customer(cust_id),
foreign key (city_id) references city(city_id),
foreign key (driver_id) references driver(driver_id),
foreign key (truck_id) references truck(truck_id)
)
/*
1 example row:
SELECT * FROM shipment LIMIT 1;
ship_id ||cust_id ||weight ||truck_id ||driver_id ||city_id || ship_date
1000 || 3660 ||3528.0 || 1 || 23 || 137 ||2016-01-08
*/
/* column definitions {
"ship_id": "Unique identifier of the shipment",
"cust_id": "A reference to the customer table that indicates which customer the shipment is for",
"weight": "The number of pounds being transported on the shipment",
"truck_id": "A reference to the truck table that indicates which truck is used in the shipment",
"driver_id": "A reference to the driver table that indicates which driver transported the goods in the shipment",
"city_id": "A reference to the city table that indicates the destination of the shipment",
"ship_date": "the date the items were received by the driver"
}*/
### Question
Where does the driver of ship ID 1127 live?
Clarification: live refers to address
| [query_database(**{'query': 'SELECT T2.address FROM shipment AS T1 INNER JOIN driver AS T2 ON T1.driver_id = T2.driver_id WHERE T1.ship_id = '1127''})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE city
(
city_id INTEGER
primary key,
city_name TEXT,
state TEXT,
population INTEGER,
area REAL
)
/*
1 example row:
SELECT * FROM city LIMIT 1;
city_id || city_name || state ||population ||area
100 ||Union City ||New Jersey || 67088 || 1.3
*/
/* column definitions {
"city_id": "unique identifier for the city",
"city_name": "name of the city",
"state": "state in which the city is",
"population ": "population of the city",
"area": "square miles the city covers"
}*/
CREATE TABLE customer
(
cust_id INTEGER
primary key,
cust_name TEXT,
annual_revenue INTEGER,
cust_type TEXT,
address TEXT,
city TEXT,
state TEXT,
zip REAL,
phone TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
cust_id || cust_name ||annual_revenue || cust_type || address || city ||state || zip || phone
193 ||Advanced Fabricators || 39588651 ||manufacturer ||5141 Summit Boulevard ||West Palm Beach || FL ||33415.0 ||(561) 683-3535
*/
/* column definitions {
"cust_id": "Unique identifier for the customer",
"cust_name": "Business name of the customer",
"annual_revenue": "Annual revenue of the customer",
"cust_type": "Whether the customer is a manufacturer or a wholes",
"address": "Physical street address of the customer",
"city": "City of the customer's address",
"state": "State of the customer's address",
"zip": "Postal code of the customer's address",
"phone": "Telephone number to reach the customer"
}*/
CREATE TABLE driver
(
driver_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
address TEXT,
city TEXT,
state TEXT,
zip_code INTEGER,
phone TEXT
)
/*
1 example row:
SELECT * FROM driver LIMIT 1;
driver_id ||first_name ||last_name || address || city ||state ||zip_code || phone
20 || Sue || Newell ||268 Richmond Ave ||Memphis || TN || 38106 ||(901) 774-6569
*/
/* column definitions {
"driver_id": "Unique identifier for the driver",
"first_name": "First given name of the driver",
"last_name": "Family name of the driver",
"address": "Street address of the driver's home",
"city": "City the driver lives in",
"state": "State the driver lives in",
"zip_code": "postal code of the driver's address",
"phone": "telephone number of the driver"
}*/
CREATE TABLE truck
(
truck_id INTEGER
primary key,
make TEXT,
model_year INTEGER
)
/*
1 example row:
SELECT * FROM truck LIMIT 1;
truck_id || make ||model_year
1 ||Peterbilt || 2005
*/
/* column definitions {
"truck_id": "Unique identifier of the truck table",
"make": "The brand of the truck",
"model_year": "The year the truck was manufactured"
}*/
CREATE TABLE shipment
(
ship_id INTEGER
primary key,
cust_id INTEGER,
weight REAL,
truck_id INTEGER,
driver_id INTEGER,
city_id INTEGER,
ship_date TEXT,
foreign key (cust_id) references customer(cust_id),
foreign key (city_id) references city(city_id),
foreign key (driver_id) references driver(driver_id),
foreign key (truck_id) references truck(truck_id)
)
/*
1 example row:
SELECT * FROM shipment LIMIT 1;
ship_id ||cust_id ||weight ||truck_id ||driver_id ||city_id || ship_date
1000 || 3660 ||3528.0 || 1 || 23 || 137 ||2016-01-08
*/
/* column definitions {
"ship_id": "Unique identifier of the shipment",
"cust_id": "A reference to the customer table that indicates which customer the shipment is for",
"weight": "The number of pounds being transported on the shipment",
"truck_id": "A reference to the truck table that indicates which truck is used in the shipment",
"driver_id": "A reference to the driver table that indicates which driver transported the goods in the shipment",
"city_id": "A reference to the city table that indicates the destination of the shipment",
"ship_date": "the date the items were received by the driver"
}*/
|
5,675 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE city
(
city_id INTEGER
primary key,
city_name TEXT,
state TEXT,
population INTEGER,
area REAL
)
/*
1 example row:
SELECT * FROM city LIMIT 1;
city_id || city_name || state ||population ||area
100 ||Union City ||New Jersey || 67088 || 1.3
*/
/* column definitions {
"city_id": "unique identifier for the city",
"city_name": "name of the city",
"state": "state in which the city is",
"population ": "population of the city",
"area": "square miles the city covers"
}*/
CREATE TABLE customer
(
cust_id INTEGER
primary key,
cust_name TEXT,
annual_revenue INTEGER,
cust_type TEXT,
address TEXT,
city TEXT,
state TEXT,
zip REAL,
phone TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
cust_id || cust_name ||annual_revenue || cust_type || address || city ||state || zip || phone
193 ||Advanced Fabricators || 39588651 ||manufacturer ||5141 Summit Boulevard ||West Palm Beach || FL ||33415.0 ||(561) 683-3535
*/
/* column definitions {
"cust_id": "Unique identifier for the customer",
"cust_name": "Business name of the customer",
"annual_revenue": "Annual revenue of the customer",
"cust_type": "Whether the customer is a manufacturer or a wholes",
"address": "Physical street address of the customer",
"city": "City of the customer's address",
"state": "State of the customer's address",
"zip": "Postal code of the customer's address",
"phone": "Telephone number to reach the customer"
}*/
CREATE TABLE driver
(
driver_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
address TEXT,
city TEXT,
state TEXT,
zip_code INTEGER,
phone TEXT
)
/*
1 example row:
SELECT * FROM driver LIMIT 1;
driver_id ||first_name ||last_name || address || city ||state ||zip_code || phone
20 || Sue || Newell ||268 Richmond Ave ||Memphis || TN || 38106 ||(901) 774-6569
*/
/* column definitions {
"driver_id": "Unique identifier for the driver",
"first_name": "First given name of the driver",
"last_name": "Family name of the driver",
"address": "Street address of the driver's home",
"city": "City the driver lives in",
"state": "State the driver lives in",
"zip_code": "postal code of the driver's address",
"phone": "telephone number of the driver"
}*/
CREATE TABLE truck
(
truck_id INTEGER
primary key,
make TEXT,
model_year INTEGER
)
/*
1 example row:
SELECT * FROM truck LIMIT 1;
truck_id || make ||model_year
1 ||Peterbilt || 2005
*/
/* column definitions {
"truck_id": "Unique identifier of the truck table",
"make": "The brand of the truck",
"model_year": "The year the truck was manufactured"
}*/
CREATE TABLE shipment
(
ship_id INTEGER
primary key,
cust_id INTEGER,
weight REAL,
truck_id INTEGER,
driver_id INTEGER,
city_id INTEGER,
ship_date TEXT,
foreign key (cust_id) references customer(cust_id),
foreign key (city_id) references city(city_id),
foreign key (driver_id) references driver(driver_id),
foreign key (truck_id) references truck(truck_id)
)
/*
1 example row:
SELECT * FROM shipment LIMIT 1;
ship_id ||cust_id ||weight ||truck_id ||driver_id ||city_id || ship_date
1000 || 3660 ||3528.0 || 1 || 23 || 137 ||2016-01-08
*/
/* column definitions {
"ship_id": "Unique identifier of the shipment",
"cust_id": "A reference to the customer table that indicates which customer the shipment is for",
"weight": "The number of pounds being transported on the shipment",
"truck_id": "A reference to the truck table that indicates which truck is used in the shipment",
"driver_id": "A reference to the driver table that indicates which driver transported the goods in the shipment",
"city_id": "A reference to the city table that indicates the destination of the shipment",
"ship_date": "the date the items were received by the driver"
}*/
### Question
How many shipments were delivered to a customer from New York?
Clarification: "New York" refers to state = 'NY'
| [query_database(**{'query': 'SELECT COUNT(*) FROM shipment AS T1 INNER JOIN customer AS T2 ON T1.cust_id = T2.cust_id WHERE T2.state = 'NY''})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE city
(
city_id INTEGER
primary key,
city_name TEXT,
state TEXT,
population INTEGER,
area REAL
)
/*
1 example row:
SELECT * FROM city LIMIT 1;
city_id || city_name || state ||population ||area
100 ||Union City ||New Jersey || 67088 || 1.3
*/
/* column definitions {
"city_id": "unique identifier for the city",
"city_name": "name of the city",
"state": "state in which the city is",
"population ": "population of the city",
"area": "square miles the city covers"
}*/
CREATE TABLE customer
(
cust_id INTEGER
primary key,
cust_name TEXT,
annual_revenue INTEGER,
cust_type TEXT,
address TEXT,
city TEXT,
state TEXT,
zip REAL,
phone TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
cust_id || cust_name ||annual_revenue || cust_type || address || city ||state || zip || phone
193 ||Advanced Fabricators || 39588651 ||manufacturer ||5141 Summit Boulevard ||West Palm Beach || FL ||33415.0 ||(561) 683-3535
*/
/* column definitions {
"cust_id": "Unique identifier for the customer",
"cust_name": "Business name of the customer",
"annual_revenue": "Annual revenue of the customer",
"cust_type": "Whether the customer is a manufacturer or a wholes",
"address": "Physical street address of the customer",
"city": "City of the customer's address",
"state": "State of the customer's address",
"zip": "Postal code of the customer's address",
"phone": "Telephone number to reach the customer"
}*/
CREATE TABLE driver
(
driver_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
address TEXT,
city TEXT,
state TEXT,
zip_code INTEGER,
phone TEXT
)
/*
1 example row:
SELECT * FROM driver LIMIT 1;
driver_id ||first_name ||last_name || address || city ||state ||zip_code || phone
20 || Sue || Newell ||268 Richmond Ave ||Memphis || TN || 38106 ||(901) 774-6569
*/
/* column definitions {
"driver_id": "Unique identifier for the driver",
"first_name": "First given name of the driver",
"last_name": "Family name of the driver",
"address": "Street address of the driver's home",
"city": "City the driver lives in",
"state": "State the driver lives in",
"zip_code": "postal code of the driver's address",
"phone": "telephone number of the driver"
}*/
CREATE TABLE truck
(
truck_id INTEGER
primary key,
make TEXT,
model_year INTEGER
)
/*
1 example row:
SELECT * FROM truck LIMIT 1;
truck_id || make ||model_year
1 ||Peterbilt || 2005
*/
/* column definitions {
"truck_id": "Unique identifier of the truck table",
"make": "The brand of the truck",
"model_year": "The year the truck was manufactured"
}*/
CREATE TABLE shipment
(
ship_id INTEGER
primary key,
cust_id INTEGER,
weight REAL,
truck_id INTEGER,
driver_id INTEGER,
city_id INTEGER,
ship_date TEXT,
foreign key (cust_id) references customer(cust_id),
foreign key (city_id) references city(city_id),
foreign key (driver_id) references driver(driver_id),
foreign key (truck_id) references truck(truck_id)
)
/*
1 example row:
SELECT * FROM shipment LIMIT 1;
ship_id ||cust_id ||weight ||truck_id ||driver_id ||city_id || ship_date
1000 || 3660 ||3528.0 || 1 || 23 || 137 ||2016-01-08
*/
/* column definitions {
"ship_id": "Unique identifier of the shipment",
"cust_id": "A reference to the customer table that indicates which customer the shipment is for",
"weight": "The number of pounds being transported on the shipment",
"truck_id": "A reference to the truck table that indicates which truck is used in the shipment",
"driver_id": "A reference to the driver table that indicates which driver transported the goods in the shipment",
"city_id": "A reference to the city table that indicates the destination of the shipment",
"ship_date": "the date the items were received by the driver"
}*/
|
5,679 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE city
(
city_id INTEGER
primary key,
city_name TEXT,
state TEXT,
population INTEGER,
area REAL
)
/*
1 example row:
SELECT * FROM city LIMIT 1;
city_id || city_name || state ||population ||area
100 ||Union City ||New Jersey || 67088 || 1.3
*/
/* column definitions {
"city_id": "unique identifier for the city",
"city_name": "name of the city",
"state": "state in which the city is",
"population ": "population of the city",
"area": "square miles the city covers"
}*/
CREATE TABLE customer
(
cust_id INTEGER
primary key,
cust_name TEXT,
annual_revenue INTEGER,
cust_type TEXT,
address TEXT,
city TEXT,
state TEXT,
zip REAL,
phone TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
cust_id || cust_name ||annual_revenue || cust_type || address || city ||state || zip || phone
193 ||Advanced Fabricators || 39588651 ||manufacturer ||5141 Summit Boulevard ||West Palm Beach || FL ||33415.0 ||(561) 683-3535
*/
/* column definitions {
"cust_id": "Unique identifier for the customer",
"cust_name": "Business name of the customer",
"annual_revenue": "Annual revenue of the customer",
"cust_type": "Whether the customer is a manufacturer or a wholes",
"address": "Physical street address of the customer",
"city": "City of the customer's address",
"state": "State of the customer's address",
"zip": "Postal code of the customer's address",
"phone": "Telephone number to reach the customer"
}*/
CREATE TABLE driver
(
driver_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
address TEXT,
city TEXT,
state TEXT,
zip_code INTEGER,
phone TEXT
)
/*
1 example row:
SELECT * FROM driver LIMIT 1;
driver_id ||first_name ||last_name || address || city ||state ||zip_code || phone
20 || Sue || Newell ||268 Richmond Ave ||Memphis || TN || 38106 ||(901) 774-6569
*/
/* column definitions {
"driver_id": "Unique identifier for the driver",
"first_name": "First given name of the driver",
"last_name": "Family name of the driver",
"address": "Street address of the driver's home",
"city": "City the driver lives in",
"state": "State the driver lives in",
"zip_code": "postal code of the driver's address",
"phone": "telephone number of the driver"
}*/
CREATE TABLE truck
(
truck_id INTEGER
primary key,
make TEXT,
model_year INTEGER
)
/*
1 example row:
SELECT * FROM truck LIMIT 1;
truck_id || make ||model_year
1 ||Peterbilt || 2005
*/
/* column definitions {
"truck_id": "Unique identifier of the truck table",
"make": "The brand of the truck",
"model_year": "The year the truck was manufactured"
}*/
CREATE TABLE shipment
(
ship_id INTEGER
primary key,
cust_id INTEGER,
weight REAL,
truck_id INTEGER,
driver_id INTEGER,
city_id INTEGER,
ship_date TEXT,
foreign key (cust_id) references customer(cust_id),
foreign key (city_id) references city(city_id),
foreign key (driver_id) references driver(driver_id),
foreign key (truck_id) references truck(truck_id)
)
/*
1 example row:
SELECT * FROM shipment LIMIT 1;
ship_id ||cust_id ||weight ||truck_id ||driver_id ||city_id || ship_date
1000 || 3660 ||3528.0 || 1 || 23 || 137 ||2016-01-08
*/
/* column definitions {
"ship_id": "Unique identifier of the shipment",
"cust_id": "A reference to the customer table that indicates which customer the shipment is for",
"weight": "The number of pounds being transported on the shipment",
"truck_id": "A reference to the truck table that indicates which truck is used in the shipment",
"driver_id": "A reference to the driver table that indicates which driver transported the goods in the shipment",
"city_id": "A reference to the city table that indicates the destination of the shipment",
"ship_date": "the date the items were received by the driver"
}*/
### Question
List the weight of the customer's shipment with annual revenue of 39448581.
Clarification:
| [query_database(**{'query': 'SELECT T1.weight FROM shipment AS T1 INNER JOIN customer AS T2 ON T1.cust_id = T2.cust_id WHERE T2.annual_revenue = 39448581'})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE city
(
city_id INTEGER
primary key,
city_name TEXT,
state TEXT,
population INTEGER,
area REAL
)
/*
1 example row:
SELECT * FROM city LIMIT 1;
city_id || city_name || state ||population ||area
100 ||Union City ||New Jersey || 67088 || 1.3
*/
/* column definitions {
"city_id": "unique identifier for the city",
"city_name": "name of the city",
"state": "state in which the city is",
"population ": "population of the city",
"area": "square miles the city covers"
}*/
CREATE TABLE customer
(
cust_id INTEGER
primary key,
cust_name TEXT,
annual_revenue INTEGER,
cust_type TEXT,
address TEXT,
city TEXT,
state TEXT,
zip REAL,
phone TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
cust_id || cust_name ||annual_revenue || cust_type || address || city ||state || zip || phone
193 ||Advanced Fabricators || 39588651 ||manufacturer ||5141 Summit Boulevard ||West Palm Beach || FL ||33415.0 ||(561) 683-3535
*/
/* column definitions {
"cust_id": "Unique identifier for the customer",
"cust_name": "Business name of the customer",
"annual_revenue": "Annual revenue of the customer",
"cust_type": "Whether the customer is a manufacturer or a wholes",
"address": "Physical street address of the customer",
"city": "City of the customer's address",
"state": "State of the customer's address",
"zip": "Postal code of the customer's address",
"phone": "Telephone number to reach the customer"
}*/
CREATE TABLE driver
(
driver_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
address TEXT,
city TEXT,
state TEXT,
zip_code INTEGER,
phone TEXT
)
/*
1 example row:
SELECT * FROM driver LIMIT 1;
driver_id ||first_name ||last_name || address || city ||state ||zip_code || phone
20 || Sue || Newell ||268 Richmond Ave ||Memphis || TN || 38106 ||(901) 774-6569
*/
/* column definitions {
"driver_id": "Unique identifier for the driver",
"first_name": "First given name of the driver",
"last_name": "Family name of the driver",
"address": "Street address of the driver's home",
"city": "City the driver lives in",
"state": "State the driver lives in",
"zip_code": "postal code of the driver's address",
"phone": "telephone number of the driver"
}*/
CREATE TABLE truck
(
truck_id INTEGER
primary key,
make TEXT,
model_year INTEGER
)
/*
1 example row:
SELECT * FROM truck LIMIT 1;
truck_id || make ||model_year
1 ||Peterbilt || 2005
*/
/* column definitions {
"truck_id": "Unique identifier of the truck table",
"make": "The brand of the truck",
"model_year": "The year the truck was manufactured"
}*/
CREATE TABLE shipment
(
ship_id INTEGER
primary key,
cust_id INTEGER,
weight REAL,
truck_id INTEGER,
driver_id INTEGER,
city_id INTEGER,
ship_date TEXT,
foreign key (cust_id) references customer(cust_id),
foreign key (city_id) references city(city_id),
foreign key (driver_id) references driver(driver_id),
foreign key (truck_id) references truck(truck_id)
)
/*
1 example row:
SELECT * FROM shipment LIMIT 1;
ship_id ||cust_id ||weight ||truck_id ||driver_id ||city_id || ship_date
1000 || 3660 ||3528.0 || 1 || 23 || 137 ||2016-01-08
*/
/* column definitions {
"ship_id": "Unique identifier of the shipment",
"cust_id": "A reference to the customer table that indicates which customer the shipment is for",
"weight": "The number of pounds being transported on the shipment",
"truck_id": "A reference to the truck table that indicates which truck is used in the shipment",
"driver_id": "A reference to the driver table that indicates which driver transported the goods in the shipment",
"city_id": "A reference to the city table that indicates the destination of the shipment",
"ship_date": "the date the items were received by the driver"
}*/
|
5,683 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE city
(
city_id INTEGER
primary key,
city_name TEXT,
state TEXT,
population INTEGER,
area REAL
)
/*
1 example row:
SELECT * FROM city LIMIT 1;
city_id || city_name || state ||population ||area
100 ||Union City ||New Jersey || 67088 || 1.3
*/
/* column definitions {
"city_id": "unique identifier for the city",
"city_name": "name of the city",
"state": "state in which the city is",
"population ": "population of the city",
"area": "square miles the city covers"
}*/
CREATE TABLE customer
(
cust_id INTEGER
primary key,
cust_name TEXT,
annual_revenue INTEGER,
cust_type TEXT,
address TEXT,
city TEXT,
state TEXT,
zip REAL,
phone TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
cust_id || cust_name ||annual_revenue || cust_type || address || city ||state || zip || phone
193 ||Advanced Fabricators || 39588651 ||manufacturer ||5141 Summit Boulevard ||West Palm Beach || FL ||33415.0 ||(561) 683-3535
*/
/* column definitions {
"cust_id": "Unique identifier for the customer",
"cust_name": "Business name of the customer",
"annual_revenue": "Annual revenue of the customer",
"cust_type": "Whether the customer is a manufacturer or a wholes",
"address": "Physical street address of the customer",
"city": "City of the customer's address",
"state": "State of the customer's address",
"zip": "Postal code of the customer's address",
"phone": "Telephone number to reach the customer"
}*/
CREATE TABLE driver
(
driver_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
address TEXT,
city TEXT,
state TEXT,
zip_code INTEGER,
phone TEXT
)
/*
1 example row:
SELECT * FROM driver LIMIT 1;
driver_id ||first_name ||last_name || address || city ||state ||zip_code || phone
20 || Sue || Newell ||268 Richmond Ave ||Memphis || TN || 38106 ||(901) 774-6569
*/
/* column definitions {
"driver_id": "Unique identifier for the driver",
"first_name": "First given name of the driver",
"last_name": "Family name of the driver",
"address": "Street address of the driver's home",
"city": "City the driver lives in",
"state": "State the driver lives in",
"zip_code": "postal code of the driver's address",
"phone": "telephone number of the driver"
}*/
CREATE TABLE truck
(
truck_id INTEGER
primary key,
make TEXT,
model_year INTEGER
)
/*
1 example row:
SELECT * FROM truck LIMIT 1;
truck_id || make ||model_year
1 ||Peterbilt || 2005
*/
/* column definitions {
"truck_id": "Unique identifier of the truck table",
"make": "The brand of the truck",
"model_year": "The year the truck was manufactured"
}*/
CREATE TABLE shipment
(
ship_id INTEGER
primary key,
cust_id INTEGER,
weight REAL,
truck_id INTEGER,
driver_id INTEGER,
city_id INTEGER,
ship_date TEXT,
foreign key (cust_id) references customer(cust_id),
foreign key (city_id) references city(city_id),
foreign key (driver_id) references driver(driver_id),
foreign key (truck_id) references truck(truck_id)
)
/*
1 example row:
SELECT * FROM shipment LIMIT 1;
ship_id ||cust_id ||weight ||truck_id ||driver_id ||city_id || ship_date
1000 || 3660 ||3528.0 || 1 || 23 || 137 ||2016-01-08
*/
/* column definitions {
"ship_id": "Unique identifier of the shipment",
"cust_id": "A reference to the customer table that indicates which customer the shipment is for",
"weight": "The number of pounds being transported on the shipment",
"truck_id": "A reference to the truck table that indicates which truck is used in the shipment",
"driver_id": "A reference to the driver table that indicates which driver transported the goods in the shipment",
"city_id": "A reference to the city table that indicates the destination of the shipment",
"ship_date": "the date the items were received by the driver"
}*/
### Question
List the driver's name of the shipment with a weight greater than 95% of the average weight of all shipments.
Clarification: weight greater than 95% of average weight refers to weight > Multiply (AVG(weight), 0.95); driver name refers to first_name, last_name
| [query_database(**{'query': 'SELECT T2.first_name, T2.last_name FROM shipment AS T1 INNER JOIN driver AS T2 ON T1.driver_id = T2.driver_id WHERE T1.weight * 100 > ( SELECT 95 * AVG(weight) FROM shipment )'})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE city
(
city_id INTEGER
primary key,
city_name TEXT,
state TEXT,
population INTEGER,
area REAL
)
/*
1 example row:
SELECT * FROM city LIMIT 1;
city_id || city_name || state ||population ||area
100 ||Union City ||New Jersey || 67088 || 1.3
*/
/* column definitions {
"city_id": "unique identifier for the city",
"city_name": "name of the city",
"state": "state in which the city is",
"population ": "population of the city",
"area": "square miles the city covers"
}*/
CREATE TABLE customer
(
cust_id INTEGER
primary key,
cust_name TEXT,
annual_revenue INTEGER,
cust_type TEXT,
address TEXT,
city TEXT,
state TEXT,
zip REAL,
phone TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
cust_id || cust_name ||annual_revenue || cust_type || address || city ||state || zip || phone
193 ||Advanced Fabricators || 39588651 ||manufacturer ||5141 Summit Boulevard ||West Palm Beach || FL ||33415.0 ||(561) 683-3535
*/
/* column definitions {
"cust_id": "Unique identifier for the customer",
"cust_name": "Business name of the customer",
"annual_revenue": "Annual revenue of the customer",
"cust_type": "Whether the customer is a manufacturer or a wholes",
"address": "Physical street address of the customer",
"city": "City of the customer's address",
"state": "State of the customer's address",
"zip": "Postal code of the customer's address",
"phone": "Telephone number to reach the customer"
}*/
CREATE TABLE driver
(
driver_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
address TEXT,
city TEXT,
state TEXT,
zip_code INTEGER,
phone TEXT
)
/*
1 example row:
SELECT * FROM driver LIMIT 1;
driver_id ||first_name ||last_name || address || city ||state ||zip_code || phone
20 || Sue || Newell ||268 Richmond Ave ||Memphis || TN || 38106 ||(901) 774-6569
*/
/* column definitions {
"driver_id": "Unique identifier for the driver",
"first_name": "First given name of the driver",
"last_name": "Family name of the driver",
"address": "Street address of the driver's home",
"city": "City the driver lives in",
"state": "State the driver lives in",
"zip_code": "postal code of the driver's address",
"phone": "telephone number of the driver"
}*/
CREATE TABLE truck
(
truck_id INTEGER
primary key,
make TEXT,
model_year INTEGER
)
/*
1 example row:
SELECT * FROM truck LIMIT 1;
truck_id || make ||model_year
1 ||Peterbilt || 2005
*/
/* column definitions {
"truck_id": "Unique identifier of the truck table",
"make": "The brand of the truck",
"model_year": "The year the truck was manufactured"
}*/
CREATE TABLE shipment
(
ship_id INTEGER
primary key,
cust_id INTEGER,
weight REAL,
truck_id INTEGER,
driver_id INTEGER,
city_id INTEGER,
ship_date TEXT,
foreign key (cust_id) references customer(cust_id),
foreign key (city_id) references city(city_id),
foreign key (driver_id) references driver(driver_id),
foreign key (truck_id) references truck(truck_id)
)
/*
1 example row:
SELECT * FROM shipment LIMIT 1;
ship_id ||cust_id ||weight ||truck_id ||driver_id ||city_id || ship_date
1000 || 3660 ||3528.0 || 1 || 23 || 137 ||2016-01-08
*/
/* column definitions {
"ship_id": "Unique identifier of the shipment",
"cust_id": "A reference to the customer table that indicates which customer the shipment is for",
"weight": "The number of pounds being transported on the shipment",
"truck_id": "A reference to the truck table that indicates which truck is used in the shipment",
"driver_id": "A reference to the driver table that indicates which driver transported the goods in the shipment",
"city_id": "A reference to the city table that indicates the destination of the shipment",
"ship_date": "the date the items were received by the driver"
}*/
|
5,687 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
### Question
What is the title of Catalan language wikipedia page with revision page id '16203226'?
Clarification: revision page id '16203226' refers to revision = 16203226
| [query_database(**{'query': 'SELECT title FROM pages WHERE revision = 16203226'})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
|
5,691 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
### Question
Which word has the most occurrences within the same page of wikipedia about Catalan language?
Clarification: most occurrences refers to max(occurrences)
| [query_database(**{'query': 'SELECT T1.word FROM words AS T1 INNER JOIN pages_words AS T2 ON T1.wid = T2.wid WHERE T2.occurrences = ( SELECT MAX(occurrences) FROM pages_words )'})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
|
5,695 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
### Question
What is the total pages of Wikipedia in Catalan language?
Clarification: total pages refers to sum(pages); Catalan language refers to lang = 'ca'
| [query_database(**{'query': 'SELECT pages FROM langs WHERE lang = 'ca''})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
|
5,698 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
### Question
What is the title of the Catalan language Wikipedia page that has the highest number of different words?
Clarification: highest number of different words refers to max(words)
| [query_database(**{'query': 'SELECT title FROM pages WHERE words = ( SELECT MAX(words) FROM pages )'})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
|
5,702 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
### Question
How many times did the word pair "i" and "a" appeared in the Cataln language/page?
Clarification: times appeared refers to occurrences; word pair "i" and "a" refers to w1st.word = 'i' w2st.word = 'a'
| [query_database(**{'query': 'SELECT SUM(occurrences) FROM biwords WHERE w1st = 86 AND w2nd = 109'})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
|
5,706 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
### Question
What is the revision page ID of title "Aigua dolça"?
Clarification: title "Aigua dolça" refers to title LIKE 'Aigua dolça%'
| [query_database(**{'query': 'SELECT revision FROM pages WHERE title = 'Aigua dolça''})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
|
5,710 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
### Question
List down the page id of titles start with alphabet "b".
Clarification: start with alphabet "b" refers to title LIKE 'b%'
| [query_database(**{'query': 'SELECT pid FROM pages WHERE title LIKE 'b%''})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
|
5,714 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
### Question
What are the occurance of word "del" in title "Any anomalÃstic"?
Clarification: This is not
| [query_database(**{'query': 'SELECT T2.occurrences FROM words AS T1 INNER JOIN pages_words AS T2 ON T1.wid = T2.wid INNER JOIN pages AS T3 ON T2.pid = T3.pid WHERE T1.word = 'del' AND T3.title = 'Any anomalÃstic''})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
|
5,718 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
### Question
List down the revision page id of titles where "fresc" appears.
Clarification: page id refers to pid; "fresc" refers to word = 'fresc'
| [query_database(**{'query': 'SELECT T3.revision FROM words AS T1 INNER JOIN pages_words AS T2 ON T1.wid = T2.wid INNER JOIN pages AS T3 ON T2.pid = T3.pid WHERE T1.word = 'fresc''})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
|
5,722 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
### Question
Indicate the page id of Wikipedia about Catalan language of all the pages that have a numeric value in their title.
Clarification: the page id of Wikipedia refers to pid; numeric value contains only numbers, LIKE '%0%' OR '%1%' OR '%2%' OR '%3%' OR '%4%' OR '%5%' OR '%6%' OR '%7%' OR '%8%' OR '%9%';
| [query_database(**{'query': 'SELECT pid, title FROM pages WHERE title LIKE '%0%' OR '%1%' OR '%2%' OR '%3%' OR '%4%' OR '%5%' OR '%6%' OR '%7%' OR '%8%' OR '%9%''})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
|
5,726 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
### Question
Calculate the average number of different words that appear on all pages whose title begins with A.
Clarification: DIVIDE(SUM(words WHERE title = 'A%'), COUNT(words WHERE title = 'A%')) as percentage; A is a letter;
| [query_database(**{'query': 'SELECT AVG(words) FROM pages WHERE title LIKE 'A%''})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
|
5,730 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
### Question
Indicate the title of all the pages in which the word comunitat appears.
Clarification: This is not;
| [query_database(**{'query': 'SELECT T3.title FROM words AS T1 INNER JOIN pages_words AS T2 ON T1.wid = T2.wid INNER JOIN pages AS T3 ON T2.pid = T3.pid WHERE T1.word = 'comunitat''})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
|
5,734 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
### Question
Calculate the average of repetitions in the pages that have a total of 100 different words.
Clarification: Repetition refers to occurrences; 100 different words refers to words = 100; DIVIDE(SUM(occurrences where words = 100), COUNT(page where words = 100)) as percentage;
| [query_database(**{'query': 'SELECT CAST(SUM(T2.occurrences) AS REAL) / COUNT(T1.page) FROM pages AS T1 INNER JOIN pages_words AS T2 ON T1.pid = T2.pid WHERE T1.words = 100'})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
|
5,738 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
### Question
Please list the top three most frequently occurring words and their ids.
Clarification: most frequently occurring words refer to MAX(occurrences); id refers to wid;
| [query_database(**{'query': 'SELECT word, wid FROM words ORDER BY occurrences DESC LIMIT 3'})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
|
5,742 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
### Question
Which Wikipedia page number has the highest number of words in the Catalan language?
Clarification: Wikipedia page number refers to page; the highest number of words in the Catalan language refers to MAX(lid = 1);
| [query_database(**{'query': 'SELECT page FROM pages WHERE words = ( SELECT MAX(words) FROM pages )'})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
|
5,746 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
### Question
What is the language of the pair of words numbered 1 and 616?
Clarification: Pair is a relationship of two words: w1st and w2nd, where w1st is word id of the first word and w2nd is a word id of the second word; w1st = 1; w2nd = 616;
| [query_database(**{'query': 'SELECT T2.lang FROM biwords AS T1 INNER JOIN langs AS T2 ON T1.lid = T2.lid WHERE T1.w1st = 1 AND T1.w2nd = 616'})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
|
5,750 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
### Question
How many times on page number 44 does the word "votives" appear?
Clarification: How many times refers to occurrences; page number 44 refers to pid = 44;
| [query_database(**{'query': 'SELECT T2.occurrences FROM words AS T1 INNER JOIN pages_words AS T2 ON T1.wid = T2.wid WHERE T1.word = 'votives' AND T2.pid = 44'})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
|
5,754 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
### Question
How many times the word "desena" occurs?
Clarification: How many times occurs refers to occurrences;
| [query_database(**{'query': 'SELECT occurrences FROM words WHERE word = 'desena''})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
|
5,758 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
### Question
List out the title of Catalan language Wikipedia page that has wikipedia revision page id as 106601.
Clarification: Wikipedia revision page id as 106601 refers to revision = 106601;
| [query_database(**{'query': 'SELECT title FROM pages WHERE revision = 106601'})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
|
5,762 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
### Question
Which word that has 71303 appearance in the Catalan language?
Clarification: has 71303 appearance refers to occurrences = 71303;
| [query_database(**{'query': 'SELECT T1.word FROM words AS T1 INNER JOIN langs_words AS T2 ON T1.wid = T2.wid WHERE T2.occurrences = 71303'})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
|
5,766 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
### Question
List out the title of the word have id less than 20.
Clarification: word have id less than 20 refers to wid < 20;
| [query_database(**{'query': 'SELECT DISTINCT T1.title FROM pages AS T1 INNER JOIN pages_words AS T2 ON T1.pid = T2.pid WHERE T2.wid < 20'})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
|
5,770 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
### Question
List out the total pages of the words that has repeated times more than 3000.
Clarification: repeated more than 3000 times refers to occurrences > 3000;
| [query_database(**{'query': 'SELECT T1.pages FROM langs AS T1 INNER JOIN langs_words AS T2 ON T1.lid = T2.lid WHERE T2.occurrences > 3000 GROUP BY T1.pages'})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
|
5,775 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
### Question
Which of these pages have more words, the page titled "Afluent" or "Asclepi"?
Clarification: COUNT(words where title = 'Afluent')> COUNT(words where title = 'Asclepi')
| [query_database(**{'query': 'SELECT CASE WHEN ( SELECT words FROM pages WHERE title = 'Asclepi' ) > ( SELECT words FROM pages WHERE title = 'Afluent' ) THEN 'Asclepi' ELSE 'Afluent' END'})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
|
5,780 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
### Question
Please list the title of the pages on which the word "grec" occurred for over 20 times.
Clarification: occurred for over 20 times refers to occurrences > 20;
| [query_database(**{'query': 'SELECT T3.title FROM words AS T1 INNER JOIN pages_words AS T2 ON T1.wid = T2.wid INNER JOIN pages AS T3 ON T2.pid = T3.pid WHERE T1.word = 'grec' AND T2.occurrences > 20'})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
|
5,784 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
### Question
How many more times does the first word in the biwords pair "àbac-xinès" occur than the biwords pair itself?
Clarification: àbac refers to word = 'àbac'; xinès refers to word = 'xinès'; How many more times the first word in the biwords occur than the biwords pair itself means SUBTRACT(words.occurrence, biwords.occurrences)
| [query_database(**{'query': 'SELECT occurrences - ( SELECT occurrences FROM biwords WHERE w1st = ( SELECT wid FROM words WHERE word = 'àbac' ) AND w2nd = ( SELECT wid FROM words WHERE word = 'xinès' ) ) AS CALUS FROM words WHERE word = 'àbac''})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
|
5,788 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
### Question
How much higher in percentage does the word "grec" occur on the page titled "Àbac" than on the page titled "Astronomia"?
Clarification: grec refers to word = 'grec'; Àbac refers to title = 'Àbac'; Astronomia refers to title = 'Astronomia'; percentage = DIVIDE(SUBTRACT(occurrences where title = 'Àbac' AND word = 'grec', occurrences where title = 'Astronomia' AND word = 'grec'), occurrences where title = 'Astronomia' AND word = 'grec')
| [query_database(**{'query': 'SELECT CAST((SUM(CASE WHEN T3.title = 'Àbac' THEN T2.occurrences END) - SUM(CASE WHEN T3.title = 'Astronomia' THEN T2.occurrences END)) AS REAL) * 100 / SUM(CASE WHEN T3.title = 'Astronomia' THEN T2.occurrences END) FROM words AS T1 INNER JOIN pages_words AS T2 ON T1.wid = T2.wid INNER JOIN pages AS T3 ON T2.pid = T3.pid WHERE T1.word = 'grec''})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
|
5,792 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
### Question
How many occurrences does the word "panajot" have?
Clarification: panajot refers to word = 'panajot'
| [query_database(**{'query': 'SELECT occurrences FROM words WHERE word = 'panajot''})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
|
5,796 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
### Question
How many times does the word "riu" appears in the biwords pair?
Clarification: riu refers to word = 'riu'; SUM(w1st where wid is word = 'riu' AND w2nd where wid is word = 'riu')
| [query_database(**{'query': 'SELECT COUNT(T1.wid) FROM words AS T1 INNER JOIN biwords AS T2 ON T1.wid = T2.w1st INNER JOIN words AS T3 ON T3.wid = T2.w2nd WHERE T1.word = 'riu''})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
|
5,801 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
### Question
Which word has the most appearances in the Wikipedia page revision ID No. 28278070? Give the word ID.
Clarification: the most appearances refers to MAX(occurrences); revision ID No. 28278070 refers to revision = 28278070; word ID refers to wid
| [query_database(**{'query': 'SELECT pid FROM pages_words WHERE pid = ( SELECT pid FROM pages WHERE revision = 28278070 ) ORDER BY occurrences DESC LIMIT 1'})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
|
5,805 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
### Question
Which word that has 274499 repetitions in the Catalan language?
Clarification: lid = 1 menas it's Catalan language; 274499 repetitions refers to occurrences = 274499
| [query_database(**{'query': 'SELECT T1.word FROM words AS T1 INNER JOIN langs_words AS T2 ON T1.wid = T2.wid WHERE T2.occurrences = 274499 AND T2.lid = 1'})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
|
5,808 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
### Question
How many Wikipedia pages with over 4000 different words are there on the Catalan language?
Clarification: lid = 1 means it's Catalan language; over 4000 different words means words > 4000; Wikipedia pages refers to pid
| [query_database(**{'query': 'SELECT COUNT(lid) FROM pages WHERE lid = 1 AND words > 4000'})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
|
5,812 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
### Question
What is the revision ID for the page on Catalan titled "Arqueologia"?
Clarification: lid = 1 means it's Catalan language; Arqueologia refers to title = 'Arqueologia'; revision ID refers to revision
| [query_database(**{'query': 'SELECT revision FROM pages WHERE lid = 1 AND title = 'Arqueologia''})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
|
5,816 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
### Question
How many biwords pairs are there whose second word is "grec"?
Clarification: grec refers to word = 'grec'; wid where word = 'grec' AS w2nd
| [query_database(**{'query': 'SELECT COUNT(T2.w1st) FROM words AS T1 INNER JOIN biwords AS T2 ON T1.wid = T2.w2nd WHERE T1.word = 'grec''})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM langs LIMIT 1;
lid ||lang ||locale || pages || words
1 || ca || ca_ES ||1129144 ||2764996
*/
/* column definitions {
"lid": "language id ",
"lang": "language name ",
"locale": "The locale of the language",
"pages": "total pages of Wikipedia in this language",
"words": "total number of words in this pages"
}*/
CREATE TABLE pages(pid INTEGER PRIMARY KEY AUTOINCREMENT,
lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
page INTEGER DEFAULT NULL, -- wikipedia page id
revision INTEGER DEFAULT NULL, -- wikipedia revision page id
title TEXT,
words INTEGER DEFAULT 0, -- number of different words in this page
UNIQUE(lid,page,title))
/*
1 example row:
SELECT * FROM pages LIMIT 1;
pid ||lid ||page ||revision ||title ||words
1 || 1 || 1 ||28236978 || Àbac || 1081
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"lid": "language id ",
"page": "wikipedia page id",
"revision": "wikipedia revision page id",
"title": "The title of this Catalan language Wikipedia page",
"words": "number of different words in this page"
}*/
CREATE TABLE words(wid INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE,
occurrences INTEGER DEFAULT 0)
/*
1 example row:
SELECT * FROM words LIMIT 1;
wid ||word ||occurrences
1 ||àbac || 242
*/
/* column definitions {
"wid": "The word id of the Catalan language",
"word": "The word itself",
"occurrences": "The occurrences of the specific word"
}*/
CREATE TABLE langs_words(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER, -- repetitions of this word in this language
PRIMARY KEY(lid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM langs_words LIMIT 1;
lid ||wid ||occurrences
1 || 1 || 242
*/
/* column definitions {
"lid": "language id ",
"wid": "The word id of the Catalan language",
"occurrences": "repetitions of this word in this language"
}*/
CREATE TABLE pages_words(pid INTEGER REFERENCES pages(pid) ON UPDATE CASCADE ON DELETE CASCADE,
wid INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this word appears into this page
PRIMARY KEY(pid,wid))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM pages_words LIMIT 1;
pid ||wid ||occurrences
1 || 1 || 30
*/
/* column definitions {
"pid": "page id of Wikipedia about Catalan language",
"wid": "The word id of the Catalan language",
"occurrences": "times of this word appears into this page"
}*/
CREATE TABLE biwords(lid INTEGER REFERENCES langs(lid) ON UPDATE CASCADE ON DELETE CASCADE,
w1st INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
w2nd INTEGER REFERENCES words(wid) ON UPDATE CASCADE ON DELETE CASCADE,
occurrences INTEGER DEFAULT 0, -- times this pair appears in this language/page
PRIMARY KEY(lid,w1st,w2nd))
WITHOUT ROWID
/*
1 example row:
SELECT * FROM biwords LIMIT 1;
lid ||w1st ||w2nd ||occurrences
1 || 1 || 2 || 4
*/
/* column definitions {
"lid": "language id ",
"w1st": "The word id of the first word of the biwords pair. ",
"w2nd": "The word id of the second word of the biwords pair. ",
"occurrences": "times of this pair appears in this language/page"
}*/
|
5,820 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE "Air Carriers"
(
Code INTEGER
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM `air carriers` LIMIT 1;
Code || Description
19031 ||Mackey International Inc.: MAC
*/
/* column definitions {
"Code": "the code of the air carriers",
"Description": "the description of air carriers"
}*/
CREATE TABLE Airports
(
Code TEXT
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM airports LIMIT 1;
Code || Description
01A ||Afognak Lake, AK: Afognak Lake Airport
*/
/* column definitions {
"Code": "IATA code of the air airports",
"Description": "the description of airports"
}*/
CREATE TABLE Airlines
(
FL_DATE TEXT,
OP_CARRIER_AIRLINE_ID INTEGER,
TAIL_NUM TEXT,
OP_CARRIER_FL_NUM INTEGER,
ORIGIN_AIRPORT_ID INTEGER,
ORIGIN_AIRPORT_SEQ_ID INTEGER,
ORIGIN_CITY_MARKET_ID INTEGER,
ORIGIN TEXT,
DEST_AIRPORT_ID INTEGER,
DEST_AIRPORT_SEQ_ID INTEGER,
DEST_CITY_MARKET_ID INTEGER,
DEST TEXT,
CRS_DEP_TIME INTEGER,
DEP_TIME INTEGER,
DEP_DELAY INTEGER,
DEP_DELAY_NEW INTEGER,
ARR_TIME INTEGER,
ARR_DELAY INTEGER,
ARR_DELAY_NEW INTEGER,
CANCELLED INTEGER,
CANCELLATION_CODE TEXT,
CRS_ELAPSED_TIME INTEGER,
ACTUAL_ELAPSED_TIME INTEGER,
CARRIER_DELAY INTEGER,
WEATHER_DELAY INTEGER,
NAS_DELAY INTEGER,
SECURITY_DELAY INTEGER,
LATE_AIRCRAFT_DELAY INTEGER,
FOREIGN KEY (ORIGIN) REFERENCES Airports(Code),
FOREIGN KEY (DEST) REFERENCES Airports(Code),
FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code)
)
/*
1 example row:
SELECT * FROM airlines LIMIT 1;
FL_DATE ||OP_CARRIER_AIRLINE_ID ||TAIL_NUM ||OP_CARRIER_FL_NUM ||ORIGIN_AIRPORT_ID ||ORIGIN_AIRPORT_SEQ_ID ||ORIGIN_CITY_MARKET_ID ||ORIGIN ||DEST_AIRPORT_ID ||DEST_AIRPORT_SEQ_ID ||DEST_CITY_MARKET_ID ||DEST ||CRS_DEP_TIME ||DEP_TIME ||DEP_DELAY ||DEP_DELAY_NEW ||ARR_TIME ||ARR_DELAY ||ARR_DELAY_NEW ||CANCELLED ||CANCELLATION_CODE ||CRS_ELAPSED_TIME ||ACTUAL_ELAPSED_TIME ||CARRIER_DELAY ||WEATHER_DELAY ||NAS_DELAY ||SECURITY_DELAY ||LATE_AIRCRAFT_DELAY
2018/8/1 || 19805 || N956AN || 1587 || 12478 || 1247805 || 31703 || JFK || 14107 || 1410702 || 30466 || PHX || 1640 || 1649 || 9 || 9 || 2006 || 44 || 44 || 0 || None || 342 || 377 || 9 || 0 || 35 || 0 || 0
*/
/* column definitions {
"FL_DATE": "flight date",
"OP_CARRIER_AIRLINE_ID": "operator carrier airline id",
"TAIL_NUM": "plane's tail number",
"OP_CARRIER_FL_NUM": "operator carrier flight number",
"ORIGIN_AIRPORT_ID": "origin airport id",
"ORIGIN_AIRPORT_SEQ_ID": "origin airport sequence id",
"ORIGIN_CITY_MARKET_ID": "origin city market id",
"ORIGIN": "airport of origin",
"DEST_AIRPORT_ID": "ID of the destination airport",
"DEST_AIRPORT_SEQ_ID": "",
"DEST_CITY_MARKET_ID": "",
"DEST": "Destination airport",
"CRS_DEP_TIME": "",
"DEP_TIME": "Flight departure time",
"DEP_DELAY": "Departure delay indicator",
"DEP_DELAY_NEW": "departure delay new",
"ARR_TIME": "Flight arrival time.",
"ARR_DELAY": "arrival delay time",
"ARR_DELAY_NEW": "arrival delay new",
"CANCELLED": "Flight cancellation indicator.",
"CANCELLATION_CODE": "cancellation code",
"CRS_ELAPSED_TIME": "scheduled elapsed time",
"ACTUAL_ELAPSED_TIME": "actual elapsed time",
"CARRIER_DELAY": "carrier delay",
"WEATHER_DELAY": "delay caused by the wheather problem",
"NAS_DELAY": "delay, in minutes, attributable to the National Aviation System",
"SECURITY_DELAY": "delay attribute to security",
"LATE_AIRCRAFT_DELAY": "delay attribute to late aircraft"
}*/
### Question
How many flights were there on 2018/8/1?
Clarification: on 2018/8/1 refers to FL_DATE = '2018/8/1';
| [query_database(**{'query': 'SELECT COUNT(*) FROM Airlines WHERE FL_DATE = '2018/8/1''})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE "Air Carriers"
(
Code INTEGER
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM `air carriers` LIMIT 1;
Code || Description
19031 ||Mackey International Inc.: MAC
*/
/* column definitions {
"Code": "the code of the air carriers",
"Description": "the description of air carriers"
}*/
CREATE TABLE Airports
(
Code TEXT
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM airports LIMIT 1;
Code || Description
01A ||Afognak Lake, AK: Afognak Lake Airport
*/
/* column definitions {
"Code": "IATA code of the air airports",
"Description": "the description of airports"
}*/
CREATE TABLE Airlines
(
FL_DATE TEXT,
OP_CARRIER_AIRLINE_ID INTEGER,
TAIL_NUM TEXT,
OP_CARRIER_FL_NUM INTEGER,
ORIGIN_AIRPORT_ID INTEGER,
ORIGIN_AIRPORT_SEQ_ID INTEGER,
ORIGIN_CITY_MARKET_ID INTEGER,
ORIGIN TEXT,
DEST_AIRPORT_ID INTEGER,
DEST_AIRPORT_SEQ_ID INTEGER,
DEST_CITY_MARKET_ID INTEGER,
DEST TEXT,
CRS_DEP_TIME INTEGER,
DEP_TIME INTEGER,
DEP_DELAY INTEGER,
DEP_DELAY_NEW INTEGER,
ARR_TIME INTEGER,
ARR_DELAY INTEGER,
ARR_DELAY_NEW INTEGER,
CANCELLED INTEGER,
CANCELLATION_CODE TEXT,
CRS_ELAPSED_TIME INTEGER,
ACTUAL_ELAPSED_TIME INTEGER,
CARRIER_DELAY INTEGER,
WEATHER_DELAY INTEGER,
NAS_DELAY INTEGER,
SECURITY_DELAY INTEGER,
LATE_AIRCRAFT_DELAY INTEGER,
FOREIGN KEY (ORIGIN) REFERENCES Airports(Code),
FOREIGN KEY (DEST) REFERENCES Airports(Code),
FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code)
)
/*
1 example row:
SELECT * FROM airlines LIMIT 1;
FL_DATE ||OP_CARRIER_AIRLINE_ID ||TAIL_NUM ||OP_CARRIER_FL_NUM ||ORIGIN_AIRPORT_ID ||ORIGIN_AIRPORT_SEQ_ID ||ORIGIN_CITY_MARKET_ID ||ORIGIN ||DEST_AIRPORT_ID ||DEST_AIRPORT_SEQ_ID ||DEST_CITY_MARKET_ID ||DEST ||CRS_DEP_TIME ||DEP_TIME ||DEP_DELAY ||DEP_DELAY_NEW ||ARR_TIME ||ARR_DELAY ||ARR_DELAY_NEW ||CANCELLED ||CANCELLATION_CODE ||CRS_ELAPSED_TIME ||ACTUAL_ELAPSED_TIME ||CARRIER_DELAY ||WEATHER_DELAY ||NAS_DELAY ||SECURITY_DELAY ||LATE_AIRCRAFT_DELAY
2018/8/1 || 19805 || N956AN || 1587 || 12478 || 1247805 || 31703 || JFK || 14107 || 1410702 || 30466 || PHX || 1640 || 1649 || 9 || 9 || 2006 || 44 || 44 || 0 || None || 342 || 377 || 9 || 0 || 35 || 0 || 0
*/
/* column definitions {
"FL_DATE": "flight date",
"OP_CARRIER_AIRLINE_ID": "operator carrier airline id",
"TAIL_NUM": "plane's tail number",
"OP_CARRIER_FL_NUM": "operator carrier flight number",
"ORIGIN_AIRPORT_ID": "origin airport id",
"ORIGIN_AIRPORT_SEQ_ID": "origin airport sequence id",
"ORIGIN_CITY_MARKET_ID": "origin city market id",
"ORIGIN": "airport of origin",
"DEST_AIRPORT_ID": "ID of the destination airport",
"DEST_AIRPORT_SEQ_ID": "",
"DEST_CITY_MARKET_ID": "",
"DEST": "Destination airport",
"CRS_DEP_TIME": "",
"DEP_TIME": "Flight departure time",
"DEP_DELAY": "Departure delay indicator",
"DEP_DELAY_NEW": "departure delay new",
"ARR_TIME": "Flight arrival time.",
"ARR_DELAY": "arrival delay time",
"ARR_DELAY_NEW": "arrival delay new",
"CANCELLED": "Flight cancellation indicator.",
"CANCELLATION_CODE": "cancellation code",
"CRS_ELAPSED_TIME": "scheduled elapsed time",
"ACTUAL_ELAPSED_TIME": "actual elapsed time",
"CARRIER_DELAY": "carrier delay",
"WEATHER_DELAY": "delay caused by the wheather problem",
"NAS_DELAY": "delay, in minutes, attributable to the National Aviation System",
"SECURITY_DELAY": "delay attribute to security",
"LATE_AIRCRAFT_DELAY": "delay attribute to late aircraft"
}*/
|
5,824 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE "Air Carriers"
(
Code INTEGER
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM `air carriers` LIMIT 1;
Code || Description
19031 ||Mackey International Inc.: MAC
*/
/* column definitions {
"Code": "the code of the air carriers",
"Description": "the description of air carriers"
}*/
CREATE TABLE Airports
(
Code TEXT
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM airports LIMIT 1;
Code || Description
01A ||Afognak Lake, AK: Afognak Lake Airport
*/
/* column definitions {
"Code": "IATA code of the air airports",
"Description": "the description of airports"
}*/
CREATE TABLE Airlines
(
FL_DATE TEXT,
OP_CARRIER_AIRLINE_ID INTEGER,
TAIL_NUM TEXT,
OP_CARRIER_FL_NUM INTEGER,
ORIGIN_AIRPORT_ID INTEGER,
ORIGIN_AIRPORT_SEQ_ID INTEGER,
ORIGIN_CITY_MARKET_ID INTEGER,
ORIGIN TEXT,
DEST_AIRPORT_ID INTEGER,
DEST_AIRPORT_SEQ_ID INTEGER,
DEST_CITY_MARKET_ID INTEGER,
DEST TEXT,
CRS_DEP_TIME INTEGER,
DEP_TIME INTEGER,
DEP_DELAY INTEGER,
DEP_DELAY_NEW INTEGER,
ARR_TIME INTEGER,
ARR_DELAY INTEGER,
ARR_DELAY_NEW INTEGER,
CANCELLED INTEGER,
CANCELLATION_CODE TEXT,
CRS_ELAPSED_TIME INTEGER,
ACTUAL_ELAPSED_TIME INTEGER,
CARRIER_DELAY INTEGER,
WEATHER_DELAY INTEGER,
NAS_DELAY INTEGER,
SECURITY_DELAY INTEGER,
LATE_AIRCRAFT_DELAY INTEGER,
FOREIGN KEY (ORIGIN) REFERENCES Airports(Code),
FOREIGN KEY (DEST) REFERENCES Airports(Code),
FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code)
)
/*
1 example row:
SELECT * FROM airlines LIMIT 1;
FL_DATE ||OP_CARRIER_AIRLINE_ID ||TAIL_NUM ||OP_CARRIER_FL_NUM ||ORIGIN_AIRPORT_ID ||ORIGIN_AIRPORT_SEQ_ID ||ORIGIN_CITY_MARKET_ID ||ORIGIN ||DEST_AIRPORT_ID ||DEST_AIRPORT_SEQ_ID ||DEST_CITY_MARKET_ID ||DEST ||CRS_DEP_TIME ||DEP_TIME ||DEP_DELAY ||DEP_DELAY_NEW ||ARR_TIME ||ARR_DELAY ||ARR_DELAY_NEW ||CANCELLED ||CANCELLATION_CODE ||CRS_ELAPSED_TIME ||ACTUAL_ELAPSED_TIME ||CARRIER_DELAY ||WEATHER_DELAY ||NAS_DELAY ||SECURITY_DELAY ||LATE_AIRCRAFT_DELAY
2018/8/1 || 19805 || N956AN || 1587 || 12478 || 1247805 || 31703 || JFK || 14107 || 1410702 || 30466 || PHX || 1640 || 1649 || 9 || 9 || 2006 || 44 || 44 || 0 || None || 342 || 377 || 9 || 0 || 35 || 0 || 0
*/
/* column definitions {
"FL_DATE": "flight date",
"OP_CARRIER_AIRLINE_ID": "operator carrier airline id",
"TAIL_NUM": "plane's tail number",
"OP_CARRIER_FL_NUM": "operator carrier flight number",
"ORIGIN_AIRPORT_ID": "origin airport id",
"ORIGIN_AIRPORT_SEQ_ID": "origin airport sequence id",
"ORIGIN_CITY_MARKET_ID": "origin city market id",
"ORIGIN": "airport of origin",
"DEST_AIRPORT_ID": "ID of the destination airport",
"DEST_AIRPORT_SEQ_ID": "",
"DEST_CITY_MARKET_ID": "",
"DEST": "Destination airport",
"CRS_DEP_TIME": "",
"DEP_TIME": "Flight departure time",
"DEP_DELAY": "Departure delay indicator",
"DEP_DELAY_NEW": "departure delay new",
"ARR_TIME": "Flight arrival time.",
"ARR_DELAY": "arrival delay time",
"ARR_DELAY_NEW": "arrival delay new",
"CANCELLED": "Flight cancellation indicator.",
"CANCELLATION_CODE": "cancellation code",
"CRS_ELAPSED_TIME": "scheduled elapsed time",
"ACTUAL_ELAPSED_TIME": "actual elapsed time",
"CARRIER_DELAY": "carrier delay",
"WEATHER_DELAY": "delay caused by the wheather problem",
"NAS_DELAY": "delay, in minutes, attributable to the National Aviation System",
"SECURITY_DELAY": "delay attribute to security",
"LATE_AIRCRAFT_DELAY": "delay attribute to late aircraft"
}*/
### Question
Please list the departure airports of the flights on 2018/8/1 that were delayed.
Clarification: departure airports refers ORIGIN; on 2018/8/1 refers to FL_DATE = '2018/8/1'; delayed refers to DEP_DELAY > 0;
| [query_database(**{'query': 'SELECT T1.Description FROM Airports AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.ORIGIN WHERE T2.FL_DATE = '2018/8/1' AND T2.DEP_DELAY > 0 GROUP BY T1.Description'})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE "Air Carriers"
(
Code INTEGER
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM `air carriers` LIMIT 1;
Code || Description
19031 ||Mackey International Inc.: MAC
*/
/* column definitions {
"Code": "the code of the air carriers",
"Description": "the description of air carriers"
}*/
CREATE TABLE Airports
(
Code TEXT
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM airports LIMIT 1;
Code || Description
01A ||Afognak Lake, AK: Afognak Lake Airport
*/
/* column definitions {
"Code": "IATA code of the air airports",
"Description": "the description of airports"
}*/
CREATE TABLE Airlines
(
FL_DATE TEXT,
OP_CARRIER_AIRLINE_ID INTEGER,
TAIL_NUM TEXT,
OP_CARRIER_FL_NUM INTEGER,
ORIGIN_AIRPORT_ID INTEGER,
ORIGIN_AIRPORT_SEQ_ID INTEGER,
ORIGIN_CITY_MARKET_ID INTEGER,
ORIGIN TEXT,
DEST_AIRPORT_ID INTEGER,
DEST_AIRPORT_SEQ_ID INTEGER,
DEST_CITY_MARKET_ID INTEGER,
DEST TEXT,
CRS_DEP_TIME INTEGER,
DEP_TIME INTEGER,
DEP_DELAY INTEGER,
DEP_DELAY_NEW INTEGER,
ARR_TIME INTEGER,
ARR_DELAY INTEGER,
ARR_DELAY_NEW INTEGER,
CANCELLED INTEGER,
CANCELLATION_CODE TEXT,
CRS_ELAPSED_TIME INTEGER,
ACTUAL_ELAPSED_TIME INTEGER,
CARRIER_DELAY INTEGER,
WEATHER_DELAY INTEGER,
NAS_DELAY INTEGER,
SECURITY_DELAY INTEGER,
LATE_AIRCRAFT_DELAY INTEGER,
FOREIGN KEY (ORIGIN) REFERENCES Airports(Code),
FOREIGN KEY (DEST) REFERENCES Airports(Code),
FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code)
)
/*
1 example row:
SELECT * FROM airlines LIMIT 1;
FL_DATE ||OP_CARRIER_AIRLINE_ID ||TAIL_NUM ||OP_CARRIER_FL_NUM ||ORIGIN_AIRPORT_ID ||ORIGIN_AIRPORT_SEQ_ID ||ORIGIN_CITY_MARKET_ID ||ORIGIN ||DEST_AIRPORT_ID ||DEST_AIRPORT_SEQ_ID ||DEST_CITY_MARKET_ID ||DEST ||CRS_DEP_TIME ||DEP_TIME ||DEP_DELAY ||DEP_DELAY_NEW ||ARR_TIME ||ARR_DELAY ||ARR_DELAY_NEW ||CANCELLED ||CANCELLATION_CODE ||CRS_ELAPSED_TIME ||ACTUAL_ELAPSED_TIME ||CARRIER_DELAY ||WEATHER_DELAY ||NAS_DELAY ||SECURITY_DELAY ||LATE_AIRCRAFT_DELAY
2018/8/1 || 19805 || N956AN || 1587 || 12478 || 1247805 || 31703 || JFK || 14107 || 1410702 || 30466 || PHX || 1640 || 1649 || 9 || 9 || 2006 || 44 || 44 || 0 || None || 342 || 377 || 9 || 0 || 35 || 0 || 0
*/
/* column definitions {
"FL_DATE": "flight date",
"OP_CARRIER_AIRLINE_ID": "operator carrier airline id",
"TAIL_NUM": "plane's tail number",
"OP_CARRIER_FL_NUM": "operator carrier flight number",
"ORIGIN_AIRPORT_ID": "origin airport id",
"ORIGIN_AIRPORT_SEQ_ID": "origin airport sequence id",
"ORIGIN_CITY_MARKET_ID": "origin city market id",
"ORIGIN": "airport of origin",
"DEST_AIRPORT_ID": "ID of the destination airport",
"DEST_AIRPORT_SEQ_ID": "",
"DEST_CITY_MARKET_ID": "",
"DEST": "Destination airport",
"CRS_DEP_TIME": "",
"DEP_TIME": "Flight departure time",
"DEP_DELAY": "Departure delay indicator",
"DEP_DELAY_NEW": "departure delay new",
"ARR_TIME": "Flight arrival time.",
"ARR_DELAY": "arrival delay time",
"ARR_DELAY_NEW": "arrival delay new",
"CANCELLED": "Flight cancellation indicator.",
"CANCELLATION_CODE": "cancellation code",
"CRS_ELAPSED_TIME": "scheduled elapsed time",
"ACTUAL_ELAPSED_TIME": "actual elapsed time",
"CARRIER_DELAY": "carrier delay",
"WEATHER_DELAY": "delay caused by the wheather problem",
"NAS_DELAY": "delay, in minutes, attributable to the National Aviation System",
"SECURITY_DELAY": "delay attribute to security",
"LATE_AIRCRAFT_DELAY": "delay attribute to late aircraft"
}*/
|
5,828 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE "Air Carriers"
(
Code INTEGER
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM `air carriers` LIMIT 1;
Code || Description
19031 ||Mackey International Inc.: MAC
*/
/* column definitions {
"Code": "the code of the air carriers",
"Description": "the description of air carriers"
}*/
CREATE TABLE Airports
(
Code TEXT
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM airports LIMIT 1;
Code || Description
01A ||Afognak Lake, AK: Afognak Lake Airport
*/
/* column definitions {
"Code": "IATA code of the air airports",
"Description": "the description of airports"
}*/
CREATE TABLE Airlines
(
FL_DATE TEXT,
OP_CARRIER_AIRLINE_ID INTEGER,
TAIL_NUM TEXT,
OP_CARRIER_FL_NUM INTEGER,
ORIGIN_AIRPORT_ID INTEGER,
ORIGIN_AIRPORT_SEQ_ID INTEGER,
ORIGIN_CITY_MARKET_ID INTEGER,
ORIGIN TEXT,
DEST_AIRPORT_ID INTEGER,
DEST_AIRPORT_SEQ_ID INTEGER,
DEST_CITY_MARKET_ID INTEGER,
DEST TEXT,
CRS_DEP_TIME INTEGER,
DEP_TIME INTEGER,
DEP_DELAY INTEGER,
DEP_DELAY_NEW INTEGER,
ARR_TIME INTEGER,
ARR_DELAY INTEGER,
ARR_DELAY_NEW INTEGER,
CANCELLED INTEGER,
CANCELLATION_CODE TEXT,
CRS_ELAPSED_TIME INTEGER,
ACTUAL_ELAPSED_TIME INTEGER,
CARRIER_DELAY INTEGER,
WEATHER_DELAY INTEGER,
NAS_DELAY INTEGER,
SECURITY_DELAY INTEGER,
LATE_AIRCRAFT_DELAY INTEGER,
FOREIGN KEY (ORIGIN) REFERENCES Airports(Code),
FOREIGN KEY (DEST) REFERENCES Airports(Code),
FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code)
)
/*
1 example row:
SELECT * FROM airlines LIMIT 1;
FL_DATE ||OP_CARRIER_AIRLINE_ID ||TAIL_NUM ||OP_CARRIER_FL_NUM ||ORIGIN_AIRPORT_ID ||ORIGIN_AIRPORT_SEQ_ID ||ORIGIN_CITY_MARKET_ID ||ORIGIN ||DEST_AIRPORT_ID ||DEST_AIRPORT_SEQ_ID ||DEST_CITY_MARKET_ID ||DEST ||CRS_DEP_TIME ||DEP_TIME ||DEP_DELAY ||DEP_DELAY_NEW ||ARR_TIME ||ARR_DELAY ||ARR_DELAY_NEW ||CANCELLED ||CANCELLATION_CODE ||CRS_ELAPSED_TIME ||ACTUAL_ELAPSED_TIME ||CARRIER_DELAY ||WEATHER_DELAY ||NAS_DELAY ||SECURITY_DELAY ||LATE_AIRCRAFT_DELAY
2018/8/1 || 19805 || N956AN || 1587 || 12478 || 1247805 || 31703 || JFK || 14107 || 1410702 || 30466 || PHX || 1640 || 1649 || 9 || 9 || 2006 || 44 || 44 || 0 || None || 342 || 377 || 9 || 0 || 35 || 0 || 0
*/
/* column definitions {
"FL_DATE": "flight date",
"OP_CARRIER_AIRLINE_ID": "operator carrier airline id",
"TAIL_NUM": "plane's tail number",
"OP_CARRIER_FL_NUM": "operator carrier flight number",
"ORIGIN_AIRPORT_ID": "origin airport id",
"ORIGIN_AIRPORT_SEQ_ID": "origin airport sequence id",
"ORIGIN_CITY_MARKET_ID": "origin city market id",
"ORIGIN": "airport of origin",
"DEST_AIRPORT_ID": "ID of the destination airport",
"DEST_AIRPORT_SEQ_ID": "",
"DEST_CITY_MARKET_ID": "",
"DEST": "Destination airport",
"CRS_DEP_TIME": "",
"DEP_TIME": "Flight departure time",
"DEP_DELAY": "Departure delay indicator",
"DEP_DELAY_NEW": "departure delay new",
"ARR_TIME": "Flight arrival time.",
"ARR_DELAY": "arrival delay time",
"ARR_DELAY_NEW": "arrival delay new",
"CANCELLED": "Flight cancellation indicator.",
"CANCELLATION_CODE": "cancellation code",
"CRS_ELAPSED_TIME": "scheduled elapsed time",
"ACTUAL_ELAPSED_TIME": "actual elapsed time",
"CARRIER_DELAY": "carrier delay",
"WEATHER_DELAY": "delay caused by the wheather problem",
"NAS_DELAY": "delay, in minutes, attributable to the National Aviation System",
"SECURITY_DELAY": "delay attribute to security",
"LATE_AIRCRAFT_DELAY": "delay attribute to late aircraft"
}*/
### Question
Among all the flights scheduled to depart from John F. Kennedy International on 2018/8/1, when was the earliest one scheduled to depart?
Clarification: depart from refers to ORIGIN; John F. Kennedy International refers to Description = 'New York, NY: John F. Kennedy International'; on 2018/8/1 refers to FL_DATE = '2018/8/1'; earliest one scheduled to depart refers to MIN(DEP_TIME);
| [query_database(**{'query': 'SELECT T2.DEP_TIME FROM Airports AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.ORIGIN WHERE T2.FL_DATE = '2018/8/1' AND T1.Description = 'New York, NY: John F. Kennedy International' AND T2.DEP_TIME IS NOT NULL ORDER BY T2.DEP_TIME ASC LIMIT 1'})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE "Air Carriers"
(
Code INTEGER
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM `air carriers` LIMIT 1;
Code || Description
19031 ||Mackey International Inc.: MAC
*/
/* column definitions {
"Code": "the code of the air carriers",
"Description": "the description of air carriers"
}*/
CREATE TABLE Airports
(
Code TEXT
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM airports LIMIT 1;
Code || Description
01A ||Afognak Lake, AK: Afognak Lake Airport
*/
/* column definitions {
"Code": "IATA code of the air airports",
"Description": "the description of airports"
}*/
CREATE TABLE Airlines
(
FL_DATE TEXT,
OP_CARRIER_AIRLINE_ID INTEGER,
TAIL_NUM TEXT,
OP_CARRIER_FL_NUM INTEGER,
ORIGIN_AIRPORT_ID INTEGER,
ORIGIN_AIRPORT_SEQ_ID INTEGER,
ORIGIN_CITY_MARKET_ID INTEGER,
ORIGIN TEXT,
DEST_AIRPORT_ID INTEGER,
DEST_AIRPORT_SEQ_ID INTEGER,
DEST_CITY_MARKET_ID INTEGER,
DEST TEXT,
CRS_DEP_TIME INTEGER,
DEP_TIME INTEGER,
DEP_DELAY INTEGER,
DEP_DELAY_NEW INTEGER,
ARR_TIME INTEGER,
ARR_DELAY INTEGER,
ARR_DELAY_NEW INTEGER,
CANCELLED INTEGER,
CANCELLATION_CODE TEXT,
CRS_ELAPSED_TIME INTEGER,
ACTUAL_ELAPSED_TIME INTEGER,
CARRIER_DELAY INTEGER,
WEATHER_DELAY INTEGER,
NAS_DELAY INTEGER,
SECURITY_DELAY INTEGER,
LATE_AIRCRAFT_DELAY INTEGER,
FOREIGN KEY (ORIGIN) REFERENCES Airports(Code),
FOREIGN KEY (DEST) REFERENCES Airports(Code),
FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code)
)
/*
1 example row:
SELECT * FROM airlines LIMIT 1;
FL_DATE ||OP_CARRIER_AIRLINE_ID ||TAIL_NUM ||OP_CARRIER_FL_NUM ||ORIGIN_AIRPORT_ID ||ORIGIN_AIRPORT_SEQ_ID ||ORIGIN_CITY_MARKET_ID ||ORIGIN ||DEST_AIRPORT_ID ||DEST_AIRPORT_SEQ_ID ||DEST_CITY_MARKET_ID ||DEST ||CRS_DEP_TIME ||DEP_TIME ||DEP_DELAY ||DEP_DELAY_NEW ||ARR_TIME ||ARR_DELAY ||ARR_DELAY_NEW ||CANCELLED ||CANCELLATION_CODE ||CRS_ELAPSED_TIME ||ACTUAL_ELAPSED_TIME ||CARRIER_DELAY ||WEATHER_DELAY ||NAS_DELAY ||SECURITY_DELAY ||LATE_AIRCRAFT_DELAY
2018/8/1 || 19805 || N956AN || 1587 || 12478 || 1247805 || 31703 || JFK || 14107 || 1410702 || 30466 || PHX || 1640 || 1649 || 9 || 9 || 2006 || 44 || 44 || 0 || None || 342 || 377 || 9 || 0 || 35 || 0 || 0
*/
/* column definitions {
"FL_DATE": "flight date",
"OP_CARRIER_AIRLINE_ID": "operator carrier airline id",
"TAIL_NUM": "plane's tail number",
"OP_CARRIER_FL_NUM": "operator carrier flight number",
"ORIGIN_AIRPORT_ID": "origin airport id",
"ORIGIN_AIRPORT_SEQ_ID": "origin airport sequence id",
"ORIGIN_CITY_MARKET_ID": "origin city market id",
"ORIGIN": "airport of origin",
"DEST_AIRPORT_ID": "ID of the destination airport",
"DEST_AIRPORT_SEQ_ID": "",
"DEST_CITY_MARKET_ID": "",
"DEST": "Destination airport",
"CRS_DEP_TIME": "",
"DEP_TIME": "Flight departure time",
"DEP_DELAY": "Departure delay indicator",
"DEP_DELAY_NEW": "departure delay new",
"ARR_TIME": "Flight arrival time.",
"ARR_DELAY": "arrival delay time",
"ARR_DELAY_NEW": "arrival delay new",
"CANCELLED": "Flight cancellation indicator.",
"CANCELLATION_CODE": "cancellation code",
"CRS_ELAPSED_TIME": "scheduled elapsed time",
"ACTUAL_ELAPSED_TIME": "actual elapsed time",
"CARRIER_DELAY": "carrier delay",
"WEATHER_DELAY": "delay caused by the wheather problem",
"NAS_DELAY": "delay, in minutes, attributable to the National Aviation System",
"SECURITY_DELAY": "delay attribute to security",
"LATE_AIRCRAFT_DELAY": "delay attribute to late aircraft"
}*/
|
5,832 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE "Air Carriers"
(
Code INTEGER
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM `air carriers` LIMIT 1;
Code || Description
19031 ||Mackey International Inc.: MAC
*/
/* column definitions {
"Code": "the code of the air carriers",
"Description": "the description of air carriers"
}*/
CREATE TABLE Airports
(
Code TEXT
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM airports LIMIT 1;
Code || Description
01A ||Afognak Lake, AK: Afognak Lake Airport
*/
/* column definitions {
"Code": "IATA code of the air airports",
"Description": "the description of airports"
}*/
CREATE TABLE Airlines
(
FL_DATE TEXT,
OP_CARRIER_AIRLINE_ID INTEGER,
TAIL_NUM TEXT,
OP_CARRIER_FL_NUM INTEGER,
ORIGIN_AIRPORT_ID INTEGER,
ORIGIN_AIRPORT_SEQ_ID INTEGER,
ORIGIN_CITY_MARKET_ID INTEGER,
ORIGIN TEXT,
DEST_AIRPORT_ID INTEGER,
DEST_AIRPORT_SEQ_ID INTEGER,
DEST_CITY_MARKET_ID INTEGER,
DEST TEXT,
CRS_DEP_TIME INTEGER,
DEP_TIME INTEGER,
DEP_DELAY INTEGER,
DEP_DELAY_NEW INTEGER,
ARR_TIME INTEGER,
ARR_DELAY INTEGER,
ARR_DELAY_NEW INTEGER,
CANCELLED INTEGER,
CANCELLATION_CODE TEXT,
CRS_ELAPSED_TIME INTEGER,
ACTUAL_ELAPSED_TIME INTEGER,
CARRIER_DELAY INTEGER,
WEATHER_DELAY INTEGER,
NAS_DELAY INTEGER,
SECURITY_DELAY INTEGER,
LATE_AIRCRAFT_DELAY INTEGER,
FOREIGN KEY (ORIGIN) REFERENCES Airports(Code),
FOREIGN KEY (DEST) REFERENCES Airports(Code),
FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code)
)
/*
1 example row:
SELECT * FROM airlines LIMIT 1;
FL_DATE ||OP_CARRIER_AIRLINE_ID ||TAIL_NUM ||OP_CARRIER_FL_NUM ||ORIGIN_AIRPORT_ID ||ORIGIN_AIRPORT_SEQ_ID ||ORIGIN_CITY_MARKET_ID ||ORIGIN ||DEST_AIRPORT_ID ||DEST_AIRPORT_SEQ_ID ||DEST_CITY_MARKET_ID ||DEST ||CRS_DEP_TIME ||DEP_TIME ||DEP_DELAY ||DEP_DELAY_NEW ||ARR_TIME ||ARR_DELAY ||ARR_DELAY_NEW ||CANCELLED ||CANCELLATION_CODE ||CRS_ELAPSED_TIME ||ACTUAL_ELAPSED_TIME ||CARRIER_DELAY ||WEATHER_DELAY ||NAS_DELAY ||SECURITY_DELAY ||LATE_AIRCRAFT_DELAY
2018/8/1 || 19805 || N956AN || 1587 || 12478 || 1247805 || 31703 || JFK || 14107 || 1410702 || 30466 || PHX || 1640 || 1649 || 9 || 9 || 2006 || 44 || 44 || 0 || None || 342 || 377 || 9 || 0 || 35 || 0 || 0
*/
/* column definitions {
"FL_DATE": "flight date",
"OP_CARRIER_AIRLINE_ID": "operator carrier airline id",
"TAIL_NUM": "plane's tail number",
"OP_CARRIER_FL_NUM": "operator carrier flight number",
"ORIGIN_AIRPORT_ID": "origin airport id",
"ORIGIN_AIRPORT_SEQ_ID": "origin airport sequence id",
"ORIGIN_CITY_MARKET_ID": "origin city market id",
"ORIGIN": "airport of origin",
"DEST_AIRPORT_ID": "ID of the destination airport",
"DEST_AIRPORT_SEQ_ID": "",
"DEST_CITY_MARKET_ID": "",
"DEST": "Destination airport",
"CRS_DEP_TIME": "",
"DEP_TIME": "Flight departure time",
"DEP_DELAY": "Departure delay indicator",
"DEP_DELAY_NEW": "departure delay new",
"ARR_TIME": "Flight arrival time.",
"ARR_DELAY": "arrival delay time",
"ARR_DELAY_NEW": "arrival delay new",
"CANCELLED": "Flight cancellation indicator.",
"CANCELLATION_CODE": "cancellation code",
"CRS_ELAPSED_TIME": "scheduled elapsed time",
"ACTUAL_ELAPSED_TIME": "actual elapsed time",
"CARRIER_DELAY": "carrier delay",
"WEATHER_DELAY": "delay caused by the wheather problem",
"NAS_DELAY": "delay, in minutes, attributable to the National Aviation System",
"SECURITY_DELAY": "delay attribute to security",
"LATE_AIRCRAFT_DELAY": "delay attribute to late aircraft"
}*/
### Question
What is the flight number of the flight operated by American Airlines Inc. that had the longest delay in departure?
Clarification: flight numbers refers to OP_CARRIER_FL_NUM; American Airlines Inc. refers to Description = 'American Airlines Inc.: AA'; longest delay in departure refers to MAX(DEP_DELAY);
| [query_database(**{'query': 'SELECT T1.OP_CARRIER_FL_NUM FROM Airlines AS T1 INNER JOIN Airports AS T2 ON T2.Code = T1.ORIGIN INNER JOIN `Air Carriers` AS T3 ON T1.OP_CARRIER_AIRLINE_ID = T3.Code WHERE T3.Description = 'American Airlines Inc.: AA' ORDER BY T1.DEP_TIME DESC LIMIT 1'})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE "Air Carriers"
(
Code INTEGER
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM `air carriers` LIMIT 1;
Code || Description
19031 ||Mackey International Inc.: MAC
*/
/* column definitions {
"Code": "the code of the air carriers",
"Description": "the description of air carriers"
}*/
CREATE TABLE Airports
(
Code TEXT
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM airports LIMIT 1;
Code || Description
01A ||Afognak Lake, AK: Afognak Lake Airport
*/
/* column definitions {
"Code": "IATA code of the air airports",
"Description": "the description of airports"
}*/
CREATE TABLE Airlines
(
FL_DATE TEXT,
OP_CARRIER_AIRLINE_ID INTEGER,
TAIL_NUM TEXT,
OP_CARRIER_FL_NUM INTEGER,
ORIGIN_AIRPORT_ID INTEGER,
ORIGIN_AIRPORT_SEQ_ID INTEGER,
ORIGIN_CITY_MARKET_ID INTEGER,
ORIGIN TEXT,
DEST_AIRPORT_ID INTEGER,
DEST_AIRPORT_SEQ_ID INTEGER,
DEST_CITY_MARKET_ID INTEGER,
DEST TEXT,
CRS_DEP_TIME INTEGER,
DEP_TIME INTEGER,
DEP_DELAY INTEGER,
DEP_DELAY_NEW INTEGER,
ARR_TIME INTEGER,
ARR_DELAY INTEGER,
ARR_DELAY_NEW INTEGER,
CANCELLED INTEGER,
CANCELLATION_CODE TEXT,
CRS_ELAPSED_TIME INTEGER,
ACTUAL_ELAPSED_TIME INTEGER,
CARRIER_DELAY INTEGER,
WEATHER_DELAY INTEGER,
NAS_DELAY INTEGER,
SECURITY_DELAY INTEGER,
LATE_AIRCRAFT_DELAY INTEGER,
FOREIGN KEY (ORIGIN) REFERENCES Airports(Code),
FOREIGN KEY (DEST) REFERENCES Airports(Code),
FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code)
)
/*
1 example row:
SELECT * FROM airlines LIMIT 1;
FL_DATE ||OP_CARRIER_AIRLINE_ID ||TAIL_NUM ||OP_CARRIER_FL_NUM ||ORIGIN_AIRPORT_ID ||ORIGIN_AIRPORT_SEQ_ID ||ORIGIN_CITY_MARKET_ID ||ORIGIN ||DEST_AIRPORT_ID ||DEST_AIRPORT_SEQ_ID ||DEST_CITY_MARKET_ID ||DEST ||CRS_DEP_TIME ||DEP_TIME ||DEP_DELAY ||DEP_DELAY_NEW ||ARR_TIME ||ARR_DELAY ||ARR_DELAY_NEW ||CANCELLED ||CANCELLATION_CODE ||CRS_ELAPSED_TIME ||ACTUAL_ELAPSED_TIME ||CARRIER_DELAY ||WEATHER_DELAY ||NAS_DELAY ||SECURITY_DELAY ||LATE_AIRCRAFT_DELAY
2018/8/1 || 19805 || N956AN || 1587 || 12478 || 1247805 || 31703 || JFK || 14107 || 1410702 || 30466 || PHX || 1640 || 1649 || 9 || 9 || 2006 || 44 || 44 || 0 || None || 342 || 377 || 9 || 0 || 35 || 0 || 0
*/
/* column definitions {
"FL_DATE": "flight date",
"OP_CARRIER_AIRLINE_ID": "operator carrier airline id",
"TAIL_NUM": "plane's tail number",
"OP_CARRIER_FL_NUM": "operator carrier flight number",
"ORIGIN_AIRPORT_ID": "origin airport id",
"ORIGIN_AIRPORT_SEQ_ID": "origin airport sequence id",
"ORIGIN_CITY_MARKET_ID": "origin city market id",
"ORIGIN": "airport of origin",
"DEST_AIRPORT_ID": "ID of the destination airport",
"DEST_AIRPORT_SEQ_ID": "",
"DEST_CITY_MARKET_ID": "",
"DEST": "Destination airport",
"CRS_DEP_TIME": "",
"DEP_TIME": "Flight departure time",
"DEP_DELAY": "Departure delay indicator",
"DEP_DELAY_NEW": "departure delay new",
"ARR_TIME": "Flight arrival time.",
"ARR_DELAY": "arrival delay time",
"ARR_DELAY_NEW": "arrival delay new",
"CANCELLED": "Flight cancellation indicator.",
"CANCELLATION_CODE": "cancellation code",
"CRS_ELAPSED_TIME": "scheduled elapsed time",
"ACTUAL_ELAPSED_TIME": "actual elapsed time",
"CARRIER_DELAY": "carrier delay",
"WEATHER_DELAY": "delay caused by the wheather problem",
"NAS_DELAY": "delay, in minutes, attributable to the National Aviation System",
"SECURITY_DELAY": "delay attribute to security",
"LATE_AIRCRAFT_DELAY": "delay attribute to late aircraft"
}*/
|
5,836 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE "Air Carriers"
(
Code INTEGER
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM `air carriers` LIMIT 1;
Code || Description
19031 ||Mackey International Inc.: MAC
*/
/* column definitions {
"Code": "the code of the air carriers",
"Description": "the description of air carriers"
}*/
CREATE TABLE Airports
(
Code TEXT
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM airports LIMIT 1;
Code || Description
01A ||Afognak Lake, AK: Afognak Lake Airport
*/
/* column definitions {
"Code": "IATA code of the air airports",
"Description": "the description of airports"
}*/
CREATE TABLE Airlines
(
FL_DATE TEXT,
OP_CARRIER_AIRLINE_ID INTEGER,
TAIL_NUM TEXT,
OP_CARRIER_FL_NUM INTEGER,
ORIGIN_AIRPORT_ID INTEGER,
ORIGIN_AIRPORT_SEQ_ID INTEGER,
ORIGIN_CITY_MARKET_ID INTEGER,
ORIGIN TEXT,
DEST_AIRPORT_ID INTEGER,
DEST_AIRPORT_SEQ_ID INTEGER,
DEST_CITY_MARKET_ID INTEGER,
DEST TEXT,
CRS_DEP_TIME INTEGER,
DEP_TIME INTEGER,
DEP_DELAY INTEGER,
DEP_DELAY_NEW INTEGER,
ARR_TIME INTEGER,
ARR_DELAY INTEGER,
ARR_DELAY_NEW INTEGER,
CANCELLED INTEGER,
CANCELLATION_CODE TEXT,
CRS_ELAPSED_TIME INTEGER,
ACTUAL_ELAPSED_TIME INTEGER,
CARRIER_DELAY INTEGER,
WEATHER_DELAY INTEGER,
NAS_DELAY INTEGER,
SECURITY_DELAY INTEGER,
LATE_AIRCRAFT_DELAY INTEGER,
FOREIGN KEY (ORIGIN) REFERENCES Airports(Code),
FOREIGN KEY (DEST) REFERENCES Airports(Code),
FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code)
)
/*
1 example row:
SELECT * FROM airlines LIMIT 1;
FL_DATE ||OP_CARRIER_AIRLINE_ID ||TAIL_NUM ||OP_CARRIER_FL_NUM ||ORIGIN_AIRPORT_ID ||ORIGIN_AIRPORT_SEQ_ID ||ORIGIN_CITY_MARKET_ID ||ORIGIN ||DEST_AIRPORT_ID ||DEST_AIRPORT_SEQ_ID ||DEST_CITY_MARKET_ID ||DEST ||CRS_DEP_TIME ||DEP_TIME ||DEP_DELAY ||DEP_DELAY_NEW ||ARR_TIME ||ARR_DELAY ||ARR_DELAY_NEW ||CANCELLED ||CANCELLATION_CODE ||CRS_ELAPSED_TIME ||ACTUAL_ELAPSED_TIME ||CARRIER_DELAY ||WEATHER_DELAY ||NAS_DELAY ||SECURITY_DELAY ||LATE_AIRCRAFT_DELAY
2018/8/1 || 19805 || N956AN || 1587 || 12478 || 1247805 || 31703 || JFK || 14107 || 1410702 || 30466 || PHX || 1640 || 1649 || 9 || 9 || 2006 || 44 || 44 || 0 || None || 342 || 377 || 9 || 0 || 35 || 0 || 0
*/
/* column definitions {
"FL_DATE": "flight date",
"OP_CARRIER_AIRLINE_ID": "operator carrier airline id",
"TAIL_NUM": "plane's tail number",
"OP_CARRIER_FL_NUM": "operator carrier flight number",
"ORIGIN_AIRPORT_ID": "origin airport id",
"ORIGIN_AIRPORT_SEQ_ID": "origin airport sequence id",
"ORIGIN_CITY_MARKET_ID": "origin city market id",
"ORIGIN": "airport of origin",
"DEST_AIRPORT_ID": "ID of the destination airport",
"DEST_AIRPORT_SEQ_ID": "",
"DEST_CITY_MARKET_ID": "",
"DEST": "Destination airport",
"CRS_DEP_TIME": "",
"DEP_TIME": "Flight departure time",
"DEP_DELAY": "Departure delay indicator",
"DEP_DELAY_NEW": "departure delay new",
"ARR_TIME": "Flight arrival time.",
"ARR_DELAY": "arrival delay time",
"ARR_DELAY_NEW": "arrival delay new",
"CANCELLED": "Flight cancellation indicator.",
"CANCELLATION_CODE": "cancellation code",
"CRS_ELAPSED_TIME": "scheduled elapsed time",
"ACTUAL_ELAPSED_TIME": "actual elapsed time",
"CARRIER_DELAY": "carrier delay",
"WEATHER_DELAY": "delay caused by the wheather problem",
"NAS_DELAY": "delay, in minutes, attributable to the National Aviation System",
"SECURITY_DELAY": "delay attribute to security",
"LATE_AIRCRAFT_DELAY": "delay attribute to late aircraft"
}*/
### Question
What is the average departure delay time of flights operated by American Airlines Inc.?
Clarification: average departure delay time = DIVIDE(SUM(DEP_DELAY), COUNT(Code)); American Airlines Inc. refers to Description = 'American Airlines Inc.: AA';
| [query_database(**{'query': 'SELECT AVG(T1.DEP_DELAY) FROM Airlines AS T1 INNER JOIN Airports AS T2 ON T2.Code = T1.ORIGIN INNER JOIN `Air Carriers` AS T3 ON T1.OP_CARRIER_AIRLINE_ID = T3.Code WHERE T3.Description = 'American Airlines Inc.: AA''})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE "Air Carriers"
(
Code INTEGER
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM `air carriers` LIMIT 1;
Code || Description
19031 ||Mackey International Inc.: MAC
*/
/* column definitions {
"Code": "the code of the air carriers",
"Description": "the description of air carriers"
}*/
CREATE TABLE Airports
(
Code TEXT
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM airports LIMIT 1;
Code || Description
01A ||Afognak Lake, AK: Afognak Lake Airport
*/
/* column definitions {
"Code": "IATA code of the air airports",
"Description": "the description of airports"
}*/
CREATE TABLE Airlines
(
FL_DATE TEXT,
OP_CARRIER_AIRLINE_ID INTEGER,
TAIL_NUM TEXT,
OP_CARRIER_FL_NUM INTEGER,
ORIGIN_AIRPORT_ID INTEGER,
ORIGIN_AIRPORT_SEQ_ID INTEGER,
ORIGIN_CITY_MARKET_ID INTEGER,
ORIGIN TEXT,
DEST_AIRPORT_ID INTEGER,
DEST_AIRPORT_SEQ_ID INTEGER,
DEST_CITY_MARKET_ID INTEGER,
DEST TEXT,
CRS_DEP_TIME INTEGER,
DEP_TIME INTEGER,
DEP_DELAY INTEGER,
DEP_DELAY_NEW INTEGER,
ARR_TIME INTEGER,
ARR_DELAY INTEGER,
ARR_DELAY_NEW INTEGER,
CANCELLED INTEGER,
CANCELLATION_CODE TEXT,
CRS_ELAPSED_TIME INTEGER,
ACTUAL_ELAPSED_TIME INTEGER,
CARRIER_DELAY INTEGER,
WEATHER_DELAY INTEGER,
NAS_DELAY INTEGER,
SECURITY_DELAY INTEGER,
LATE_AIRCRAFT_DELAY INTEGER,
FOREIGN KEY (ORIGIN) REFERENCES Airports(Code),
FOREIGN KEY (DEST) REFERENCES Airports(Code),
FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code)
)
/*
1 example row:
SELECT * FROM airlines LIMIT 1;
FL_DATE ||OP_CARRIER_AIRLINE_ID ||TAIL_NUM ||OP_CARRIER_FL_NUM ||ORIGIN_AIRPORT_ID ||ORIGIN_AIRPORT_SEQ_ID ||ORIGIN_CITY_MARKET_ID ||ORIGIN ||DEST_AIRPORT_ID ||DEST_AIRPORT_SEQ_ID ||DEST_CITY_MARKET_ID ||DEST ||CRS_DEP_TIME ||DEP_TIME ||DEP_DELAY ||DEP_DELAY_NEW ||ARR_TIME ||ARR_DELAY ||ARR_DELAY_NEW ||CANCELLED ||CANCELLATION_CODE ||CRS_ELAPSED_TIME ||ACTUAL_ELAPSED_TIME ||CARRIER_DELAY ||WEATHER_DELAY ||NAS_DELAY ||SECURITY_DELAY ||LATE_AIRCRAFT_DELAY
2018/8/1 || 19805 || N956AN || 1587 || 12478 || 1247805 || 31703 || JFK || 14107 || 1410702 || 30466 || PHX || 1640 || 1649 || 9 || 9 || 2006 || 44 || 44 || 0 || None || 342 || 377 || 9 || 0 || 35 || 0 || 0
*/
/* column definitions {
"FL_DATE": "flight date",
"OP_CARRIER_AIRLINE_ID": "operator carrier airline id",
"TAIL_NUM": "plane's tail number",
"OP_CARRIER_FL_NUM": "operator carrier flight number",
"ORIGIN_AIRPORT_ID": "origin airport id",
"ORIGIN_AIRPORT_SEQ_ID": "origin airport sequence id",
"ORIGIN_CITY_MARKET_ID": "origin city market id",
"ORIGIN": "airport of origin",
"DEST_AIRPORT_ID": "ID of the destination airport",
"DEST_AIRPORT_SEQ_ID": "",
"DEST_CITY_MARKET_ID": "",
"DEST": "Destination airport",
"CRS_DEP_TIME": "",
"DEP_TIME": "Flight departure time",
"DEP_DELAY": "Departure delay indicator",
"DEP_DELAY_NEW": "departure delay new",
"ARR_TIME": "Flight arrival time.",
"ARR_DELAY": "arrival delay time",
"ARR_DELAY_NEW": "arrival delay new",
"CANCELLED": "Flight cancellation indicator.",
"CANCELLATION_CODE": "cancellation code",
"CRS_ELAPSED_TIME": "scheduled elapsed time",
"ACTUAL_ELAPSED_TIME": "actual elapsed time",
"CARRIER_DELAY": "carrier delay",
"WEATHER_DELAY": "delay caused by the wheather problem",
"NAS_DELAY": "delay, in minutes, attributable to the National Aviation System",
"SECURITY_DELAY": "delay attribute to security",
"LATE_AIRCRAFT_DELAY": "delay attribute to late aircraft"
}*/
|
5,840 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE "Air Carriers"
(
Code INTEGER
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM `air carriers` LIMIT 1;
Code || Description
19031 ||Mackey International Inc.: MAC
*/
/* column definitions {
"Code": "the code of the air carriers",
"Description": "the description of air carriers"
}*/
CREATE TABLE Airports
(
Code TEXT
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM airports LIMIT 1;
Code || Description
01A ||Afognak Lake, AK: Afognak Lake Airport
*/
/* column definitions {
"Code": "IATA code of the air airports",
"Description": "the description of airports"
}*/
CREATE TABLE Airlines
(
FL_DATE TEXT,
OP_CARRIER_AIRLINE_ID INTEGER,
TAIL_NUM TEXT,
OP_CARRIER_FL_NUM INTEGER,
ORIGIN_AIRPORT_ID INTEGER,
ORIGIN_AIRPORT_SEQ_ID INTEGER,
ORIGIN_CITY_MARKET_ID INTEGER,
ORIGIN TEXT,
DEST_AIRPORT_ID INTEGER,
DEST_AIRPORT_SEQ_ID INTEGER,
DEST_CITY_MARKET_ID INTEGER,
DEST TEXT,
CRS_DEP_TIME INTEGER,
DEP_TIME INTEGER,
DEP_DELAY INTEGER,
DEP_DELAY_NEW INTEGER,
ARR_TIME INTEGER,
ARR_DELAY INTEGER,
ARR_DELAY_NEW INTEGER,
CANCELLED INTEGER,
CANCELLATION_CODE TEXT,
CRS_ELAPSED_TIME INTEGER,
ACTUAL_ELAPSED_TIME INTEGER,
CARRIER_DELAY INTEGER,
WEATHER_DELAY INTEGER,
NAS_DELAY INTEGER,
SECURITY_DELAY INTEGER,
LATE_AIRCRAFT_DELAY INTEGER,
FOREIGN KEY (ORIGIN) REFERENCES Airports(Code),
FOREIGN KEY (DEST) REFERENCES Airports(Code),
FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code)
)
/*
1 example row:
SELECT * FROM airlines LIMIT 1;
FL_DATE ||OP_CARRIER_AIRLINE_ID ||TAIL_NUM ||OP_CARRIER_FL_NUM ||ORIGIN_AIRPORT_ID ||ORIGIN_AIRPORT_SEQ_ID ||ORIGIN_CITY_MARKET_ID ||ORIGIN ||DEST_AIRPORT_ID ||DEST_AIRPORT_SEQ_ID ||DEST_CITY_MARKET_ID ||DEST ||CRS_DEP_TIME ||DEP_TIME ||DEP_DELAY ||DEP_DELAY_NEW ||ARR_TIME ||ARR_DELAY ||ARR_DELAY_NEW ||CANCELLED ||CANCELLATION_CODE ||CRS_ELAPSED_TIME ||ACTUAL_ELAPSED_TIME ||CARRIER_DELAY ||WEATHER_DELAY ||NAS_DELAY ||SECURITY_DELAY ||LATE_AIRCRAFT_DELAY
2018/8/1 || 19805 || N956AN || 1587 || 12478 || 1247805 || 31703 || JFK || 14107 || 1410702 || 30466 || PHX || 1640 || 1649 || 9 || 9 || 2006 || 44 || 44 || 0 || None || 342 || 377 || 9 || 0 || 35 || 0 || 0
*/
/* column definitions {
"FL_DATE": "flight date",
"OP_CARRIER_AIRLINE_ID": "operator carrier airline id",
"TAIL_NUM": "plane's tail number",
"OP_CARRIER_FL_NUM": "operator carrier flight number",
"ORIGIN_AIRPORT_ID": "origin airport id",
"ORIGIN_AIRPORT_SEQ_ID": "origin airport sequence id",
"ORIGIN_CITY_MARKET_ID": "origin city market id",
"ORIGIN": "airport of origin",
"DEST_AIRPORT_ID": "ID of the destination airport",
"DEST_AIRPORT_SEQ_ID": "",
"DEST_CITY_MARKET_ID": "",
"DEST": "Destination airport",
"CRS_DEP_TIME": "",
"DEP_TIME": "Flight departure time",
"DEP_DELAY": "Departure delay indicator",
"DEP_DELAY_NEW": "departure delay new",
"ARR_TIME": "Flight arrival time.",
"ARR_DELAY": "arrival delay time",
"ARR_DELAY_NEW": "arrival delay new",
"CANCELLED": "Flight cancellation indicator.",
"CANCELLATION_CODE": "cancellation code",
"CRS_ELAPSED_TIME": "scheduled elapsed time",
"ACTUAL_ELAPSED_TIME": "actual elapsed time",
"CARRIER_DELAY": "carrier delay",
"WEATHER_DELAY": "delay caused by the wheather problem",
"NAS_DELAY": "delay, in minutes, attributable to the National Aviation System",
"SECURITY_DELAY": "delay attribute to security",
"LATE_AIRCRAFT_DELAY": "delay attribute to late aircraft"
}*/
### Question
Provide the number of airplanes that landed on Oakland Airport on 2018/8/7.
Clarification: landed on refers to DEST; Oakland Airport refers to Description which contains 'Oakland'; on 2018/8/7 refers to FL_DATE = '2018/8/7';
| [query_database(**{'query': 'SELECT SUM(CASE WHEN T1.Description LIKE '%Oakland%' THEN 1 ELSE 0 END) AS count FROM Airports AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.DEST WHERE T2.FL_DATE = '2018/8/7''})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE "Air Carriers"
(
Code INTEGER
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM `air carriers` LIMIT 1;
Code || Description
19031 ||Mackey International Inc.: MAC
*/
/* column definitions {
"Code": "the code of the air carriers",
"Description": "the description of air carriers"
}*/
CREATE TABLE Airports
(
Code TEXT
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM airports LIMIT 1;
Code || Description
01A ||Afognak Lake, AK: Afognak Lake Airport
*/
/* column definitions {
"Code": "IATA code of the air airports",
"Description": "the description of airports"
}*/
CREATE TABLE Airlines
(
FL_DATE TEXT,
OP_CARRIER_AIRLINE_ID INTEGER,
TAIL_NUM TEXT,
OP_CARRIER_FL_NUM INTEGER,
ORIGIN_AIRPORT_ID INTEGER,
ORIGIN_AIRPORT_SEQ_ID INTEGER,
ORIGIN_CITY_MARKET_ID INTEGER,
ORIGIN TEXT,
DEST_AIRPORT_ID INTEGER,
DEST_AIRPORT_SEQ_ID INTEGER,
DEST_CITY_MARKET_ID INTEGER,
DEST TEXT,
CRS_DEP_TIME INTEGER,
DEP_TIME INTEGER,
DEP_DELAY INTEGER,
DEP_DELAY_NEW INTEGER,
ARR_TIME INTEGER,
ARR_DELAY INTEGER,
ARR_DELAY_NEW INTEGER,
CANCELLED INTEGER,
CANCELLATION_CODE TEXT,
CRS_ELAPSED_TIME INTEGER,
ACTUAL_ELAPSED_TIME INTEGER,
CARRIER_DELAY INTEGER,
WEATHER_DELAY INTEGER,
NAS_DELAY INTEGER,
SECURITY_DELAY INTEGER,
LATE_AIRCRAFT_DELAY INTEGER,
FOREIGN KEY (ORIGIN) REFERENCES Airports(Code),
FOREIGN KEY (DEST) REFERENCES Airports(Code),
FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code)
)
/*
1 example row:
SELECT * FROM airlines LIMIT 1;
FL_DATE ||OP_CARRIER_AIRLINE_ID ||TAIL_NUM ||OP_CARRIER_FL_NUM ||ORIGIN_AIRPORT_ID ||ORIGIN_AIRPORT_SEQ_ID ||ORIGIN_CITY_MARKET_ID ||ORIGIN ||DEST_AIRPORT_ID ||DEST_AIRPORT_SEQ_ID ||DEST_CITY_MARKET_ID ||DEST ||CRS_DEP_TIME ||DEP_TIME ||DEP_DELAY ||DEP_DELAY_NEW ||ARR_TIME ||ARR_DELAY ||ARR_DELAY_NEW ||CANCELLED ||CANCELLATION_CODE ||CRS_ELAPSED_TIME ||ACTUAL_ELAPSED_TIME ||CARRIER_DELAY ||WEATHER_DELAY ||NAS_DELAY ||SECURITY_DELAY ||LATE_AIRCRAFT_DELAY
2018/8/1 || 19805 || N956AN || 1587 || 12478 || 1247805 || 31703 || JFK || 14107 || 1410702 || 30466 || PHX || 1640 || 1649 || 9 || 9 || 2006 || 44 || 44 || 0 || None || 342 || 377 || 9 || 0 || 35 || 0 || 0
*/
/* column definitions {
"FL_DATE": "flight date",
"OP_CARRIER_AIRLINE_ID": "operator carrier airline id",
"TAIL_NUM": "plane's tail number",
"OP_CARRIER_FL_NUM": "operator carrier flight number",
"ORIGIN_AIRPORT_ID": "origin airport id",
"ORIGIN_AIRPORT_SEQ_ID": "origin airport sequence id",
"ORIGIN_CITY_MARKET_ID": "origin city market id",
"ORIGIN": "airport of origin",
"DEST_AIRPORT_ID": "ID of the destination airport",
"DEST_AIRPORT_SEQ_ID": "",
"DEST_CITY_MARKET_ID": "",
"DEST": "Destination airport",
"CRS_DEP_TIME": "",
"DEP_TIME": "Flight departure time",
"DEP_DELAY": "Departure delay indicator",
"DEP_DELAY_NEW": "departure delay new",
"ARR_TIME": "Flight arrival time.",
"ARR_DELAY": "arrival delay time",
"ARR_DELAY_NEW": "arrival delay new",
"CANCELLED": "Flight cancellation indicator.",
"CANCELLATION_CODE": "cancellation code",
"CRS_ELAPSED_TIME": "scheduled elapsed time",
"ACTUAL_ELAPSED_TIME": "actual elapsed time",
"CARRIER_DELAY": "carrier delay",
"WEATHER_DELAY": "delay caused by the wheather problem",
"NAS_DELAY": "delay, in minutes, attributable to the National Aviation System",
"SECURITY_DELAY": "delay attribute to security",
"LATE_AIRCRAFT_DELAY": "delay attribute to late aircraft"
}*/
|
5,844 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE "Air Carriers"
(
Code INTEGER
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM `air carriers` LIMIT 1;
Code || Description
19031 ||Mackey International Inc.: MAC
*/
/* column definitions {
"Code": "the code of the air carriers",
"Description": "the description of air carriers"
}*/
CREATE TABLE Airports
(
Code TEXT
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM airports LIMIT 1;
Code || Description
01A ||Afognak Lake, AK: Afognak Lake Airport
*/
/* column definitions {
"Code": "IATA code of the air airports",
"Description": "the description of airports"
}*/
CREATE TABLE Airlines
(
FL_DATE TEXT,
OP_CARRIER_AIRLINE_ID INTEGER,
TAIL_NUM TEXT,
OP_CARRIER_FL_NUM INTEGER,
ORIGIN_AIRPORT_ID INTEGER,
ORIGIN_AIRPORT_SEQ_ID INTEGER,
ORIGIN_CITY_MARKET_ID INTEGER,
ORIGIN TEXT,
DEST_AIRPORT_ID INTEGER,
DEST_AIRPORT_SEQ_ID INTEGER,
DEST_CITY_MARKET_ID INTEGER,
DEST TEXT,
CRS_DEP_TIME INTEGER,
DEP_TIME INTEGER,
DEP_DELAY INTEGER,
DEP_DELAY_NEW INTEGER,
ARR_TIME INTEGER,
ARR_DELAY INTEGER,
ARR_DELAY_NEW INTEGER,
CANCELLED INTEGER,
CANCELLATION_CODE TEXT,
CRS_ELAPSED_TIME INTEGER,
ACTUAL_ELAPSED_TIME INTEGER,
CARRIER_DELAY INTEGER,
WEATHER_DELAY INTEGER,
NAS_DELAY INTEGER,
SECURITY_DELAY INTEGER,
LATE_AIRCRAFT_DELAY INTEGER,
FOREIGN KEY (ORIGIN) REFERENCES Airports(Code),
FOREIGN KEY (DEST) REFERENCES Airports(Code),
FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code)
)
/*
1 example row:
SELECT * FROM airlines LIMIT 1;
FL_DATE ||OP_CARRIER_AIRLINE_ID ||TAIL_NUM ||OP_CARRIER_FL_NUM ||ORIGIN_AIRPORT_ID ||ORIGIN_AIRPORT_SEQ_ID ||ORIGIN_CITY_MARKET_ID ||ORIGIN ||DEST_AIRPORT_ID ||DEST_AIRPORT_SEQ_ID ||DEST_CITY_MARKET_ID ||DEST ||CRS_DEP_TIME ||DEP_TIME ||DEP_DELAY ||DEP_DELAY_NEW ||ARR_TIME ||ARR_DELAY ||ARR_DELAY_NEW ||CANCELLED ||CANCELLATION_CODE ||CRS_ELAPSED_TIME ||ACTUAL_ELAPSED_TIME ||CARRIER_DELAY ||WEATHER_DELAY ||NAS_DELAY ||SECURITY_DELAY ||LATE_AIRCRAFT_DELAY
2018/8/1 || 19805 || N956AN || 1587 || 12478 || 1247805 || 31703 || JFK || 14107 || 1410702 || 30466 || PHX || 1640 || 1649 || 9 || 9 || 2006 || 44 || 44 || 0 || None || 342 || 377 || 9 || 0 || 35 || 0 || 0
*/
/* column definitions {
"FL_DATE": "flight date",
"OP_CARRIER_AIRLINE_ID": "operator carrier airline id",
"TAIL_NUM": "plane's tail number",
"OP_CARRIER_FL_NUM": "operator carrier flight number",
"ORIGIN_AIRPORT_ID": "origin airport id",
"ORIGIN_AIRPORT_SEQ_ID": "origin airport sequence id",
"ORIGIN_CITY_MARKET_ID": "origin city market id",
"ORIGIN": "airport of origin",
"DEST_AIRPORT_ID": "ID of the destination airport",
"DEST_AIRPORT_SEQ_ID": "",
"DEST_CITY_MARKET_ID": "",
"DEST": "Destination airport",
"CRS_DEP_TIME": "",
"DEP_TIME": "Flight departure time",
"DEP_DELAY": "Departure delay indicator",
"DEP_DELAY_NEW": "departure delay new",
"ARR_TIME": "Flight arrival time.",
"ARR_DELAY": "arrival delay time",
"ARR_DELAY_NEW": "arrival delay new",
"CANCELLED": "Flight cancellation indicator.",
"CANCELLATION_CODE": "cancellation code",
"CRS_ELAPSED_TIME": "scheduled elapsed time",
"ACTUAL_ELAPSED_TIME": "actual elapsed time",
"CARRIER_DELAY": "carrier delay",
"WEATHER_DELAY": "delay caused by the wheather problem",
"NAS_DELAY": "delay, in minutes, attributable to the National Aviation System",
"SECURITY_DELAY": "delay attribute to security",
"LATE_AIRCRAFT_DELAY": "delay attribute to late aircraft"
}*/
### Question
How many flights of Endeavor Air Inc. were faster than scheduled on 2018/8/31?
Clarification: Endeavor Air Inc. refers to Description = 'Endeavor Air Inc.: 9E'; faster than scheduled refers to ACTUAL_ELAPSED_TIME < CRS_ELAPSED_TIME; on 2018/8/31 refers to FL_DATE = '2018/8/31';
| [query_database(**{'query': 'SELECT SUM(CASE WHEN T1.ACTUAL_ELAPSED_TIME < CRS_ELAPSED_TIME THEN 1 ELSE 0 END) AS count FROM Airlines AS T1 INNER JOIN `Air Carriers` AS T2 ON T1.OP_CARRIER_AIRLINE_ID = T2.Code WHERE T1.FL_DATE = '2018/8/31' AND T2.Description = 'Endeavor Air Inc.: 9E''})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE "Air Carriers"
(
Code INTEGER
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM `air carriers` LIMIT 1;
Code || Description
19031 ||Mackey International Inc.: MAC
*/
/* column definitions {
"Code": "the code of the air carriers",
"Description": "the description of air carriers"
}*/
CREATE TABLE Airports
(
Code TEXT
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM airports LIMIT 1;
Code || Description
01A ||Afognak Lake, AK: Afognak Lake Airport
*/
/* column definitions {
"Code": "IATA code of the air airports",
"Description": "the description of airports"
}*/
CREATE TABLE Airlines
(
FL_DATE TEXT,
OP_CARRIER_AIRLINE_ID INTEGER,
TAIL_NUM TEXT,
OP_CARRIER_FL_NUM INTEGER,
ORIGIN_AIRPORT_ID INTEGER,
ORIGIN_AIRPORT_SEQ_ID INTEGER,
ORIGIN_CITY_MARKET_ID INTEGER,
ORIGIN TEXT,
DEST_AIRPORT_ID INTEGER,
DEST_AIRPORT_SEQ_ID INTEGER,
DEST_CITY_MARKET_ID INTEGER,
DEST TEXT,
CRS_DEP_TIME INTEGER,
DEP_TIME INTEGER,
DEP_DELAY INTEGER,
DEP_DELAY_NEW INTEGER,
ARR_TIME INTEGER,
ARR_DELAY INTEGER,
ARR_DELAY_NEW INTEGER,
CANCELLED INTEGER,
CANCELLATION_CODE TEXT,
CRS_ELAPSED_TIME INTEGER,
ACTUAL_ELAPSED_TIME INTEGER,
CARRIER_DELAY INTEGER,
WEATHER_DELAY INTEGER,
NAS_DELAY INTEGER,
SECURITY_DELAY INTEGER,
LATE_AIRCRAFT_DELAY INTEGER,
FOREIGN KEY (ORIGIN) REFERENCES Airports(Code),
FOREIGN KEY (DEST) REFERENCES Airports(Code),
FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code)
)
/*
1 example row:
SELECT * FROM airlines LIMIT 1;
FL_DATE ||OP_CARRIER_AIRLINE_ID ||TAIL_NUM ||OP_CARRIER_FL_NUM ||ORIGIN_AIRPORT_ID ||ORIGIN_AIRPORT_SEQ_ID ||ORIGIN_CITY_MARKET_ID ||ORIGIN ||DEST_AIRPORT_ID ||DEST_AIRPORT_SEQ_ID ||DEST_CITY_MARKET_ID ||DEST ||CRS_DEP_TIME ||DEP_TIME ||DEP_DELAY ||DEP_DELAY_NEW ||ARR_TIME ||ARR_DELAY ||ARR_DELAY_NEW ||CANCELLED ||CANCELLATION_CODE ||CRS_ELAPSED_TIME ||ACTUAL_ELAPSED_TIME ||CARRIER_DELAY ||WEATHER_DELAY ||NAS_DELAY ||SECURITY_DELAY ||LATE_AIRCRAFT_DELAY
2018/8/1 || 19805 || N956AN || 1587 || 12478 || 1247805 || 31703 || JFK || 14107 || 1410702 || 30466 || PHX || 1640 || 1649 || 9 || 9 || 2006 || 44 || 44 || 0 || None || 342 || 377 || 9 || 0 || 35 || 0 || 0
*/
/* column definitions {
"FL_DATE": "flight date",
"OP_CARRIER_AIRLINE_ID": "operator carrier airline id",
"TAIL_NUM": "plane's tail number",
"OP_CARRIER_FL_NUM": "operator carrier flight number",
"ORIGIN_AIRPORT_ID": "origin airport id",
"ORIGIN_AIRPORT_SEQ_ID": "origin airport sequence id",
"ORIGIN_CITY_MARKET_ID": "origin city market id",
"ORIGIN": "airport of origin",
"DEST_AIRPORT_ID": "ID of the destination airport",
"DEST_AIRPORT_SEQ_ID": "",
"DEST_CITY_MARKET_ID": "",
"DEST": "Destination airport",
"CRS_DEP_TIME": "",
"DEP_TIME": "Flight departure time",
"DEP_DELAY": "Departure delay indicator",
"DEP_DELAY_NEW": "departure delay new",
"ARR_TIME": "Flight arrival time.",
"ARR_DELAY": "arrival delay time",
"ARR_DELAY_NEW": "arrival delay new",
"CANCELLED": "Flight cancellation indicator.",
"CANCELLATION_CODE": "cancellation code",
"CRS_ELAPSED_TIME": "scheduled elapsed time",
"ACTUAL_ELAPSED_TIME": "actual elapsed time",
"CARRIER_DELAY": "carrier delay",
"WEATHER_DELAY": "delay caused by the wheather problem",
"NAS_DELAY": "delay, in minutes, attributable to the National Aviation System",
"SECURITY_DELAY": "delay attribute to security",
"LATE_AIRCRAFT_DELAY": "delay attribute to late aircraft"
}*/
|
5,848 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE "Air Carriers"
(
Code INTEGER
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM `air carriers` LIMIT 1;
Code || Description
19031 ||Mackey International Inc.: MAC
*/
/* column definitions {
"Code": "the code of the air carriers",
"Description": "the description of air carriers"
}*/
CREATE TABLE Airports
(
Code TEXT
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM airports LIMIT 1;
Code || Description
01A ||Afognak Lake, AK: Afognak Lake Airport
*/
/* column definitions {
"Code": "IATA code of the air airports",
"Description": "the description of airports"
}*/
CREATE TABLE Airlines
(
FL_DATE TEXT,
OP_CARRIER_AIRLINE_ID INTEGER,
TAIL_NUM TEXT,
OP_CARRIER_FL_NUM INTEGER,
ORIGIN_AIRPORT_ID INTEGER,
ORIGIN_AIRPORT_SEQ_ID INTEGER,
ORIGIN_CITY_MARKET_ID INTEGER,
ORIGIN TEXT,
DEST_AIRPORT_ID INTEGER,
DEST_AIRPORT_SEQ_ID INTEGER,
DEST_CITY_MARKET_ID INTEGER,
DEST TEXT,
CRS_DEP_TIME INTEGER,
DEP_TIME INTEGER,
DEP_DELAY INTEGER,
DEP_DELAY_NEW INTEGER,
ARR_TIME INTEGER,
ARR_DELAY INTEGER,
ARR_DELAY_NEW INTEGER,
CANCELLED INTEGER,
CANCELLATION_CODE TEXT,
CRS_ELAPSED_TIME INTEGER,
ACTUAL_ELAPSED_TIME INTEGER,
CARRIER_DELAY INTEGER,
WEATHER_DELAY INTEGER,
NAS_DELAY INTEGER,
SECURITY_DELAY INTEGER,
LATE_AIRCRAFT_DELAY INTEGER,
FOREIGN KEY (ORIGIN) REFERENCES Airports(Code),
FOREIGN KEY (DEST) REFERENCES Airports(Code),
FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code)
)
/*
1 example row:
SELECT * FROM airlines LIMIT 1;
FL_DATE ||OP_CARRIER_AIRLINE_ID ||TAIL_NUM ||OP_CARRIER_FL_NUM ||ORIGIN_AIRPORT_ID ||ORIGIN_AIRPORT_SEQ_ID ||ORIGIN_CITY_MARKET_ID ||ORIGIN ||DEST_AIRPORT_ID ||DEST_AIRPORT_SEQ_ID ||DEST_CITY_MARKET_ID ||DEST ||CRS_DEP_TIME ||DEP_TIME ||DEP_DELAY ||DEP_DELAY_NEW ||ARR_TIME ||ARR_DELAY ||ARR_DELAY_NEW ||CANCELLED ||CANCELLATION_CODE ||CRS_ELAPSED_TIME ||ACTUAL_ELAPSED_TIME ||CARRIER_DELAY ||WEATHER_DELAY ||NAS_DELAY ||SECURITY_DELAY ||LATE_AIRCRAFT_DELAY
2018/8/1 || 19805 || N956AN || 1587 || 12478 || 1247805 || 31703 || JFK || 14107 || 1410702 || 30466 || PHX || 1640 || 1649 || 9 || 9 || 2006 || 44 || 44 || 0 || None || 342 || 377 || 9 || 0 || 35 || 0 || 0
*/
/* column definitions {
"FL_DATE": "flight date",
"OP_CARRIER_AIRLINE_ID": "operator carrier airline id",
"TAIL_NUM": "plane's tail number",
"OP_CARRIER_FL_NUM": "operator carrier flight number",
"ORIGIN_AIRPORT_ID": "origin airport id",
"ORIGIN_AIRPORT_SEQ_ID": "origin airport sequence id",
"ORIGIN_CITY_MARKET_ID": "origin city market id",
"ORIGIN": "airport of origin",
"DEST_AIRPORT_ID": "ID of the destination airport",
"DEST_AIRPORT_SEQ_ID": "",
"DEST_CITY_MARKET_ID": "",
"DEST": "Destination airport",
"CRS_DEP_TIME": "",
"DEP_TIME": "Flight departure time",
"DEP_DELAY": "Departure delay indicator",
"DEP_DELAY_NEW": "departure delay new",
"ARR_TIME": "Flight arrival time.",
"ARR_DELAY": "arrival delay time",
"ARR_DELAY_NEW": "arrival delay new",
"CANCELLED": "Flight cancellation indicator.",
"CANCELLATION_CODE": "cancellation code",
"CRS_ELAPSED_TIME": "scheduled elapsed time",
"ACTUAL_ELAPSED_TIME": "actual elapsed time",
"CARRIER_DELAY": "carrier delay",
"WEATHER_DELAY": "delay caused by the wheather problem",
"NAS_DELAY": "delay, in minutes, attributable to the National Aviation System",
"SECURITY_DELAY": "delay attribute to security",
"LATE_AIRCRAFT_DELAY": "delay attribute to late aircraft"
}*/
### Question
For the flight from ATL to PHL on 2018/8/1 that scheduled local departure time as "2040", which air carrier does this flight belong to?
Clarification: flight from ATL refers to ORIGIN = 'ATL'; flight to PHL refers to DEST = 'PHL'; on 2018/8/1 refers to FL_DATE = '2018/8/1'; local departure time refers to CRS_DEP_TIME; CRS_DEP_TIME = '2040';
| [query_database(**{'query': 'SELECT T2.Description FROM Airlines AS T1 INNER JOIN `Air Carriers` AS T2 ON T1.OP_CARRIER_AIRLINE_ID = T2.Code WHERE T1.FL_DATE = '2018/8/1' AND T1.ORIGIN = 'ATL' AND T1.DEST = 'PHL' AND T1.CRS_DEP_TIME = '2040' GROUP BY T2.Description'})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE "Air Carriers"
(
Code INTEGER
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM `air carriers` LIMIT 1;
Code || Description
19031 ||Mackey International Inc.: MAC
*/
/* column definitions {
"Code": "the code of the air carriers",
"Description": "the description of air carriers"
}*/
CREATE TABLE Airports
(
Code TEXT
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM airports LIMIT 1;
Code || Description
01A ||Afognak Lake, AK: Afognak Lake Airport
*/
/* column definitions {
"Code": "IATA code of the air airports",
"Description": "the description of airports"
}*/
CREATE TABLE Airlines
(
FL_DATE TEXT,
OP_CARRIER_AIRLINE_ID INTEGER,
TAIL_NUM TEXT,
OP_CARRIER_FL_NUM INTEGER,
ORIGIN_AIRPORT_ID INTEGER,
ORIGIN_AIRPORT_SEQ_ID INTEGER,
ORIGIN_CITY_MARKET_ID INTEGER,
ORIGIN TEXT,
DEST_AIRPORT_ID INTEGER,
DEST_AIRPORT_SEQ_ID INTEGER,
DEST_CITY_MARKET_ID INTEGER,
DEST TEXT,
CRS_DEP_TIME INTEGER,
DEP_TIME INTEGER,
DEP_DELAY INTEGER,
DEP_DELAY_NEW INTEGER,
ARR_TIME INTEGER,
ARR_DELAY INTEGER,
ARR_DELAY_NEW INTEGER,
CANCELLED INTEGER,
CANCELLATION_CODE TEXT,
CRS_ELAPSED_TIME INTEGER,
ACTUAL_ELAPSED_TIME INTEGER,
CARRIER_DELAY INTEGER,
WEATHER_DELAY INTEGER,
NAS_DELAY INTEGER,
SECURITY_DELAY INTEGER,
LATE_AIRCRAFT_DELAY INTEGER,
FOREIGN KEY (ORIGIN) REFERENCES Airports(Code),
FOREIGN KEY (DEST) REFERENCES Airports(Code),
FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code)
)
/*
1 example row:
SELECT * FROM airlines LIMIT 1;
FL_DATE ||OP_CARRIER_AIRLINE_ID ||TAIL_NUM ||OP_CARRIER_FL_NUM ||ORIGIN_AIRPORT_ID ||ORIGIN_AIRPORT_SEQ_ID ||ORIGIN_CITY_MARKET_ID ||ORIGIN ||DEST_AIRPORT_ID ||DEST_AIRPORT_SEQ_ID ||DEST_CITY_MARKET_ID ||DEST ||CRS_DEP_TIME ||DEP_TIME ||DEP_DELAY ||DEP_DELAY_NEW ||ARR_TIME ||ARR_DELAY ||ARR_DELAY_NEW ||CANCELLED ||CANCELLATION_CODE ||CRS_ELAPSED_TIME ||ACTUAL_ELAPSED_TIME ||CARRIER_DELAY ||WEATHER_DELAY ||NAS_DELAY ||SECURITY_DELAY ||LATE_AIRCRAFT_DELAY
2018/8/1 || 19805 || N956AN || 1587 || 12478 || 1247805 || 31703 || JFK || 14107 || 1410702 || 30466 || PHX || 1640 || 1649 || 9 || 9 || 2006 || 44 || 44 || 0 || None || 342 || 377 || 9 || 0 || 35 || 0 || 0
*/
/* column definitions {
"FL_DATE": "flight date",
"OP_CARRIER_AIRLINE_ID": "operator carrier airline id",
"TAIL_NUM": "plane's tail number",
"OP_CARRIER_FL_NUM": "operator carrier flight number",
"ORIGIN_AIRPORT_ID": "origin airport id",
"ORIGIN_AIRPORT_SEQ_ID": "origin airport sequence id",
"ORIGIN_CITY_MARKET_ID": "origin city market id",
"ORIGIN": "airport of origin",
"DEST_AIRPORT_ID": "ID of the destination airport",
"DEST_AIRPORT_SEQ_ID": "",
"DEST_CITY_MARKET_ID": "",
"DEST": "Destination airport",
"CRS_DEP_TIME": "",
"DEP_TIME": "Flight departure time",
"DEP_DELAY": "Departure delay indicator",
"DEP_DELAY_NEW": "departure delay new",
"ARR_TIME": "Flight arrival time.",
"ARR_DELAY": "arrival delay time",
"ARR_DELAY_NEW": "arrival delay new",
"CANCELLED": "Flight cancellation indicator.",
"CANCELLATION_CODE": "cancellation code",
"CRS_ELAPSED_TIME": "scheduled elapsed time",
"ACTUAL_ELAPSED_TIME": "actual elapsed time",
"CARRIER_DELAY": "carrier delay",
"WEATHER_DELAY": "delay caused by the wheather problem",
"NAS_DELAY": "delay, in minutes, attributable to the National Aviation System",
"SECURITY_DELAY": "delay attribute to security",
"LATE_AIRCRAFT_DELAY": "delay attribute to late aircraft"
}*/
|
5,853 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE "Air Carriers"
(
Code INTEGER
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM `air carriers` LIMIT 1;
Code || Description
19031 ||Mackey International Inc.: MAC
*/
/* column definitions {
"Code": "the code of the air carriers",
"Description": "the description of air carriers"
}*/
CREATE TABLE Airports
(
Code TEXT
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM airports LIMIT 1;
Code || Description
01A ||Afognak Lake, AK: Afognak Lake Airport
*/
/* column definitions {
"Code": "IATA code of the air airports",
"Description": "the description of airports"
}*/
CREATE TABLE Airlines
(
FL_DATE TEXT,
OP_CARRIER_AIRLINE_ID INTEGER,
TAIL_NUM TEXT,
OP_CARRIER_FL_NUM INTEGER,
ORIGIN_AIRPORT_ID INTEGER,
ORIGIN_AIRPORT_SEQ_ID INTEGER,
ORIGIN_CITY_MARKET_ID INTEGER,
ORIGIN TEXT,
DEST_AIRPORT_ID INTEGER,
DEST_AIRPORT_SEQ_ID INTEGER,
DEST_CITY_MARKET_ID INTEGER,
DEST TEXT,
CRS_DEP_TIME INTEGER,
DEP_TIME INTEGER,
DEP_DELAY INTEGER,
DEP_DELAY_NEW INTEGER,
ARR_TIME INTEGER,
ARR_DELAY INTEGER,
ARR_DELAY_NEW INTEGER,
CANCELLED INTEGER,
CANCELLATION_CODE TEXT,
CRS_ELAPSED_TIME INTEGER,
ACTUAL_ELAPSED_TIME INTEGER,
CARRIER_DELAY INTEGER,
WEATHER_DELAY INTEGER,
NAS_DELAY INTEGER,
SECURITY_DELAY INTEGER,
LATE_AIRCRAFT_DELAY INTEGER,
FOREIGN KEY (ORIGIN) REFERENCES Airports(Code),
FOREIGN KEY (DEST) REFERENCES Airports(Code),
FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code)
)
/*
1 example row:
SELECT * FROM airlines LIMIT 1;
FL_DATE ||OP_CARRIER_AIRLINE_ID ||TAIL_NUM ||OP_CARRIER_FL_NUM ||ORIGIN_AIRPORT_ID ||ORIGIN_AIRPORT_SEQ_ID ||ORIGIN_CITY_MARKET_ID ||ORIGIN ||DEST_AIRPORT_ID ||DEST_AIRPORT_SEQ_ID ||DEST_CITY_MARKET_ID ||DEST ||CRS_DEP_TIME ||DEP_TIME ||DEP_DELAY ||DEP_DELAY_NEW ||ARR_TIME ||ARR_DELAY ||ARR_DELAY_NEW ||CANCELLED ||CANCELLATION_CODE ||CRS_ELAPSED_TIME ||ACTUAL_ELAPSED_TIME ||CARRIER_DELAY ||WEATHER_DELAY ||NAS_DELAY ||SECURITY_DELAY ||LATE_AIRCRAFT_DELAY
2018/8/1 || 19805 || N956AN || 1587 || 12478 || 1247805 || 31703 || JFK || 14107 || 1410702 || 30466 || PHX || 1640 || 1649 || 9 || 9 || 2006 || 44 || 44 || 0 || None || 342 || 377 || 9 || 0 || 35 || 0 || 0
*/
/* column definitions {
"FL_DATE": "flight date",
"OP_CARRIER_AIRLINE_ID": "operator carrier airline id",
"TAIL_NUM": "plane's tail number",
"OP_CARRIER_FL_NUM": "operator carrier flight number",
"ORIGIN_AIRPORT_ID": "origin airport id",
"ORIGIN_AIRPORT_SEQ_ID": "origin airport sequence id",
"ORIGIN_CITY_MARKET_ID": "origin city market id",
"ORIGIN": "airport of origin",
"DEST_AIRPORT_ID": "ID of the destination airport",
"DEST_AIRPORT_SEQ_ID": "",
"DEST_CITY_MARKET_ID": "",
"DEST": "Destination airport",
"CRS_DEP_TIME": "",
"DEP_TIME": "Flight departure time",
"DEP_DELAY": "Departure delay indicator",
"DEP_DELAY_NEW": "departure delay new",
"ARR_TIME": "Flight arrival time.",
"ARR_DELAY": "arrival delay time",
"ARR_DELAY_NEW": "arrival delay new",
"CANCELLED": "Flight cancellation indicator.",
"CANCELLATION_CODE": "cancellation code",
"CRS_ELAPSED_TIME": "scheduled elapsed time",
"ACTUAL_ELAPSED_TIME": "actual elapsed time",
"CARRIER_DELAY": "carrier delay",
"WEATHER_DELAY": "delay caused by the wheather problem",
"NAS_DELAY": "delay, in minutes, attributable to the National Aviation System",
"SECURITY_DELAY": "delay attribute to security",
"LATE_AIRCRAFT_DELAY": "delay attribute to late aircraft"
}*/
### Question
What is the description of the airline code 19049?
Clarification:
| [query_database(**{'query': 'SELECT Description FROM `Air Carriers` WHERE Code = 19049'})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE "Air Carriers"
(
Code INTEGER
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM `air carriers` LIMIT 1;
Code || Description
19031 ||Mackey International Inc.: MAC
*/
/* column definitions {
"Code": "the code of the air carriers",
"Description": "the description of air carriers"
}*/
CREATE TABLE Airports
(
Code TEXT
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM airports LIMIT 1;
Code || Description
01A ||Afognak Lake, AK: Afognak Lake Airport
*/
/* column definitions {
"Code": "IATA code of the air airports",
"Description": "the description of airports"
}*/
CREATE TABLE Airlines
(
FL_DATE TEXT,
OP_CARRIER_AIRLINE_ID INTEGER,
TAIL_NUM TEXT,
OP_CARRIER_FL_NUM INTEGER,
ORIGIN_AIRPORT_ID INTEGER,
ORIGIN_AIRPORT_SEQ_ID INTEGER,
ORIGIN_CITY_MARKET_ID INTEGER,
ORIGIN TEXT,
DEST_AIRPORT_ID INTEGER,
DEST_AIRPORT_SEQ_ID INTEGER,
DEST_CITY_MARKET_ID INTEGER,
DEST TEXT,
CRS_DEP_TIME INTEGER,
DEP_TIME INTEGER,
DEP_DELAY INTEGER,
DEP_DELAY_NEW INTEGER,
ARR_TIME INTEGER,
ARR_DELAY INTEGER,
ARR_DELAY_NEW INTEGER,
CANCELLED INTEGER,
CANCELLATION_CODE TEXT,
CRS_ELAPSED_TIME INTEGER,
ACTUAL_ELAPSED_TIME INTEGER,
CARRIER_DELAY INTEGER,
WEATHER_DELAY INTEGER,
NAS_DELAY INTEGER,
SECURITY_DELAY INTEGER,
LATE_AIRCRAFT_DELAY INTEGER,
FOREIGN KEY (ORIGIN) REFERENCES Airports(Code),
FOREIGN KEY (DEST) REFERENCES Airports(Code),
FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code)
)
/*
1 example row:
SELECT * FROM airlines LIMIT 1;
FL_DATE ||OP_CARRIER_AIRLINE_ID ||TAIL_NUM ||OP_CARRIER_FL_NUM ||ORIGIN_AIRPORT_ID ||ORIGIN_AIRPORT_SEQ_ID ||ORIGIN_CITY_MARKET_ID ||ORIGIN ||DEST_AIRPORT_ID ||DEST_AIRPORT_SEQ_ID ||DEST_CITY_MARKET_ID ||DEST ||CRS_DEP_TIME ||DEP_TIME ||DEP_DELAY ||DEP_DELAY_NEW ||ARR_TIME ||ARR_DELAY ||ARR_DELAY_NEW ||CANCELLED ||CANCELLATION_CODE ||CRS_ELAPSED_TIME ||ACTUAL_ELAPSED_TIME ||CARRIER_DELAY ||WEATHER_DELAY ||NAS_DELAY ||SECURITY_DELAY ||LATE_AIRCRAFT_DELAY
2018/8/1 || 19805 || N956AN || 1587 || 12478 || 1247805 || 31703 || JFK || 14107 || 1410702 || 30466 || PHX || 1640 || 1649 || 9 || 9 || 2006 || 44 || 44 || 0 || None || 342 || 377 || 9 || 0 || 35 || 0 || 0
*/
/* column definitions {
"FL_DATE": "flight date",
"OP_CARRIER_AIRLINE_ID": "operator carrier airline id",
"TAIL_NUM": "plane's tail number",
"OP_CARRIER_FL_NUM": "operator carrier flight number",
"ORIGIN_AIRPORT_ID": "origin airport id",
"ORIGIN_AIRPORT_SEQ_ID": "origin airport sequence id",
"ORIGIN_CITY_MARKET_ID": "origin city market id",
"ORIGIN": "airport of origin",
"DEST_AIRPORT_ID": "ID of the destination airport",
"DEST_AIRPORT_SEQ_ID": "",
"DEST_CITY_MARKET_ID": "",
"DEST": "Destination airport",
"CRS_DEP_TIME": "",
"DEP_TIME": "Flight departure time",
"DEP_DELAY": "Departure delay indicator",
"DEP_DELAY_NEW": "departure delay new",
"ARR_TIME": "Flight arrival time.",
"ARR_DELAY": "arrival delay time",
"ARR_DELAY_NEW": "arrival delay new",
"CANCELLED": "Flight cancellation indicator.",
"CANCELLATION_CODE": "cancellation code",
"CRS_ELAPSED_TIME": "scheduled elapsed time",
"ACTUAL_ELAPSED_TIME": "actual elapsed time",
"CARRIER_DELAY": "carrier delay",
"WEATHER_DELAY": "delay caused by the wheather problem",
"NAS_DELAY": "delay, in minutes, attributable to the National Aviation System",
"SECURITY_DELAY": "delay attribute to security",
"LATE_AIRCRAFT_DELAY": "delay attribute to late aircraft"
}*/
|
5,857 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE "Air Carriers"
(
Code INTEGER
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM `air carriers` LIMIT 1;
Code || Description
19031 ||Mackey International Inc.: MAC
*/
/* column definitions {
"Code": "the code of the air carriers",
"Description": "the description of air carriers"
}*/
CREATE TABLE Airports
(
Code TEXT
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM airports LIMIT 1;
Code || Description
01A ||Afognak Lake, AK: Afognak Lake Airport
*/
/* column definitions {
"Code": "IATA code of the air airports",
"Description": "the description of airports"
}*/
CREATE TABLE Airlines
(
FL_DATE TEXT,
OP_CARRIER_AIRLINE_ID INTEGER,
TAIL_NUM TEXT,
OP_CARRIER_FL_NUM INTEGER,
ORIGIN_AIRPORT_ID INTEGER,
ORIGIN_AIRPORT_SEQ_ID INTEGER,
ORIGIN_CITY_MARKET_ID INTEGER,
ORIGIN TEXT,
DEST_AIRPORT_ID INTEGER,
DEST_AIRPORT_SEQ_ID INTEGER,
DEST_CITY_MARKET_ID INTEGER,
DEST TEXT,
CRS_DEP_TIME INTEGER,
DEP_TIME INTEGER,
DEP_DELAY INTEGER,
DEP_DELAY_NEW INTEGER,
ARR_TIME INTEGER,
ARR_DELAY INTEGER,
ARR_DELAY_NEW INTEGER,
CANCELLED INTEGER,
CANCELLATION_CODE TEXT,
CRS_ELAPSED_TIME INTEGER,
ACTUAL_ELAPSED_TIME INTEGER,
CARRIER_DELAY INTEGER,
WEATHER_DELAY INTEGER,
NAS_DELAY INTEGER,
SECURITY_DELAY INTEGER,
LATE_AIRCRAFT_DELAY INTEGER,
FOREIGN KEY (ORIGIN) REFERENCES Airports(Code),
FOREIGN KEY (DEST) REFERENCES Airports(Code),
FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code)
)
/*
1 example row:
SELECT * FROM airlines LIMIT 1;
FL_DATE ||OP_CARRIER_AIRLINE_ID ||TAIL_NUM ||OP_CARRIER_FL_NUM ||ORIGIN_AIRPORT_ID ||ORIGIN_AIRPORT_SEQ_ID ||ORIGIN_CITY_MARKET_ID ||ORIGIN ||DEST_AIRPORT_ID ||DEST_AIRPORT_SEQ_ID ||DEST_CITY_MARKET_ID ||DEST ||CRS_DEP_TIME ||DEP_TIME ||DEP_DELAY ||DEP_DELAY_NEW ||ARR_TIME ||ARR_DELAY ||ARR_DELAY_NEW ||CANCELLED ||CANCELLATION_CODE ||CRS_ELAPSED_TIME ||ACTUAL_ELAPSED_TIME ||CARRIER_DELAY ||WEATHER_DELAY ||NAS_DELAY ||SECURITY_DELAY ||LATE_AIRCRAFT_DELAY
2018/8/1 || 19805 || N956AN || 1587 || 12478 || 1247805 || 31703 || JFK || 14107 || 1410702 || 30466 || PHX || 1640 || 1649 || 9 || 9 || 2006 || 44 || 44 || 0 || None || 342 || 377 || 9 || 0 || 35 || 0 || 0
*/
/* column definitions {
"FL_DATE": "flight date",
"OP_CARRIER_AIRLINE_ID": "operator carrier airline id",
"TAIL_NUM": "plane's tail number",
"OP_CARRIER_FL_NUM": "operator carrier flight number",
"ORIGIN_AIRPORT_ID": "origin airport id",
"ORIGIN_AIRPORT_SEQ_ID": "origin airport sequence id",
"ORIGIN_CITY_MARKET_ID": "origin city market id",
"ORIGIN": "airport of origin",
"DEST_AIRPORT_ID": "ID of the destination airport",
"DEST_AIRPORT_SEQ_ID": "",
"DEST_CITY_MARKET_ID": "",
"DEST": "Destination airport",
"CRS_DEP_TIME": "",
"DEP_TIME": "Flight departure time",
"DEP_DELAY": "Departure delay indicator",
"DEP_DELAY_NEW": "departure delay new",
"ARR_TIME": "Flight arrival time.",
"ARR_DELAY": "arrival delay time",
"ARR_DELAY_NEW": "arrival delay new",
"CANCELLED": "Flight cancellation indicator.",
"CANCELLATION_CODE": "cancellation code",
"CRS_ELAPSED_TIME": "scheduled elapsed time",
"ACTUAL_ELAPSED_TIME": "actual elapsed time",
"CARRIER_DELAY": "carrier delay",
"WEATHER_DELAY": "delay caused by the wheather problem",
"NAS_DELAY": "delay, in minutes, attributable to the National Aviation System",
"SECURITY_DELAY": "delay attribute to security",
"LATE_AIRCRAFT_DELAY": "delay attribute to late aircraft"
}*/
### Question
What is the IATA code of the Anita Bay Airport in Anita Bay, Alaska?
Clarification: IATA code refers to Code; Anita Bay Airport in Anita Bay, Alaska refers to Description = 'Anita Bay, AK: Anita Bay Airport';
| [query_database(**{'query': 'SELECT Code FROM Airports WHERE Description = 'Anita Bay, AK: Anita Bay Airport''})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE "Air Carriers"
(
Code INTEGER
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM `air carriers` LIMIT 1;
Code || Description
19031 ||Mackey International Inc.: MAC
*/
/* column definitions {
"Code": "the code of the air carriers",
"Description": "the description of air carriers"
}*/
CREATE TABLE Airports
(
Code TEXT
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM airports LIMIT 1;
Code || Description
01A ||Afognak Lake, AK: Afognak Lake Airport
*/
/* column definitions {
"Code": "IATA code of the air airports",
"Description": "the description of airports"
}*/
CREATE TABLE Airlines
(
FL_DATE TEXT,
OP_CARRIER_AIRLINE_ID INTEGER,
TAIL_NUM TEXT,
OP_CARRIER_FL_NUM INTEGER,
ORIGIN_AIRPORT_ID INTEGER,
ORIGIN_AIRPORT_SEQ_ID INTEGER,
ORIGIN_CITY_MARKET_ID INTEGER,
ORIGIN TEXT,
DEST_AIRPORT_ID INTEGER,
DEST_AIRPORT_SEQ_ID INTEGER,
DEST_CITY_MARKET_ID INTEGER,
DEST TEXT,
CRS_DEP_TIME INTEGER,
DEP_TIME INTEGER,
DEP_DELAY INTEGER,
DEP_DELAY_NEW INTEGER,
ARR_TIME INTEGER,
ARR_DELAY INTEGER,
ARR_DELAY_NEW INTEGER,
CANCELLED INTEGER,
CANCELLATION_CODE TEXT,
CRS_ELAPSED_TIME INTEGER,
ACTUAL_ELAPSED_TIME INTEGER,
CARRIER_DELAY INTEGER,
WEATHER_DELAY INTEGER,
NAS_DELAY INTEGER,
SECURITY_DELAY INTEGER,
LATE_AIRCRAFT_DELAY INTEGER,
FOREIGN KEY (ORIGIN) REFERENCES Airports(Code),
FOREIGN KEY (DEST) REFERENCES Airports(Code),
FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code)
)
/*
1 example row:
SELECT * FROM airlines LIMIT 1;
FL_DATE ||OP_CARRIER_AIRLINE_ID ||TAIL_NUM ||OP_CARRIER_FL_NUM ||ORIGIN_AIRPORT_ID ||ORIGIN_AIRPORT_SEQ_ID ||ORIGIN_CITY_MARKET_ID ||ORIGIN ||DEST_AIRPORT_ID ||DEST_AIRPORT_SEQ_ID ||DEST_CITY_MARKET_ID ||DEST ||CRS_DEP_TIME ||DEP_TIME ||DEP_DELAY ||DEP_DELAY_NEW ||ARR_TIME ||ARR_DELAY ||ARR_DELAY_NEW ||CANCELLED ||CANCELLATION_CODE ||CRS_ELAPSED_TIME ||ACTUAL_ELAPSED_TIME ||CARRIER_DELAY ||WEATHER_DELAY ||NAS_DELAY ||SECURITY_DELAY ||LATE_AIRCRAFT_DELAY
2018/8/1 || 19805 || N956AN || 1587 || 12478 || 1247805 || 31703 || JFK || 14107 || 1410702 || 30466 || PHX || 1640 || 1649 || 9 || 9 || 2006 || 44 || 44 || 0 || None || 342 || 377 || 9 || 0 || 35 || 0 || 0
*/
/* column definitions {
"FL_DATE": "flight date",
"OP_CARRIER_AIRLINE_ID": "operator carrier airline id",
"TAIL_NUM": "plane's tail number",
"OP_CARRIER_FL_NUM": "operator carrier flight number",
"ORIGIN_AIRPORT_ID": "origin airport id",
"ORIGIN_AIRPORT_SEQ_ID": "origin airport sequence id",
"ORIGIN_CITY_MARKET_ID": "origin city market id",
"ORIGIN": "airport of origin",
"DEST_AIRPORT_ID": "ID of the destination airport",
"DEST_AIRPORT_SEQ_ID": "",
"DEST_CITY_MARKET_ID": "",
"DEST": "Destination airport",
"CRS_DEP_TIME": "",
"DEP_TIME": "Flight departure time",
"DEP_DELAY": "Departure delay indicator",
"DEP_DELAY_NEW": "departure delay new",
"ARR_TIME": "Flight arrival time.",
"ARR_DELAY": "arrival delay time",
"ARR_DELAY_NEW": "arrival delay new",
"CANCELLED": "Flight cancellation indicator.",
"CANCELLATION_CODE": "cancellation code",
"CRS_ELAPSED_TIME": "scheduled elapsed time",
"ACTUAL_ELAPSED_TIME": "actual elapsed time",
"CARRIER_DELAY": "carrier delay",
"WEATHER_DELAY": "delay caused by the wheather problem",
"NAS_DELAY": "delay, in minutes, attributable to the National Aviation System",
"SECURITY_DELAY": "delay attribute to security",
"LATE_AIRCRAFT_DELAY": "delay attribute to late aircraft"
}*/
|
5,860 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE "Air Carriers"
(
Code INTEGER
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM `air carriers` LIMIT 1;
Code || Description
19031 ||Mackey International Inc.: MAC
*/
/* column definitions {
"Code": "the code of the air carriers",
"Description": "the description of air carriers"
}*/
CREATE TABLE Airports
(
Code TEXT
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM airports LIMIT 1;
Code || Description
01A ||Afognak Lake, AK: Afognak Lake Airport
*/
/* column definitions {
"Code": "IATA code of the air airports",
"Description": "the description of airports"
}*/
CREATE TABLE Airlines
(
FL_DATE TEXT,
OP_CARRIER_AIRLINE_ID INTEGER,
TAIL_NUM TEXT,
OP_CARRIER_FL_NUM INTEGER,
ORIGIN_AIRPORT_ID INTEGER,
ORIGIN_AIRPORT_SEQ_ID INTEGER,
ORIGIN_CITY_MARKET_ID INTEGER,
ORIGIN TEXT,
DEST_AIRPORT_ID INTEGER,
DEST_AIRPORT_SEQ_ID INTEGER,
DEST_CITY_MARKET_ID INTEGER,
DEST TEXT,
CRS_DEP_TIME INTEGER,
DEP_TIME INTEGER,
DEP_DELAY INTEGER,
DEP_DELAY_NEW INTEGER,
ARR_TIME INTEGER,
ARR_DELAY INTEGER,
ARR_DELAY_NEW INTEGER,
CANCELLED INTEGER,
CANCELLATION_CODE TEXT,
CRS_ELAPSED_TIME INTEGER,
ACTUAL_ELAPSED_TIME INTEGER,
CARRIER_DELAY INTEGER,
WEATHER_DELAY INTEGER,
NAS_DELAY INTEGER,
SECURITY_DELAY INTEGER,
LATE_AIRCRAFT_DELAY INTEGER,
FOREIGN KEY (ORIGIN) REFERENCES Airports(Code),
FOREIGN KEY (DEST) REFERENCES Airports(Code),
FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code)
)
/*
1 example row:
SELECT * FROM airlines LIMIT 1;
FL_DATE ||OP_CARRIER_AIRLINE_ID ||TAIL_NUM ||OP_CARRIER_FL_NUM ||ORIGIN_AIRPORT_ID ||ORIGIN_AIRPORT_SEQ_ID ||ORIGIN_CITY_MARKET_ID ||ORIGIN ||DEST_AIRPORT_ID ||DEST_AIRPORT_SEQ_ID ||DEST_CITY_MARKET_ID ||DEST ||CRS_DEP_TIME ||DEP_TIME ||DEP_DELAY ||DEP_DELAY_NEW ||ARR_TIME ||ARR_DELAY ||ARR_DELAY_NEW ||CANCELLED ||CANCELLATION_CODE ||CRS_ELAPSED_TIME ||ACTUAL_ELAPSED_TIME ||CARRIER_DELAY ||WEATHER_DELAY ||NAS_DELAY ||SECURITY_DELAY ||LATE_AIRCRAFT_DELAY
2018/8/1 || 19805 || N956AN || 1587 || 12478 || 1247805 || 31703 || JFK || 14107 || 1410702 || 30466 || PHX || 1640 || 1649 || 9 || 9 || 2006 || 44 || 44 || 0 || None || 342 || 377 || 9 || 0 || 35 || 0 || 0
*/
/* column definitions {
"FL_DATE": "flight date",
"OP_CARRIER_AIRLINE_ID": "operator carrier airline id",
"TAIL_NUM": "plane's tail number",
"OP_CARRIER_FL_NUM": "operator carrier flight number",
"ORIGIN_AIRPORT_ID": "origin airport id",
"ORIGIN_AIRPORT_SEQ_ID": "origin airport sequence id",
"ORIGIN_CITY_MARKET_ID": "origin city market id",
"ORIGIN": "airport of origin",
"DEST_AIRPORT_ID": "ID of the destination airport",
"DEST_AIRPORT_SEQ_ID": "",
"DEST_CITY_MARKET_ID": "",
"DEST": "Destination airport",
"CRS_DEP_TIME": "",
"DEP_TIME": "Flight departure time",
"DEP_DELAY": "Departure delay indicator",
"DEP_DELAY_NEW": "departure delay new",
"ARR_TIME": "Flight arrival time.",
"ARR_DELAY": "arrival delay time",
"ARR_DELAY_NEW": "arrival delay new",
"CANCELLED": "Flight cancellation indicator.",
"CANCELLATION_CODE": "cancellation code",
"CRS_ELAPSED_TIME": "scheduled elapsed time",
"ACTUAL_ELAPSED_TIME": "actual elapsed time",
"CARRIER_DELAY": "carrier delay",
"WEATHER_DELAY": "delay caused by the wheather problem",
"NAS_DELAY": "delay, in minutes, attributable to the National Aviation System",
"SECURITY_DELAY": "delay attribute to security",
"LATE_AIRCRAFT_DELAY": "delay attribute to late aircraft"
}*/
### Question
How many planes does Southwest Airlines Co. have?
Clarification: planes refers to TAIL_NUM; Southwest Airlines Co. refers to Description = 'Southwest Airlines Co.: WN';
| [query_database(**{'query': 'SELECT COUNT(T3.TAIL_NUM) FROM ( SELECT T1.TAIL_NUM FROM Airlines AS T1 INNER JOIN `Air Carriers` AS T2 ON T1.OP_CARRIER_AIRLINE_ID = T2.Code WHERE T2.Description = 'Southwest Airlines Co.: WN' GROUP BY T1.TAIL_NUM ) T3'})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE "Air Carriers"
(
Code INTEGER
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM `air carriers` LIMIT 1;
Code || Description
19031 ||Mackey International Inc.: MAC
*/
/* column definitions {
"Code": "the code of the air carriers",
"Description": "the description of air carriers"
}*/
CREATE TABLE Airports
(
Code TEXT
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM airports LIMIT 1;
Code || Description
01A ||Afognak Lake, AK: Afognak Lake Airport
*/
/* column definitions {
"Code": "IATA code of the air airports",
"Description": "the description of airports"
}*/
CREATE TABLE Airlines
(
FL_DATE TEXT,
OP_CARRIER_AIRLINE_ID INTEGER,
TAIL_NUM TEXT,
OP_CARRIER_FL_NUM INTEGER,
ORIGIN_AIRPORT_ID INTEGER,
ORIGIN_AIRPORT_SEQ_ID INTEGER,
ORIGIN_CITY_MARKET_ID INTEGER,
ORIGIN TEXT,
DEST_AIRPORT_ID INTEGER,
DEST_AIRPORT_SEQ_ID INTEGER,
DEST_CITY_MARKET_ID INTEGER,
DEST TEXT,
CRS_DEP_TIME INTEGER,
DEP_TIME INTEGER,
DEP_DELAY INTEGER,
DEP_DELAY_NEW INTEGER,
ARR_TIME INTEGER,
ARR_DELAY INTEGER,
ARR_DELAY_NEW INTEGER,
CANCELLED INTEGER,
CANCELLATION_CODE TEXT,
CRS_ELAPSED_TIME INTEGER,
ACTUAL_ELAPSED_TIME INTEGER,
CARRIER_DELAY INTEGER,
WEATHER_DELAY INTEGER,
NAS_DELAY INTEGER,
SECURITY_DELAY INTEGER,
LATE_AIRCRAFT_DELAY INTEGER,
FOREIGN KEY (ORIGIN) REFERENCES Airports(Code),
FOREIGN KEY (DEST) REFERENCES Airports(Code),
FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code)
)
/*
1 example row:
SELECT * FROM airlines LIMIT 1;
FL_DATE ||OP_CARRIER_AIRLINE_ID ||TAIL_NUM ||OP_CARRIER_FL_NUM ||ORIGIN_AIRPORT_ID ||ORIGIN_AIRPORT_SEQ_ID ||ORIGIN_CITY_MARKET_ID ||ORIGIN ||DEST_AIRPORT_ID ||DEST_AIRPORT_SEQ_ID ||DEST_CITY_MARKET_ID ||DEST ||CRS_DEP_TIME ||DEP_TIME ||DEP_DELAY ||DEP_DELAY_NEW ||ARR_TIME ||ARR_DELAY ||ARR_DELAY_NEW ||CANCELLED ||CANCELLATION_CODE ||CRS_ELAPSED_TIME ||ACTUAL_ELAPSED_TIME ||CARRIER_DELAY ||WEATHER_DELAY ||NAS_DELAY ||SECURITY_DELAY ||LATE_AIRCRAFT_DELAY
2018/8/1 || 19805 || N956AN || 1587 || 12478 || 1247805 || 31703 || JFK || 14107 || 1410702 || 30466 || PHX || 1640 || 1649 || 9 || 9 || 2006 || 44 || 44 || 0 || None || 342 || 377 || 9 || 0 || 35 || 0 || 0
*/
/* column definitions {
"FL_DATE": "flight date",
"OP_CARRIER_AIRLINE_ID": "operator carrier airline id",
"TAIL_NUM": "plane's tail number",
"OP_CARRIER_FL_NUM": "operator carrier flight number",
"ORIGIN_AIRPORT_ID": "origin airport id",
"ORIGIN_AIRPORT_SEQ_ID": "origin airport sequence id",
"ORIGIN_CITY_MARKET_ID": "origin city market id",
"ORIGIN": "airport of origin",
"DEST_AIRPORT_ID": "ID of the destination airport",
"DEST_AIRPORT_SEQ_ID": "",
"DEST_CITY_MARKET_ID": "",
"DEST": "Destination airport",
"CRS_DEP_TIME": "",
"DEP_TIME": "Flight departure time",
"DEP_DELAY": "Departure delay indicator",
"DEP_DELAY_NEW": "departure delay new",
"ARR_TIME": "Flight arrival time.",
"ARR_DELAY": "arrival delay time",
"ARR_DELAY_NEW": "arrival delay new",
"CANCELLED": "Flight cancellation indicator.",
"CANCELLATION_CODE": "cancellation code",
"CRS_ELAPSED_TIME": "scheduled elapsed time",
"ACTUAL_ELAPSED_TIME": "actual elapsed time",
"CARRIER_DELAY": "carrier delay",
"WEATHER_DELAY": "delay caused by the wheather problem",
"NAS_DELAY": "delay, in minutes, attributable to the National Aviation System",
"SECURITY_DELAY": "delay attribute to security",
"LATE_AIRCRAFT_DELAY": "delay attribute to late aircraft"
}*/
|
5,864 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE "Air Carriers"
(
Code INTEGER
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM `air carriers` LIMIT 1;
Code || Description
19031 ||Mackey International Inc.: MAC
*/
/* column definitions {
"Code": "the code of the air carriers",
"Description": "the description of air carriers"
}*/
CREATE TABLE Airports
(
Code TEXT
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM airports LIMIT 1;
Code || Description
01A ||Afognak Lake, AK: Afognak Lake Airport
*/
/* column definitions {
"Code": "IATA code of the air airports",
"Description": "the description of airports"
}*/
CREATE TABLE Airlines
(
FL_DATE TEXT,
OP_CARRIER_AIRLINE_ID INTEGER,
TAIL_NUM TEXT,
OP_CARRIER_FL_NUM INTEGER,
ORIGIN_AIRPORT_ID INTEGER,
ORIGIN_AIRPORT_SEQ_ID INTEGER,
ORIGIN_CITY_MARKET_ID INTEGER,
ORIGIN TEXT,
DEST_AIRPORT_ID INTEGER,
DEST_AIRPORT_SEQ_ID INTEGER,
DEST_CITY_MARKET_ID INTEGER,
DEST TEXT,
CRS_DEP_TIME INTEGER,
DEP_TIME INTEGER,
DEP_DELAY INTEGER,
DEP_DELAY_NEW INTEGER,
ARR_TIME INTEGER,
ARR_DELAY INTEGER,
ARR_DELAY_NEW INTEGER,
CANCELLED INTEGER,
CANCELLATION_CODE TEXT,
CRS_ELAPSED_TIME INTEGER,
ACTUAL_ELAPSED_TIME INTEGER,
CARRIER_DELAY INTEGER,
WEATHER_DELAY INTEGER,
NAS_DELAY INTEGER,
SECURITY_DELAY INTEGER,
LATE_AIRCRAFT_DELAY INTEGER,
FOREIGN KEY (ORIGIN) REFERENCES Airports(Code),
FOREIGN KEY (DEST) REFERENCES Airports(Code),
FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code)
)
/*
1 example row:
SELECT * FROM airlines LIMIT 1;
FL_DATE ||OP_CARRIER_AIRLINE_ID ||TAIL_NUM ||OP_CARRIER_FL_NUM ||ORIGIN_AIRPORT_ID ||ORIGIN_AIRPORT_SEQ_ID ||ORIGIN_CITY_MARKET_ID ||ORIGIN ||DEST_AIRPORT_ID ||DEST_AIRPORT_SEQ_ID ||DEST_CITY_MARKET_ID ||DEST ||CRS_DEP_TIME ||DEP_TIME ||DEP_DELAY ||DEP_DELAY_NEW ||ARR_TIME ||ARR_DELAY ||ARR_DELAY_NEW ||CANCELLED ||CANCELLATION_CODE ||CRS_ELAPSED_TIME ||ACTUAL_ELAPSED_TIME ||CARRIER_DELAY ||WEATHER_DELAY ||NAS_DELAY ||SECURITY_DELAY ||LATE_AIRCRAFT_DELAY
2018/8/1 || 19805 || N956AN || 1587 || 12478 || 1247805 || 31703 || JFK || 14107 || 1410702 || 30466 || PHX || 1640 || 1649 || 9 || 9 || 2006 || 44 || 44 || 0 || None || 342 || 377 || 9 || 0 || 35 || 0 || 0
*/
/* column definitions {
"FL_DATE": "flight date",
"OP_CARRIER_AIRLINE_ID": "operator carrier airline id",
"TAIL_NUM": "plane's tail number",
"OP_CARRIER_FL_NUM": "operator carrier flight number",
"ORIGIN_AIRPORT_ID": "origin airport id",
"ORIGIN_AIRPORT_SEQ_ID": "origin airport sequence id",
"ORIGIN_CITY_MARKET_ID": "origin city market id",
"ORIGIN": "airport of origin",
"DEST_AIRPORT_ID": "ID of the destination airport",
"DEST_AIRPORT_SEQ_ID": "",
"DEST_CITY_MARKET_ID": "",
"DEST": "Destination airport",
"CRS_DEP_TIME": "",
"DEP_TIME": "Flight departure time",
"DEP_DELAY": "Departure delay indicator",
"DEP_DELAY_NEW": "departure delay new",
"ARR_TIME": "Flight arrival time.",
"ARR_DELAY": "arrival delay time",
"ARR_DELAY_NEW": "arrival delay new",
"CANCELLED": "Flight cancellation indicator.",
"CANCELLATION_CODE": "cancellation code",
"CRS_ELAPSED_TIME": "scheduled elapsed time",
"ACTUAL_ELAPSED_TIME": "actual elapsed time",
"CARRIER_DELAY": "carrier delay",
"WEATHER_DELAY": "delay caused by the wheather problem",
"NAS_DELAY": "delay, in minutes, attributable to the National Aviation System",
"SECURITY_DELAY": "delay attribute to security",
"LATE_AIRCRAFT_DELAY": "delay attribute to late aircraft"
}*/
### Question
What are the names of the top 5 airlines with the highest number of aircraft?
Clarification: names of the airlines refers to Description; highest number of aircraft refers to MAX(COUNT(TAIL_NUM));
| [query_database(**{'query': 'SELECT T2.Description FROM Airlines AS T1 INNER JOIN `Air Carriers` AS T2 ON T1.OP_CARRIER_AIRLINE_ID = T2.Code GROUP BY T2.Description ORDER BY T1.TAIL_NUM DESC LIMIT 5'})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE "Air Carriers"
(
Code INTEGER
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM `air carriers` LIMIT 1;
Code || Description
19031 ||Mackey International Inc.: MAC
*/
/* column definitions {
"Code": "the code of the air carriers",
"Description": "the description of air carriers"
}*/
CREATE TABLE Airports
(
Code TEXT
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM airports LIMIT 1;
Code || Description
01A ||Afognak Lake, AK: Afognak Lake Airport
*/
/* column definitions {
"Code": "IATA code of the air airports",
"Description": "the description of airports"
}*/
CREATE TABLE Airlines
(
FL_DATE TEXT,
OP_CARRIER_AIRLINE_ID INTEGER,
TAIL_NUM TEXT,
OP_CARRIER_FL_NUM INTEGER,
ORIGIN_AIRPORT_ID INTEGER,
ORIGIN_AIRPORT_SEQ_ID INTEGER,
ORIGIN_CITY_MARKET_ID INTEGER,
ORIGIN TEXT,
DEST_AIRPORT_ID INTEGER,
DEST_AIRPORT_SEQ_ID INTEGER,
DEST_CITY_MARKET_ID INTEGER,
DEST TEXT,
CRS_DEP_TIME INTEGER,
DEP_TIME INTEGER,
DEP_DELAY INTEGER,
DEP_DELAY_NEW INTEGER,
ARR_TIME INTEGER,
ARR_DELAY INTEGER,
ARR_DELAY_NEW INTEGER,
CANCELLED INTEGER,
CANCELLATION_CODE TEXT,
CRS_ELAPSED_TIME INTEGER,
ACTUAL_ELAPSED_TIME INTEGER,
CARRIER_DELAY INTEGER,
WEATHER_DELAY INTEGER,
NAS_DELAY INTEGER,
SECURITY_DELAY INTEGER,
LATE_AIRCRAFT_DELAY INTEGER,
FOREIGN KEY (ORIGIN) REFERENCES Airports(Code),
FOREIGN KEY (DEST) REFERENCES Airports(Code),
FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code)
)
/*
1 example row:
SELECT * FROM airlines LIMIT 1;
FL_DATE ||OP_CARRIER_AIRLINE_ID ||TAIL_NUM ||OP_CARRIER_FL_NUM ||ORIGIN_AIRPORT_ID ||ORIGIN_AIRPORT_SEQ_ID ||ORIGIN_CITY_MARKET_ID ||ORIGIN ||DEST_AIRPORT_ID ||DEST_AIRPORT_SEQ_ID ||DEST_CITY_MARKET_ID ||DEST ||CRS_DEP_TIME ||DEP_TIME ||DEP_DELAY ||DEP_DELAY_NEW ||ARR_TIME ||ARR_DELAY ||ARR_DELAY_NEW ||CANCELLED ||CANCELLATION_CODE ||CRS_ELAPSED_TIME ||ACTUAL_ELAPSED_TIME ||CARRIER_DELAY ||WEATHER_DELAY ||NAS_DELAY ||SECURITY_DELAY ||LATE_AIRCRAFT_DELAY
2018/8/1 || 19805 || N956AN || 1587 || 12478 || 1247805 || 31703 || JFK || 14107 || 1410702 || 30466 || PHX || 1640 || 1649 || 9 || 9 || 2006 || 44 || 44 || 0 || None || 342 || 377 || 9 || 0 || 35 || 0 || 0
*/
/* column definitions {
"FL_DATE": "flight date",
"OP_CARRIER_AIRLINE_ID": "operator carrier airline id",
"TAIL_NUM": "plane's tail number",
"OP_CARRIER_FL_NUM": "operator carrier flight number",
"ORIGIN_AIRPORT_ID": "origin airport id",
"ORIGIN_AIRPORT_SEQ_ID": "origin airport sequence id",
"ORIGIN_CITY_MARKET_ID": "origin city market id",
"ORIGIN": "airport of origin",
"DEST_AIRPORT_ID": "ID of the destination airport",
"DEST_AIRPORT_SEQ_ID": "",
"DEST_CITY_MARKET_ID": "",
"DEST": "Destination airport",
"CRS_DEP_TIME": "",
"DEP_TIME": "Flight departure time",
"DEP_DELAY": "Departure delay indicator",
"DEP_DELAY_NEW": "departure delay new",
"ARR_TIME": "Flight arrival time.",
"ARR_DELAY": "arrival delay time",
"ARR_DELAY_NEW": "arrival delay new",
"CANCELLED": "Flight cancellation indicator.",
"CANCELLATION_CODE": "cancellation code",
"CRS_ELAPSED_TIME": "scheduled elapsed time",
"ACTUAL_ELAPSED_TIME": "actual elapsed time",
"CARRIER_DELAY": "carrier delay",
"WEATHER_DELAY": "delay caused by the wheather problem",
"NAS_DELAY": "delay, in minutes, attributable to the National Aviation System",
"SECURITY_DELAY": "delay attribute to security",
"LATE_AIRCRAFT_DELAY": "delay attribute to late aircraft"
}*/
|
5,868 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE "Air Carriers"
(
Code INTEGER
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM `air carriers` LIMIT 1;
Code || Description
19031 ||Mackey International Inc.: MAC
*/
/* column definitions {
"Code": "the code of the air carriers",
"Description": "the description of air carriers"
}*/
CREATE TABLE Airports
(
Code TEXT
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM airports LIMIT 1;
Code || Description
01A ||Afognak Lake, AK: Afognak Lake Airport
*/
/* column definitions {
"Code": "IATA code of the air airports",
"Description": "the description of airports"
}*/
CREATE TABLE Airlines
(
FL_DATE TEXT,
OP_CARRIER_AIRLINE_ID INTEGER,
TAIL_NUM TEXT,
OP_CARRIER_FL_NUM INTEGER,
ORIGIN_AIRPORT_ID INTEGER,
ORIGIN_AIRPORT_SEQ_ID INTEGER,
ORIGIN_CITY_MARKET_ID INTEGER,
ORIGIN TEXT,
DEST_AIRPORT_ID INTEGER,
DEST_AIRPORT_SEQ_ID INTEGER,
DEST_CITY_MARKET_ID INTEGER,
DEST TEXT,
CRS_DEP_TIME INTEGER,
DEP_TIME INTEGER,
DEP_DELAY INTEGER,
DEP_DELAY_NEW INTEGER,
ARR_TIME INTEGER,
ARR_DELAY INTEGER,
ARR_DELAY_NEW INTEGER,
CANCELLED INTEGER,
CANCELLATION_CODE TEXT,
CRS_ELAPSED_TIME INTEGER,
ACTUAL_ELAPSED_TIME INTEGER,
CARRIER_DELAY INTEGER,
WEATHER_DELAY INTEGER,
NAS_DELAY INTEGER,
SECURITY_DELAY INTEGER,
LATE_AIRCRAFT_DELAY INTEGER,
FOREIGN KEY (ORIGIN) REFERENCES Airports(Code),
FOREIGN KEY (DEST) REFERENCES Airports(Code),
FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code)
)
/*
1 example row:
SELECT * FROM airlines LIMIT 1;
FL_DATE ||OP_CARRIER_AIRLINE_ID ||TAIL_NUM ||OP_CARRIER_FL_NUM ||ORIGIN_AIRPORT_ID ||ORIGIN_AIRPORT_SEQ_ID ||ORIGIN_CITY_MARKET_ID ||ORIGIN ||DEST_AIRPORT_ID ||DEST_AIRPORT_SEQ_ID ||DEST_CITY_MARKET_ID ||DEST ||CRS_DEP_TIME ||DEP_TIME ||DEP_DELAY ||DEP_DELAY_NEW ||ARR_TIME ||ARR_DELAY ||ARR_DELAY_NEW ||CANCELLED ||CANCELLATION_CODE ||CRS_ELAPSED_TIME ||ACTUAL_ELAPSED_TIME ||CARRIER_DELAY ||WEATHER_DELAY ||NAS_DELAY ||SECURITY_DELAY ||LATE_AIRCRAFT_DELAY
2018/8/1 || 19805 || N956AN || 1587 || 12478 || 1247805 || 31703 || JFK || 14107 || 1410702 || 30466 || PHX || 1640 || 1649 || 9 || 9 || 2006 || 44 || 44 || 0 || None || 342 || 377 || 9 || 0 || 35 || 0 || 0
*/
/* column definitions {
"FL_DATE": "flight date",
"OP_CARRIER_AIRLINE_ID": "operator carrier airline id",
"TAIL_NUM": "plane's tail number",
"OP_CARRIER_FL_NUM": "operator carrier flight number",
"ORIGIN_AIRPORT_ID": "origin airport id",
"ORIGIN_AIRPORT_SEQ_ID": "origin airport sequence id",
"ORIGIN_CITY_MARKET_ID": "origin city market id",
"ORIGIN": "airport of origin",
"DEST_AIRPORT_ID": "ID of the destination airport",
"DEST_AIRPORT_SEQ_ID": "",
"DEST_CITY_MARKET_ID": "",
"DEST": "Destination airport",
"CRS_DEP_TIME": "",
"DEP_TIME": "Flight departure time",
"DEP_DELAY": "Departure delay indicator",
"DEP_DELAY_NEW": "departure delay new",
"ARR_TIME": "Flight arrival time.",
"ARR_DELAY": "arrival delay time",
"ARR_DELAY_NEW": "arrival delay new",
"CANCELLED": "Flight cancellation indicator.",
"CANCELLATION_CODE": "cancellation code",
"CRS_ELAPSED_TIME": "scheduled elapsed time",
"ACTUAL_ELAPSED_TIME": "actual elapsed time",
"CARRIER_DELAY": "carrier delay",
"WEATHER_DELAY": "delay caused by the wheather problem",
"NAS_DELAY": "delay, in minutes, attributable to the National Aviation System",
"SECURITY_DELAY": "delay attribute to security",
"LATE_AIRCRAFT_DELAY": "delay attribute to late aircraft"
}*/
### Question
What is the tail number of a Compass Airline's plane that flew the most number of flights from LAX to ABQ?
Clarification: tail number refers to TAIL_NUM; Compass Airline refers to Description = 'Compass Airlines: CP'; flew the most number of lights from LAX TO ABQ refers to MAX(COUNT(OP_CARRIER_AIRLINE_ID WHERE ORIGIN = 'LAX' and DEST = 'ABQ')); from LAX refers to ORIGIN = 'LAX'; to ABQ refers to DEST = 'ABQ';
| [query_database(**{'query': 'SELECT T2.OP_CARRIER_AIRLINE_ID FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T1.Description = 'Compass Airlines: CP' AND T2.ORIGIN = 'LAX' AND T2.DEST = 'ABQ' GROUP BY T2.OP_CARRIER_AIRLINE_ID ORDER BY COUNT(T2.OP_CARRIER_AIRLINE_ID) DESC LIMIT 1'})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE "Air Carriers"
(
Code INTEGER
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM `air carriers` LIMIT 1;
Code || Description
19031 ||Mackey International Inc.: MAC
*/
/* column definitions {
"Code": "the code of the air carriers",
"Description": "the description of air carriers"
}*/
CREATE TABLE Airports
(
Code TEXT
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM airports LIMIT 1;
Code || Description
01A ||Afognak Lake, AK: Afognak Lake Airport
*/
/* column definitions {
"Code": "IATA code of the air airports",
"Description": "the description of airports"
}*/
CREATE TABLE Airlines
(
FL_DATE TEXT,
OP_CARRIER_AIRLINE_ID INTEGER,
TAIL_NUM TEXT,
OP_CARRIER_FL_NUM INTEGER,
ORIGIN_AIRPORT_ID INTEGER,
ORIGIN_AIRPORT_SEQ_ID INTEGER,
ORIGIN_CITY_MARKET_ID INTEGER,
ORIGIN TEXT,
DEST_AIRPORT_ID INTEGER,
DEST_AIRPORT_SEQ_ID INTEGER,
DEST_CITY_MARKET_ID INTEGER,
DEST TEXT,
CRS_DEP_TIME INTEGER,
DEP_TIME INTEGER,
DEP_DELAY INTEGER,
DEP_DELAY_NEW INTEGER,
ARR_TIME INTEGER,
ARR_DELAY INTEGER,
ARR_DELAY_NEW INTEGER,
CANCELLED INTEGER,
CANCELLATION_CODE TEXT,
CRS_ELAPSED_TIME INTEGER,
ACTUAL_ELAPSED_TIME INTEGER,
CARRIER_DELAY INTEGER,
WEATHER_DELAY INTEGER,
NAS_DELAY INTEGER,
SECURITY_DELAY INTEGER,
LATE_AIRCRAFT_DELAY INTEGER,
FOREIGN KEY (ORIGIN) REFERENCES Airports(Code),
FOREIGN KEY (DEST) REFERENCES Airports(Code),
FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code)
)
/*
1 example row:
SELECT * FROM airlines LIMIT 1;
FL_DATE ||OP_CARRIER_AIRLINE_ID ||TAIL_NUM ||OP_CARRIER_FL_NUM ||ORIGIN_AIRPORT_ID ||ORIGIN_AIRPORT_SEQ_ID ||ORIGIN_CITY_MARKET_ID ||ORIGIN ||DEST_AIRPORT_ID ||DEST_AIRPORT_SEQ_ID ||DEST_CITY_MARKET_ID ||DEST ||CRS_DEP_TIME ||DEP_TIME ||DEP_DELAY ||DEP_DELAY_NEW ||ARR_TIME ||ARR_DELAY ||ARR_DELAY_NEW ||CANCELLED ||CANCELLATION_CODE ||CRS_ELAPSED_TIME ||ACTUAL_ELAPSED_TIME ||CARRIER_DELAY ||WEATHER_DELAY ||NAS_DELAY ||SECURITY_DELAY ||LATE_AIRCRAFT_DELAY
2018/8/1 || 19805 || N956AN || 1587 || 12478 || 1247805 || 31703 || JFK || 14107 || 1410702 || 30466 || PHX || 1640 || 1649 || 9 || 9 || 2006 || 44 || 44 || 0 || None || 342 || 377 || 9 || 0 || 35 || 0 || 0
*/
/* column definitions {
"FL_DATE": "flight date",
"OP_CARRIER_AIRLINE_ID": "operator carrier airline id",
"TAIL_NUM": "plane's tail number",
"OP_CARRIER_FL_NUM": "operator carrier flight number",
"ORIGIN_AIRPORT_ID": "origin airport id",
"ORIGIN_AIRPORT_SEQ_ID": "origin airport sequence id",
"ORIGIN_CITY_MARKET_ID": "origin city market id",
"ORIGIN": "airport of origin",
"DEST_AIRPORT_ID": "ID of the destination airport",
"DEST_AIRPORT_SEQ_ID": "",
"DEST_CITY_MARKET_ID": "",
"DEST": "Destination airport",
"CRS_DEP_TIME": "",
"DEP_TIME": "Flight departure time",
"DEP_DELAY": "Departure delay indicator",
"DEP_DELAY_NEW": "departure delay new",
"ARR_TIME": "Flight arrival time.",
"ARR_DELAY": "arrival delay time",
"ARR_DELAY_NEW": "arrival delay new",
"CANCELLED": "Flight cancellation indicator.",
"CANCELLATION_CODE": "cancellation code",
"CRS_ELAPSED_TIME": "scheduled elapsed time",
"ACTUAL_ELAPSED_TIME": "actual elapsed time",
"CARRIER_DELAY": "carrier delay",
"WEATHER_DELAY": "delay caused by the wheather problem",
"NAS_DELAY": "delay, in minutes, attributable to the National Aviation System",
"SECURITY_DELAY": "delay attribute to security",
"LATE_AIRCRAFT_DELAY": "delay attribute to late aircraft"
}*/
|
5,872 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE "Air Carriers"
(
Code INTEGER
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM `air carriers` LIMIT 1;
Code || Description
19031 ||Mackey International Inc.: MAC
*/
/* column definitions {
"Code": "the code of the air carriers",
"Description": "the description of air carriers"
}*/
CREATE TABLE Airports
(
Code TEXT
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM airports LIMIT 1;
Code || Description
01A ||Afognak Lake, AK: Afognak Lake Airport
*/
/* column definitions {
"Code": "IATA code of the air airports",
"Description": "the description of airports"
}*/
CREATE TABLE Airlines
(
FL_DATE TEXT,
OP_CARRIER_AIRLINE_ID INTEGER,
TAIL_NUM TEXT,
OP_CARRIER_FL_NUM INTEGER,
ORIGIN_AIRPORT_ID INTEGER,
ORIGIN_AIRPORT_SEQ_ID INTEGER,
ORIGIN_CITY_MARKET_ID INTEGER,
ORIGIN TEXT,
DEST_AIRPORT_ID INTEGER,
DEST_AIRPORT_SEQ_ID INTEGER,
DEST_CITY_MARKET_ID INTEGER,
DEST TEXT,
CRS_DEP_TIME INTEGER,
DEP_TIME INTEGER,
DEP_DELAY INTEGER,
DEP_DELAY_NEW INTEGER,
ARR_TIME INTEGER,
ARR_DELAY INTEGER,
ARR_DELAY_NEW INTEGER,
CANCELLED INTEGER,
CANCELLATION_CODE TEXT,
CRS_ELAPSED_TIME INTEGER,
ACTUAL_ELAPSED_TIME INTEGER,
CARRIER_DELAY INTEGER,
WEATHER_DELAY INTEGER,
NAS_DELAY INTEGER,
SECURITY_DELAY INTEGER,
LATE_AIRCRAFT_DELAY INTEGER,
FOREIGN KEY (ORIGIN) REFERENCES Airports(Code),
FOREIGN KEY (DEST) REFERENCES Airports(Code),
FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code)
)
/*
1 example row:
SELECT * FROM airlines LIMIT 1;
FL_DATE ||OP_CARRIER_AIRLINE_ID ||TAIL_NUM ||OP_CARRIER_FL_NUM ||ORIGIN_AIRPORT_ID ||ORIGIN_AIRPORT_SEQ_ID ||ORIGIN_CITY_MARKET_ID ||ORIGIN ||DEST_AIRPORT_ID ||DEST_AIRPORT_SEQ_ID ||DEST_CITY_MARKET_ID ||DEST ||CRS_DEP_TIME ||DEP_TIME ||DEP_DELAY ||DEP_DELAY_NEW ||ARR_TIME ||ARR_DELAY ||ARR_DELAY_NEW ||CANCELLED ||CANCELLATION_CODE ||CRS_ELAPSED_TIME ||ACTUAL_ELAPSED_TIME ||CARRIER_DELAY ||WEATHER_DELAY ||NAS_DELAY ||SECURITY_DELAY ||LATE_AIRCRAFT_DELAY
2018/8/1 || 19805 || N956AN || 1587 || 12478 || 1247805 || 31703 || JFK || 14107 || 1410702 || 30466 || PHX || 1640 || 1649 || 9 || 9 || 2006 || 44 || 44 || 0 || None || 342 || 377 || 9 || 0 || 35 || 0 || 0
*/
/* column definitions {
"FL_DATE": "flight date",
"OP_CARRIER_AIRLINE_ID": "operator carrier airline id",
"TAIL_NUM": "plane's tail number",
"OP_CARRIER_FL_NUM": "operator carrier flight number",
"ORIGIN_AIRPORT_ID": "origin airport id",
"ORIGIN_AIRPORT_SEQ_ID": "origin airport sequence id",
"ORIGIN_CITY_MARKET_ID": "origin city market id",
"ORIGIN": "airport of origin",
"DEST_AIRPORT_ID": "ID of the destination airport",
"DEST_AIRPORT_SEQ_ID": "",
"DEST_CITY_MARKET_ID": "",
"DEST": "Destination airport",
"CRS_DEP_TIME": "",
"DEP_TIME": "Flight departure time",
"DEP_DELAY": "Departure delay indicator",
"DEP_DELAY_NEW": "departure delay new",
"ARR_TIME": "Flight arrival time.",
"ARR_DELAY": "arrival delay time",
"ARR_DELAY_NEW": "arrival delay new",
"CANCELLED": "Flight cancellation indicator.",
"CANCELLATION_CODE": "cancellation code",
"CRS_ELAPSED_TIME": "scheduled elapsed time",
"ACTUAL_ELAPSED_TIME": "actual elapsed time",
"CARRIER_DELAY": "carrier delay",
"WEATHER_DELAY": "delay caused by the wheather problem",
"NAS_DELAY": "delay, in minutes, attributable to the National Aviation System",
"SECURITY_DELAY": "delay attribute to security",
"LATE_AIRCRAFT_DELAY": "delay attribute to late aircraft"
}*/
### Question
Please list any three airports with their codes.
Clarification:
| [query_database(**{'query': 'SELECT Code, Description FROM Airports LIMIT 3'})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE "Air Carriers"
(
Code INTEGER
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM `air carriers` LIMIT 1;
Code || Description
19031 ||Mackey International Inc.: MAC
*/
/* column definitions {
"Code": "the code of the air carriers",
"Description": "the description of air carriers"
}*/
CREATE TABLE Airports
(
Code TEXT
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM airports LIMIT 1;
Code || Description
01A ||Afognak Lake, AK: Afognak Lake Airport
*/
/* column definitions {
"Code": "IATA code of the air airports",
"Description": "the description of airports"
}*/
CREATE TABLE Airlines
(
FL_DATE TEXT,
OP_CARRIER_AIRLINE_ID INTEGER,
TAIL_NUM TEXT,
OP_CARRIER_FL_NUM INTEGER,
ORIGIN_AIRPORT_ID INTEGER,
ORIGIN_AIRPORT_SEQ_ID INTEGER,
ORIGIN_CITY_MARKET_ID INTEGER,
ORIGIN TEXT,
DEST_AIRPORT_ID INTEGER,
DEST_AIRPORT_SEQ_ID INTEGER,
DEST_CITY_MARKET_ID INTEGER,
DEST TEXT,
CRS_DEP_TIME INTEGER,
DEP_TIME INTEGER,
DEP_DELAY INTEGER,
DEP_DELAY_NEW INTEGER,
ARR_TIME INTEGER,
ARR_DELAY INTEGER,
ARR_DELAY_NEW INTEGER,
CANCELLED INTEGER,
CANCELLATION_CODE TEXT,
CRS_ELAPSED_TIME INTEGER,
ACTUAL_ELAPSED_TIME INTEGER,
CARRIER_DELAY INTEGER,
WEATHER_DELAY INTEGER,
NAS_DELAY INTEGER,
SECURITY_DELAY INTEGER,
LATE_AIRCRAFT_DELAY INTEGER,
FOREIGN KEY (ORIGIN) REFERENCES Airports(Code),
FOREIGN KEY (DEST) REFERENCES Airports(Code),
FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code)
)
/*
1 example row:
SELECT * FROM airlines LIMIT 1;
FL_DATE ||OP_CARRIER_AIRLINE_ID ||TAIL_NUM ||OP_CARRIER_FL_NUM ||ORIGIN_AIRPORT_ID ||ORIGIN_AIRPORT_SEQ_ID ||ORIGIN_CITY_MARKET_ID ||ORIGIN ||DEST_AIRPORT_ID ||DEST_AIRPORT_SEQ_ID ||DEST_CITY_MARKET_ID ||DEST ||CRS_DEP_TIME ||DEP_TIME ||DEP_DELAY ||DEP_DELAY_NEW ||ARR_TIME ||ARR_DELAY ||ARR_DELAY_NEW ||CANCELLED ||CANCELLATION_CODE ||CRS_ELAPSED_TIME ||ACTUAL_ELAPSED_TIME ||CARRIER_DELAY ||WEATHER_DELAY ||NAS_DELAY ||SECURITY_DELAY ||LATE_AIRCRAFT_DELAY
2018/8/1 || 19805 || N956AN || 1587 || 12478 || 1247805 || 31703 || JFK || 14107 || 1410702 || 30466 || PHX || 1640 || 1649 || 9 || 9 || 2006 || 44 || 44 || 0 || None || 342 || 377 || 9 || 0 || 35 || 0 || 0
*/
/* column definitions {
"FL_DATE": "flight date",
"OP_CARRIER_AIRLINE_ID": "operator carrier airline id",
"TAIL_NUM": "plane's tail number",
"OP_CARRIER_FL_NUM": "operator carrier flight number",
"ORIGIN_AIRPORT_ID": "origin airport id",
"ORIGIN_AIRPORT_SEQ_ID": "origin airport sequence id",
"ORIGIN_CITY_MARKET_ID": "origin city market id",
"ORIGIN": "airport of origin",
"DEST_AIRPORT_ID": "ID of the destination airport",
"DEST_AIRPORT_SEQ_ID": "",
"DEST_CITY_MARKET_ID": "",
"DEST": "Destination airport",
"CRS_DEP_TIME": "",
"DEP_TIME": "Flight departure time",
"DEP_DELAY": "Departure delay indicator",
"DEP_DELAY_NEW": "departure delay new",
"ARR_TIME": "Flight arrival time.",
"ARR_DELAY": "arrival delay time",
"ARR_DELAY_NEW": "arrival delay new",
"CANCELLED": "Flight cancellation indicator.",
"CANCELLATION_CODE": "cancellation code",
"CRS_ELAPSED_TIME": "scheduled elapsed time",
"ACTUAL_ELAPSED_TIME": "actual elapsed time",
"CARRIER_DELAY": "carrier delay",
"WEATHER_DELAY": "delay caused by the wheather problem",
"NAS_DELAY": "delay, in minutes, attributable to the National Aviation System",
"SECURITY_DELAY": "delay attribute to security",
"LATE_AIRCRAFT_DELAY": "delay attribute to late aircraft"
}*/
|
5,876 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE "Air Carriers"
(
Code INTEGER
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM `air carriers` LIMIT 1;
Code || Description
19031 ||Mackey International Inc.: MAC
*/
/* column definitions {
"Code": "the code of the air carriers",
"Description": "the description of air carriers"
}*/
CREATE TABLE Airports
(
Code TEXT
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM airports LIMIT 1;
Code || Description
01A ||Afognak Lake, AK: Afognak Lake Airport
*/
/* column definitions {
"Code": "IATA code of the air airports",
"Description": "the description of airports"
}*/
CREATE TABLE Airlines
(
FL_DATE TEXT,
OP_CARRIER_AIRLINE_ID INTEGER,
TAIL_NUM TEXT,
OP_CARRIER_FL_NUM INTEGER,
ORIGIN_AIRPORT_ID INTEGER,
ORIGIN_AIRPORT_SEQ_ID INTEGER,
ORIGIN_CITY_MARKET_ID INTEGER,
ORIGIN TEXT,
DEST_AIRPORT_ID INTEGER,
DEST_AIRPORT_SEQ_ID INTEGER,
DEST_CITY_MARKET_ID INTEGER,
DEST TEXT,
CRS_DEP_TIME INTEGER,
DEP_TIME INTEGER,
DEP_DELAY INTEGER,
DEP_DELAY_NEW INTEGER,
ARR_TIME INTEGER,
ARR_DELAY INTEGER,
ARR_DELAY_NEW INTEGER,
CANCELLED INTEGER,
CANCELLATION_CODE TEXT,
CRS_ELAPSED_TIME INTEGER,
ACTUAL_ELAPSED_TIME INTEGER,
CARRIER_DELAY INTEGER,
WEATHER_DELAY INTEGER,
NAS_DELAY INTEGER,
SECURITY_DELAY INTEGER,
LATE_AIRCRAFT_DELAY INTEGER,
FOREIGN KEY (ORIGIN) REFERENCES Airports(Code),
FOREIGN KEY (DEST) REFERENCES Airports(Code),
FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code)
)
/*
1 example row:
SELECT * FROM airlines LIMIT 1;
FL_DATE ||OP_CARRIER_AIRLINE_ID ||TAIL_NUM ||OP_CARRIER_FL_NUM ||ORIGIN_AIRPORT_ID ||ORIGIN_AIRPORT_SEQ_ID ||ORIGIN_CITY_MARKET_ID ||ORIGIN ||DEST_AIRPORT_ID ||DEST_AIRPORT_SEQ_ID ||DEST_CITY_MARKET_ID ||DEST ||CRS_DEP_TIME ||DEP_TIME ||DEP_DELAY ||DEP_DELAY_NEW ||ARR_TIME ||ARR_DELAY ||ARR_DELAY_NEW ||CANCELLED ||CANCELLATION_CODE ||CRS_ELAPSED_TIME ||ACTUAL_ELAPSED_TIME ||CARRIER_DELAY ||WEATHER_DELAY ||NAS_DELAY ||SECURITY_DELAY ||LATE_AIRCRAFT_DELAY
2018/8/1 || 19805 || N956AN || 1587 || 12478 || 1247805 || 31703 || JFK || 14107 || 1410702 || 30466 || PHX || 1640 || 1649 || 9 || 9 || 2006 || 44 || 44 || 0 || None || 342 || 377 || 9 || 0 || 35 || 0 || 0
*/
/* column definitions {
"FL_DATE": "flight date",
"OP_CARRIER_AIRLINE_ID": "operator carrier airline id",
"TAIL_NUM": "plane's tail number",
"OP_CARRIER_FL_NUM": "operator carrier flight number",
"ORIGIN_AIRPORT_ID": "origin airport id",
"ORIGIN_AIRPORT_SEQ_ID": "origin airport sequence id",
"ORIGIN_CITY_MARKET_ID": "origin city market id",
"ORIGIN": "airport of origin",
"DEST_AIRPORT_ID": "ID of the destination airport",
"DEST_AIRPORT_SEQ_ID": "",
"DEST_CITY_MARKET_ID": "",
"DEST": "Destination airport",
"CRS_DEP_TIME": "",
"DEP_TIME": "Flight departure time",
"DEP_DELAY": "Departure delay indicator",
"DEP_DELAY_NEW": "departure delay new",
"ARR_TIME": "Flight arrival time.",
"ARR_DELAY": "arrival delay time",
"ARR_DELAY_NEW": "arrival delay new",
"CANCELLED": "Flight cancellation indicator.",
"CANCELLATION_CODE": "cancellation code",
"CRS_ELAPSED_TIME": "scheduled elapsed time",
"ACTUAL_ELAPSED_TIME": "actual elapsed time",
"CARRIER_DELAY": "carrier delay",
"WEATHER_DELAY": "delay caused by the wheather problem",
"NAS_DELAY": "delay, in minutes, attributable to the National Aviation System",
"SECURITY_DELAY": "delay attribute to security",
"LATE_AIRCRAFT_DELAY": "delay attribute to late aircraft"
}*/
### Question
What is the only flight destination for flights from Albany?
Clarification: flight destination refers to DEST; from Albany refers to ORIGIN = 'ABY';
| [query_database(**{'query': 'SELECT DEST FROM Airlines WHERE ORIGIN = 'ABY' GROUP BY DEST'})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE "Air Carriers"
(
Code INTEGER
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM `air carriers` LIMIT 1;
Code || Description
19031 ||Mackey International Inc.: MAC
*/
/* column definitions {
"Code": "the code of the air carriers",
"Description": "the description of air carriers"
}*/
CREATE TABLE Airports
(
Code TEXT
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM airports LIMIT 1;
Code || Description
01A ||Afognak Lake, AK: Afognak Lake Airport
*/
/* column definitions {
"Code": "IATA code of the air airports",
"Description": "the description of airports"
}*/
CREATE TABLE Airlines
(
FL_DATE TEXT,
OP_CARRIER_AIRLINE_ID INTEGER,
TAIL_NUM TEXT,
OP_CARRIER_FL_NUM INTEGER,
ORIGIN_AIRPORT_ID INTEGER,
ORIGIN_AIRPORT_SEQ_ID INTEGER,
ORIGIN_CITY_MARKET_ID INTEGER,
ORIGIN TEXT,
DEST_AIRPORT_ID INTEGER,
DEST_AIRPORT_SEQ_ID INTEGER,
DEST_CITY_MARKET_ID INTEGER,
DEST TEXT,
CRS_DEP_TIME INTEGER,
DEP_TIME INTEGER,
DEP_DELAY INTEGER,
DEP_DELAY_NEW INTEGER,
ARR_TIME INTEGER,
ARR_DELAY INTEGER,
ARR_DELAY_NEW INTEGER,
CANCELLED INTEGER,
CANCELLATION_CODE TEXT,
CRS_ELAPSED_TIME INTEGER,
ACTUAL_ELAPSED_TIME INTEGER,
CARRIER_DELAY INTEGER,
WEATHER_DELAY INTEGER,
NAS_DELAY INTEGER,
SECURITY_DELAY INTEGER,
LATE_AIRCRAFT_DELAY INTEGER,
FOREIGN KEY (ORIGIN) REFERENCES Airports(Code),
FOREIGN KEY (DEST) REFERENCES Airports(Code),
FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code)
)
/*
1 example row:
SELECT * FROM airlines LIMIT 1;
FL_DATE ||OP_CARRIER_AIRLINE_ID ||TAIL_NUM ||OP_CARRIER_FL_NUM ||ORIGIN_AIRPORT_ID ||ORIGIN_AIRPORT_SEQ_ID ||ORIGIN_CITY_MARKET_ID ||ORIGIN ||DEST_AIRPORT_ID ||DEST_AIRPORT_SEQ_ID ||DEST_CITY_MARKET_ID ||DEST ||CRS_DEP_TIME ||DEP_TIME ||DEP_DELAY ||DEP_DELAY_NEW ||ARR_TIME ||ARR_DELAY ||ARR_DELAY_NEW ||CANCELLED ||CANCELLATION_CODE ||CRS_ELAPSED_TIME ||ACTUAL_ELAPSED_TIME ||CARRIER_DELAY ||WEATHER_DELAY ||NAS_DELAY ||SECURITY_DELAY ||LATE_AIRCRAFT_DELAY
2018/8/1 || 19805 || N956AN || 1587 || 12478 || 1247805 || 31703 || JFK || 14107 || 1410702 || 30466 || PHX || 1640 || 1649 || 9 || 9 || 2006 || 44 || 44 || 0 || None || 342 || 377 || 9 || 0 || 35 || 0 || 0
*/
/* column definitions {
"FL_DATE": "flight date",
"OP_CARRIER_AIRLINE_ID": "operator carrier airline id",
"TAIL_NUM": "plane's tail number",
"OP_CARRIER_FL_NUM": "operator carrier flight number",
"ORIGIN_AIRPORT_ID": "origin airport id",
"ORIGIN_AIRPORT_SEQ_ID": "origin airport sequence id",
"ORIGIN_CITY_MARKET_ID": "origin city market id",
"ORIGIN": "airport of origin",
"DEST_AIRPORT_ID": "ID of the destination airport",
"DEST_AIRPORT_SEQ_ID": "",
"DEST_CITY_MARKET_ID": "",
"DEST": "Destination airport",
"CRS_DEP_TIME": "",
"DEP_TIME": "Flight departure time",
"DEP_DELAY": "Departure delay indicator",
"DEP_DELAY_NEW": "departure delay new",
"ARR_TIME": "Flight arrival time.",
"ARR_DELAY": "arrival delay time",
"ARR_DELAY_NEW": "arrival delay new",
"CANCELLED": "Flight cancellation indicator.",
"CANCELLATION_CODE": "cancellation code",
"CRS_ELAPSED_TIME": "scheduled elapsed time",
"ACTUAL_ELAPSED_TIME": "actual elapsed time",
"CARRIER_DELAY": "carrier delay",
"WEATHER_DELAY": "delay caused by the wheather problem",
"NAS_DELAY": "delay, in minutes, attributable to the National Aviation System",
"SECURITY_DELAY": "delay attribute to security",
"LATE_AIRCRAFT_DELAY": "delay attribute to late aircraft"
}*/
|
5,880 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE "Air Carriers"
(
Code INTEGER
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM `air carriers` LIMIT 1;
Code || Description
19031 ||Mackey International Inc.: MAC
*/
/* column definitions {
"Code": "the code of the air carriers",
"Description": "the description of air carriers"
}*/
CREATE TABLE Airports
(
Code TEXT
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM airports LIMIT 1;
Code || Description
01A ||Afognak Lake, AK: Afognak Lake Airport
*/
/* column definitions {
"Code": "IATA code of the air airports",
"Description": "the description of airports"
}*/
CREATE TABLE Airlines
(
FL_DATE TEXT,
OP_CARRIER_AIRLINE_ID INTEGER,
TAIL_NUM TEXT,
OP_CARRIER_FL_NUM INTEGER,
ORIGIN_AIRPORT_ID INTEGER,
ORIGIN_AIRPORT_SEQ_ID INTEGER,
ORIGIN_CITY_MARKET_ID INTEGER,
ORIGIN TEXT,
DEST_AIRPORT_ID INTEGER,
DEST_AIRPORT_SEQ_ID INTEGER,
DEST_CITY_MARKET_ID INTEGER,
DEST TEXT,
CRS_DEP_TIME INTEGER,
DEP_TIME INTEGER,
DEP_DELAY INTEGER,
DEP_DELAY_NEW INTEGER,
ARR_TIME INTEGER,
ARR_DELAY INTEGER,
ARR_DELAY_NEW INTEGER,
CANCELLED INTEGER,
CANCELLATION_CODE TEXT,
CRS_ELAPSED_TIME INTEGER,
ACTUAL_ELAPSED_TIME INTEGER,
CARRIER_DELAY INTEGER,
WEATHER_DELAY INTEGER,
NAS_DELAY INTEGER,
SECURITY_DELAY INTEGER,
LATE_AIRCRAFT_DELAY INTEGER,
FOREIGN KEY (ORIGIN) REFERENCES Airports(Code),
FOREIGN KEY (DEST) REFERENCES Airports(Code),
FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code)
)
/*
1 example row:
SELECT * FROM airlines LIMIT 1;
FL_DATE ||OP_CARRIER_AIRLINE_ID ||TAIL_NUM ||OP_CARRIER_FL_NUM ||ORIGIN_AIRPORT_ID ||ORIGIN_AIRPORT_SEQ_ID ||ORIGIN_CITY_MARKET_ID ||ORIGIN ||DEST_AIRPORT_ID ||DEST_AIRPORT_SEQ_ID ||DEST_CITY_MARKET_ID ||DEST ||CRS_DEP_TIME ||DEP_TIME ||DEP_DELAY ||DEP_DELAY_NEW ||ARR_TIME ||ARR_DELAY ||ARR_DELAY_NEW ||CANCELLED ||CANCELLATION_CODE ||CRS_ELAPSED_TIME ||ACTUAL_ELAPSED_TIME ||CARRIER_DELAY ||WEATHER_DELAY ||NAS_DELAY ||SECURITY_DELAY ||LATE_AIRCRAFT_DELAY
2018/8/1 || 19805 || N956AN || 1587 || 12478 || 1247805 || 31703 || JFK || 14107 || 1410702 || 30466 || PHX || 1640 || 1649 || 9 || 9 || 2006 || 44 || 44 || 0 || None || 342 || 377 || 9 || 0 || 35 || 0 || 0
*/
/* column definitions {
"FL_DATE": "flight date",
"OP_CARRIER_AIRLINE_ID": "operator carrier airline id",
"TAIL_NUM": "plane's tail number",
"OP_CARRIER_FL_NUM": "operator carrier flight number",
"ORIGIN_AIRPORT_ID": "origin airport id",
"ORIGIN_AIRPORT_SEQ_ID": "origin airport sequence id",
"ORIGIN_CITY_MARKET_ID": "origin city market id",
"ORIGIN": "airport of origin",
"DEST_AIRPORT_ID": "ID of the destination airport",
"DEST_AIRPORT_SEQ_ID": "",
"DEST_CITY_MARKET_ID": "",
"DEST": "Destination airport",
"CRS_DEP_TIME": "",
"DEP_TIME": "Flight departure time",
"DEP_DELAY": "Departure delay indicator",
"DEP_DELAY_NEW": "departure delay new",
"ARR_TIME": "Flight arrival time.",
"ARR_DELAY": "arrival delay time",
"ARR_DELAY_NEW": "arrival delay new",
"CANCELLED": "Flight cancellation indicator.",
"CANCELLATION_CODE": "cancellation code",
"CRS_ELAPSED_TIME": "scheduled elapsed time",
"ACTUAL_ELAPSED_TIME": "actual elapsed time",
"CARRIER_DELAY": "carrier delay",
"WEATHER_DELAY": "delay caused by the wheather problem",
"NAS_DELAY": "delay, in minutes, attributable to the National Aviation System",
"SECURITY_DELAY": "delay attribute to security",
"LATE_AIRCRAFT_DELAY": "delay attribute to late aircraft"
}*/
### Question
What is the actual departure time of JetBlue Airways with the plane's tail number N903JB to Fort Lauderdale-Hollywood International Airport on the 20th of August 2018?
Clarification: actual departure time refers to DEP_TIME; JetBlue Airways refers to Description like '%JetBlue Airways%'; tail number refers to TAIL_NUM; TAIL_NUM = 'N903JB'; to refers to DEST; Fort Lauderdale-Hollywood International Airport refers to Description like '%Fort Lauderdale-Hollywood%'; on the 20th of August 2018 refers to FL_DATE = '2018/8/20';
| [query_database(**{'query': 'SELECT T1.DEP_TIME FROM Airlines AS T1 INNER JOIN `Air Carriers` AS T2 ON T1.OP_CARRIER_AIRLINE_ID = T2.Code INNER JOIN Airports AS T3 ON T1.DEST = T3.Code WHERE T1.FL_DATE = '2018/8/20' AND T1.TAIL_NUM = 'N903JB' AND T2.Description LIKE '%JetBlue Airways%' AND T3.Description LIKE '%Fort Lauderdale-Hollywood%''})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE "Air Carriers"
(
Code INTEGER
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM `air carriers` LIMIT 1;
Code || Description
19031 ||Mackey International Inc.: MAC
*/
/* column definitions {
"Code": "the code of the air carriers",
"Description": "the description of air carriers"
}*/
CREATE TABLE Airports
(
Code TEXT
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM airports LIMIT 1;
Code || Description
01A ||Afognak Lake, AK: Afognak Lake Airport
*/
/* column definitions {
"Code": "IATA code of the air airports",
"Description": "the description of airports"
}*/
CREATE TABLE Airlines
(
FL_DATE TEXT,
OP_CARRIER_AIRLINE_ID INTEGER,
TAIL_NUM TEXT,
OP_CARRIER_FL_NUM INTEGER,
ORIGIN_AIRPORT_ID INTEGER,
ORIGIN_AIRPORT_SEQ_ID INTEGER,
ORIGIN_CITY_MARKET_ID INTEGER,
ORIGIN TEXT,
DEST_AIRPORT_ID INTEGER,
DEST_AIRPORT_SEQ_ID INTEGER,
DEST_CITY_MARKET_ID INTEGER,
DEST TEXT,
CRS_DEP_TIME INTEGER,
DEP_TIME INTEGER,
DEP_DELAY INTEGER,
DEP_DELAY_NEW INTEGER,
ARR_TIME INTEGER,
ARR_DELAY INTEGER,
ARR_DELAY_NEW INTEGER,
CANCELLED INTEGER,
CANCELLATION_CODE TEXT,
CRS_ELAPSED_TIME INTEGER,
ACTUAL_ELAPSED_TIME INTEGER,
CARRIER_DELAY INTEGER,
WEATHER_DELAY INTEGER,
NAS_DELAY INTEGER,
SECURITY_DELAY INTEGER,
LATE_AIRCRAFT_DELAY INTEGER,
FOREIGN KEY (ORIGIN) REFERENCES Airports(Code),
FOREIGN KEY (DEST) REFERENCES Airports(Code),
FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code)
)
/*
1 example row:
SELECT * FROM airlines LIMIT 1;
FL_DATE ||OP_CARRIER_AIRLINE_ID ||TAIL_NUM ||OP_CARRIER_FL_NUM ||ORIGIN_AIRPORT_ID ||ORIGIN_AIRPORT_SEQ_ID ||ORIGIN_CITY_MARKET_ID ||ORIGIN ||DEST_AIRPORT_ID ||DEST_AIRPORT_SEQ_ID ||DEST_CITY_MARKET_ID ||DEST ||CRS_DEP_TIME ||DEP_TIME ||DEP_DELAY ||DEP_DELAY_NEW ||ARR_TIME ||ARR_DELAY ||ARR_DELAY_NEW ||CANCELLED ||CANCELLATION_CODE ||CRS_ELAPSED_TIME ||ACTUAL_ELAPSED_TIME ||CARRIER_DELAY ||WEATHER_DELAY ||NAS_DELAY ||SECURITY_DELAY ||LATE_AIRCRAFT_DELAY
2018/8/1 || 19805 || N956AN || 1587 || 12478 || 1247805 || 31703 || JFK || 14107 || 1410702 || 30466 || PHX || 1640 || 1649 || 9 || 9 || 2006 || 44 || 44 || 0 || None || 342 || 377 || 9 || 0 || 35 || 0 || 0
*/
/* column definitions {
"FL_DATE": "flight date",
"OP_CARRIER_AIRLINE_ID": "operator carrier airline id",
"TAIL_NUM": "plane's tail number",
"OP_CARRIER_FL_NUM": "operator carrier flight number",
"ORIGIN_AIRPORT_ID": "origin airport id",
"ORIGIN_AIRPORT_SEQ_ID": "origin airport sequence id",
"ORIGIN_CITY_MARKET_ID": "origin city market id",
"ORIGIN": "airport of origin",
"DEST_AIRPORT_ID": "ID of the destination airport",
"DEST_AIRPORT_SEQ_ID": "",
"DEST_CITY_MARKET_ID": "",
"DEST": "Destination airport",
"CRS_DEP_TIME": "",
"DEP_TIME": "Flight departure time",
"DEP_DELAY": "Departure delay indicator",
"DEP_DELAY_NEW": "departure delay new",
"ARR_TIME": "Flight arrival time.",
"ARR_DELAY": "arrival delay time",
"ARR_DELAY_NEW": "arrival delay new",
"CANCELLED": "Flight cancellation indicator.",
"CANCELLATION_CODE": "cancellation code",
"CRS_ELAPSED_TIME": "scheduled elapsed time",
"ACTUAL_ELAPSED_TIME": "actual elapsed time",
"CARRIER_DELAY": "carrier delay",
"WEATHER_DELAY": "delay caused by the wheather problem",
"NAS_DELAY": "delay, in minutes, attributable to the National Aviation System",
"SECURITY_DELAY": "delay attribute to security",
"LATE_AIRCRAFT_DELAY": "delay attribute to late aircraft"
}*/
|
5,885 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE "Air Carriers"
(
Code INTEGER
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM `air carriers` LIMIT 1;
Code || Description
19031 ||Mackey International Inc.: MAC
*/
/* column definitions {
"Code": "the code of the air carriers",
"Description": "the description of air carriers"
}*/
CREATE TABLE Airports
(
Code TEXT
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM airports LIMIT 1;
Code || Description
01A ||Afognak Lake, AK: Afognak Lake Airport
*/
/* column definitions {
"Code": "IATA code of the air airports",
"Description": "the description of airports"
}*/
CREATE TABLE Airlines
(
FL_DATE TEXT,
OP_CARRIER_AIRLINE_ID INTEGER,
TAIL_NUM TEXT,
OP_CARRIER_FL_NUM INTEGER,
ORIGIN_AIRPORT_ID INTEGER,
ORIGIN_AIRPORT_SEQ_ID INTEGER,
ORIGIN_CITY_MARKET_ID INTEGER,
ORIGIN TEXT,
DEST_AIRPORT_ID INTEGER,
DEST_AIRPORT_SEQ_ID INTEGER,
DEST_CITY_MARKET_ID INTEGER,
DEST TEXT,
CRS_DEP_TIME INTEGER,
DEP_TIME INTEGER,
DEP_DELAY INTEGER,
DEP_DELAY_NEW INTEGER,
ARR_TIME INTEGER,
ARR_DELAY INTEGER,
ARR_DELAY_NEW INTEGER,
CANCELLED INTEGER,
CANCELLATION_CODE TEXT,
CRS_ELAPSED_TIME INTEGER,
ACTUAL_ELAPSED_TIME INTEGER,
CARRIER_DELAY INTEGER,
WEATHER_DELAY INTEGER,
NAS_DELAY INTEGER,
SECURITY_DELAY INTEGER,
LATE_AIRCRAFT_DELAY INTEGER,
FOREIGN KEY (ORIGIN) REFERENCES Airports(Code),
FOREIGN KEY (DEST) REFERENCES Airports(Code),
FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code)
)
/*
1 example row:
SELECT * FROM airlines LIMIT 1;
FL_DATE ||OP_CARRIER_AIRLINE_ID ||TAIL_NUM ||OP_CARRIER_FL_NUM ||ORIGIN_AIRPORT_ID ||ORIGIN_AIRPORT_SEQ_ID ||ORIGIN_CITY_MARKET_ID ||ORIGIN ||DEST_AIRPORT_ID ||DEST_AIRPORT_SEQ_ID ||DEST_CITY_MARKET_ID ||DEST ||CRS_DEP_TIME ||DEP_TIME ||DEP_DELAY ||DEP_DELAY_NEW ||ARR_TIME ||ARR_DELAY ||ARR_DELAY_NEW ||CANCELLED ||CANCELLATION_CODE ||CRS_ELAPSED_TIME ||ACTUAL_ELAPSED_TIME ||CARRIER_DELAY ||WEATHER_DELAY ||NAS_DELAY ||SECURITY_DELAY ||LATE_AIRCRAFT_DELAY
2018/8/1 || 19805 || N956AN || 1587 || 12478 || 1247805 || 31703 || JFK || 14107 || 1410702 || 30466 || PHX || 1640 || 1649 || 9 || 9 || 2006 || 44 || 44 || 0 || None || 342 || 377 || 9 || 0 || 35 || 0 || 0
*/
/* column definitions {
"FL_DATE": "flight date",
"OP_CARRIER_AIRLINE_ID": "operator carrier airline id",
"TAIL_NUM": "plane's tail number",
"OP_CARRIER_FL_NUM": "operator carrier flight number",
"ORIGIN_AIRPORT_ID": "origin airport id",
"ORIGIN_AIRPORT_SEQ_ID": "origin airport sequence id",
"ORIGIN_CITY_MARKET_ID": "origin city market id",
"ORIGIN": "airport of origin",
"DEST_AIRPORT_ID": "ID of the destination airport",
"DEST_AIRPORT_SEQ_ID": "",
"DEST_CITY_MARKET_ID": "",
"DEST": "Destination airport",
"CRS_DEP_TIME": "",
"DEP_TIME": "Flight departure time",
"DEP_DELAY": "Departure delay indicator",
"DEP_DELAY_NEW": "departure delay new",
"ARR_TIME": "Flight arrival time.",
"ARR_DELAY": "arrival delay time",
"ARR_DELAY_NEW": "arrival delay new",
"CANCELLED": "Flight cancellation indicator.",
"CANCELLATION_CODE": "cancellation code",
"CRS_ELAPSED_TIME": "scheduled elapsed time",
"ACTUAL_ELAPSED_TIME": "actual elapsed time",
"CARRIER_DELAY": "carrier delay",
"WEATHER_DELAY": "delay caused by the wheather problem",
"NAS_DELAY": "delay, in minutes, attributable to the National Aviation System",
"SECURITY_DELAY": "delay attribute to security",
"LATE_AIRCRAFT_DELAY": "delay attribute to late aircraft"
}*/
### Question
Provide the destinations of flight number 1596.
Clarification: destination refers to DEST; flight number refers to OP_CARRIER_FL_NUM; OP_CARRIER_FL_NUM = 1596;
| [query_database(**{'query': 'SELECT DEST FROM Airlines WHERE OP_CARRIER_FL_NUM = 1596'})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE "Air Carriers"
(
Code INTEGER
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM `air carriers` LIMIT 1;
Code || Description
19031 ||Mackey International Inc.: MAC
*/
/* column definitions {
"Code": "the code of the air carriers",
"Description": "the description of air carriers"
}*/
CREATE TABLE Airports
(
Code TEXT
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM airports LIMIT 1;
Code || Description
01A ||Afognak Lake, AK: Afognak Lake Airport
*/
/* column definitions {
"Code": "IATA code of the air airports",
"Description": "the description of airports"
}*/
CREATE TABLE Airlines
(
FL_DATE TEXT,
OP_CARRIER_AIRLINE_ID INTEGER,
TAIL_NUM TEXT,
OP_CARRIER_FL_NUM INTEGER,
ORIGIN_AIRPORT_ID INTEGER,
ORIGIN_AIRPORT_SEQ_ID INTEGER,
ORIGIN_CITY_MARKET_ID INTEGER,
ORIGIN TEXT,
DEST_AIRPORT_ID INTEGER,
DEST_AIRPORT_SEQ_ID INTEGER,
DEST_CITY_MARKET_ID INTEGER,
DEST TEXT,
CRS_DEP_TIME INTEGER,
DEP_TIME INTEGER,
DEP_DELAY INTEGER,
DEP_DELAY_NEW INTEGER,
ARR_TIME INTEGER,
ARR_DELAY INTEGER,
ARR_DELAY_NEW INTEGER,
CANCELLED INTEGER,
CANCELLATION_CODE TEXT,
CRS_ELAPSED_TIME INTEGER,
ACTUAL_ELAPSED_TIME INTEGER,
CARRIER_DELAY INTEGER,
WEATHER_DELAY INTEGER,
NAS_DELAY INTEGER,
SECURITY_DELAY INTEGER,
LATE_AIRCRAFT_DELAY INTEGER,
FOREIGN KEY (ORIGIN) REFERENCES Airports(Code),
FOREIGN KEY (DEST) REFERENCES Airports(Code),
FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code)
)
/*
1 example row:
SELECT * FROM airlines LIMIT 1;
FL_DATE ||OP_CARRIER_AIRLINE_ID ||TAIL_NUM ||OP_CARRIER_FL_NUM ||ORIGIN_AIRPORT_ID ||ORIGIN_AIRPORT_SEQ_ID ||ORIGIN_CITY_MARKET_ID ||ORIGIN ||DEST_AIRPORT_ID ||DEST_AIRPORT_SEQ_ID ||DEST_CITY_MARKET_ID ||DEST ||CRS_DEP_TIME ||DEP_TIME ||DEP_DELAY ||DEP_DELAY_NEW ||ARR_TIME ||ARR_DELAY ||ARR_DELAY_NEW ||CANCELLED ||CANCELLATION_CODE ||CRS_ELAPSED_TIME ||ACTUAL_ELAPSED_TIME ||CARRIER_DELAY ||WEATHER_DELAY ||NAS_DELAY ||SECURITY_DELAY ||LATE_AIRCRAFT_DELAY
2018/8/1 || 19805 || N956AN || 1587 || 12478 || 1247805 || 31703 || JFK || 14107 || 1410702 || 30466 || PHX || 1640 || 1649 || 9 || 9 || 2006 || 44 || 44 || 0 || None || 342 || 377 || 9 || 0 || 35 || 0 || 0
*/
/* column definitions {
"FL_DATE": "flight date",
"OP_CARRIER_AIRLINE_ID": "operator carrier airline id",
"TAIL_NUM": "plane's tail number",
"OP_CARRIER_FL_NUM": "operator carrier flight number",
"ORIGIN_AIRPORT_ID": "origin airport id",
"ORIGIN_AIRPORT_SEQ_ID": "origin airport sequence id",
"ORIGIN_CITY_MARKET_ID": "origin city market id",
"ORIGIN": "airport of origin",
"DEST_AIRPORT_ID": "ID of the destination airport",
"DEST_AIRPORT_SEQ_ID": "",
"DEST_CITY_MARKET_ID": "",
"DEST": "Destination airport",
"CRS_DEP_TIME": "",
"DEP_TIME": "Flight departure time",
"DEP_DELAY": "Departure delay indicator",
"DEP_DELAY_NEW": "departure delay new",
"ARR_TIME": "Flight arrival time.",
"ARR_DELAY": "arrival delay time",
"ARR_DELAY_NEW": "arrival delay new",
"CANCELLED": "Flight cancellation indicator.",
"CANCELLATION_CODE": "cancellation code",
"CRS_ELAPSED_TIME": "scheduled elapsed time",
"ACTUAL_ELAPSED_TIME": "actual elapsed time",
"CARRIER_DELAY": "carrier delay",
"WEATHER_DELAY": "delay caused by the wheather problem",
"NAS_DELAY": "delay, in minutes, attributable to the National Aviation System",
"SECURITY_DELAY": "delay attribute to security",
"LATE_AIRCRAFT_DELAY": "delay attribute to late aircraft"
}*/
|
5,889 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE "Air Carriers"
(
Code INTEGER
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM `air carriers` LIMIT 1;
Code || Description
19031 ||Mackey International Inc.: MAC
*/
/* column definitions {
"Code": "the code of the air carriers",
"Description": "the description of air carriers"
}*/
CREATE TABLE Airports
(
Code TEXT
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM airports LIMIT 1;
Code || Description
01A ||Afognak Lake, AK: Afognak Lake Airport
*/
/* column definitions {
"Code": "IATA code of the air airports",
"Description": "the description of airports"
}*/
CREATE TABLE Airlines
(
FL_DATE TEXT,
OP_CARRIER_AIRLINE_ID INTEGER,
TAIL_NUM TEXT,
OP_CARRIER_FL_NUM INTEGER,
ORIGIN_AIRPORT_ID INTEGER,
ORIGIN_AIRPORT_SEQ_ID INTEGER,
ORIGIN_CITY_MARKET_ID INTEGER,
ORIGIN TEXT,
DEST_AIRPORT_ID INTEGER,
DEST_AIRPORT_SEQ_ID INTEGER,
DEST_CITY_MARKET_ID INTEGER,
DEST TEXT,
CRS_DEP_TIME INTEGER,
DEP_TIME INTEGER,
DEP_DELAY INTEGER,
DEP_DELAY_NEW INTEGER,
ARR_TIME INTEGER,
ARR_DELAY INTEGER,
ARR_DELAY_NEW INTEGER,
CANCELLED INTEGER,
CANCELLATION_CODE TEXT,
CRS_ELAPSED_TIME INTEGER,
ACTUAL_ELAPSED_TIME INTEGER,
CARRIER_DELAY INTEGER,
WEATHER_DELAY INTEGER,
NAS_DELAY INTEGER,
SECURITY_DELAY INTEGER,
LATE_AIRCRAFT_DELAY INTEGER,
FOREIGN KEY (ORIGIN) REFERENCES Airports(Code),
FOREIGN KEY (DEST) REFERENCES Airports(Code),
FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code)
)
/*
1 example row:
SELECT * FROM airlines LIMIT 1;
FL_DATE ||OP_CARRIER_AIRLINE_ID ||TAIL_NUM ||OP_CARRIER_FL_NUM ||ORIGIN_AIRPORT_ID ||ORIGIN_AIRPORT_SEQ_ID ||ORIGIN_CITY_MARKET_ID ||ORIGIN ||DEST_AIRPORT_ID ||DEST_AIRPORT_SEQ_ID ||DEST_CITY_MARKET_ID ||DEST ||CRS_DEP_TIME ||DEP_TIME ||DEP_DELAY ||DEP_DELAY_NEW ||ARR_TIME ||ARR_DELAY ||ARR_DELAY_NEW ||CANCELLED ||CANCELLATION_CODE ||CRS_ELAPSED_TIME ||ACTUAL_ELAPSED_TIME ||CARRIER_DELAY ||WEATHER_DELAY ||NAS_DELAY ||SECURITY_DELAY ||LATE_AIRCRAFT_DELAY
2018/8/1 || 19805 || N956AN || 1587 || 12478 || 1247805 || 31703 || JFK || 14107 || 1410702 || 30466 || PHX || 1640 || 1649 || 9 || 9 || 2006 || 44 || 44 || 0 || None || 342 || 377 || 9 || 0 || 35 || 0 || 0
*/
/* column definitions {
"FL_DATE": "flight date",
"OP_CARRIER_AIRLINE_ID": "operator carrier airline id",
"TAIL_NUM": "plane's tail number",
"OP_CARRIER_FL_NUM": "operator carrier flight number",
"ORIGIN_AIRPORT_ID": "origin airport id",
"ORIGIN_AIRPORT_SEQ_ID": "origin airport sequence id",
"ORIGIN_CITY_MARKET_ID": "origin city market id",
"ORIGIN": "airport of origin",
"DEST_AIRPORT_ID": "ID of the destination airport",
"DEST_AIRPORT_SEQ_ID": "",
"DEST_CITY_MARKET_ID": "",
"DEST": "Destination airport",
"CRS_DEP_TIME": "",
"DEP_TIME": "Flight departure time",
"DEP_DELAY": "Departure delay indicator",
"DEP_DELAY_NEW": "departure delay new",
"ARR_TIME": "Flight arrival time.",
"ARR_DELAY": "arrival delay time",
"ARR_DELAY_NEW": "arrival delay new",
"CANCELLED": "Flight cancellation indicator.",
"CANCELLATION_CODE": "cancellation code",
"CRS_ELAPSED_TIME": "scheduled elapsed time",
"ACTUAL_ELAPSED_TIME": "actual elapsed time",
"CARRIER_DELAY": "carrier delay",
"WEATHER_DELAY": "delay caused by the wheather problem",
"NAS_DELAY": "delay, in minutes, attributable to the National Aviation System",
"SECURITY_DELAY": "delay attribute to security",
"LATE_AIRCRAFT_DELAY": "delay attribute to late aircraft"
}*/
### Question
List the tail number of flights that flew on August 17, 2018.
Clarification: tail number refers to TAIL_NUM; on August 17, 2018 refers to FL_DATE = '2018/8/17';
| [query_database(**{'query': 'SELECT TAIL_NUM FROM Airlines WHERE FL_DATE = '2018/8/17' GROUP BY TAIL_NUM'})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE "Air Carriers"
(
Code INTEGER
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM `air carriers` LIMIT 1;
Code || Description
19031 ||Mackey International Inc.: MAC
*/
/* column definitions {
"Code": "the code of the air carriers",
"Description": "the description of air carriers"
}*/
CREATE TABLE Airports
(
Code TEXT
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM airports LIMIT 1;
Code || Description
01A ||Afognak Lake, AK: Afognak Lake Airport
*/
/* column definitions {
"Code": "IATA code of the air airports",
"Description": "the description of airports"
}*/
CREATE TABLE Airlines
(
FL_DATE TEXT,
OP_CARRIER_AIRLINE_ID INTEGER,
TAIL_NUM TEXT,
OP_CARRIER_FL_NUM INTEGER,
ORIGIN_AIRPORT_ID INTEGER,
ORIGIN_AIRPORT_SEQ_ID INTEGER,
ORIGIN_CITY_MARKET_ID INTEGER,
ORIGIN TEXT,
DEST_AIRPORT_ID INTEGER,
DEST_AIRPORT_SEQ_ID INTEGER,
DEST_CITY_MARKET_ID INTEGER,
DEST TEXT,
CRS_DEP_TIME INTEGER,
DEP_TIME INTEGER,
DEP_DELAY INTEGER,
DEP_DELAY_NEW INTEGER,
ARR_TIME INTEGER,
ARR_DELAY INTEGER,
ARR_DELAY_NEW INTEGER,
CANCELLED INTEGER,
CANCELLATION_CODE TEXT,
CRS_ELAPSED_TIME INTEGER,
ACTUAL_ELAPSED_TIME INTEGER,
CARRIER_DELAY INTEGER,
WEATHER_DELAY INTEGER,
NAS_DELAY INTEGER,
SECURITY_DELAY INTEGER,
LATE_AIRCRAFT_DELAY INTEGER,
FOREIGN KEY (ORIGIN) REFERENCES Airports(Code),
FOREIGN KEY (DEST) REFERENCES Airports(Code),
FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code)
)
/*
1 example row:
SELECT * FROM airlines LIMIT 1;
FL_DATE ||OP_CARRIER_AIRLINE_ID ||TAIL_NUM ||OP_CARRIER_FL_NUM ||ORIGIN_AIRPORT_ID ||ORIGIN_AIRPORT_SEQ_ID ||ORIGIN_CITY_MARKET_ID ||ORIGIN ||DEST_AIRPORT_ID ||DEST_AIRPORT_SEQ_ID ||DEST_CITY_MARKET_ID ||DEST ||CRS_DEP_TIME ||DEP_TIME ||DEP_DELAY ||DEP_DELAY_NEW ||ARR_TIME ||ARR_DELAY ||ARR_DELAY_NEW ||CANCELLED ||CANCELLATION_CODE ||CRS_ELAPSED_TIME ||ACTUAL_ELAPSED_TIME ||CARRIER_DELAY ||WEATHER_DELAY ||NAS_DELAY ||SECURITY_DELAY ||LATE_AIRCRAFT_DELAY
2018/8/1 || 19805 || N956AN || 1587 || 12478 || 1247805 || 31703 || JFK || 14107 || 1410702 || 30466 || PHX || 1640 || 1649 || 9 || 9 || 2006 || 44 || 44 || 0 || None || 342 || 377 || 9 || 0 || 35 || 0 || 0
*/
/* column definitions {
"FL_DATE": "flight date",
"OP_CARRIER_AIRLINE_ID": "operator carrier airline id",
"TAIL_NUM": "plane's tail number",
"OP_CARRIER_FL_NUM": "operator carrier flight number",
"ORIGIN_AIRPORT_ID": "origin airport id",
"ORIGIN_AIRPORT_SEQ_ID": "origin airport sequence id",
"ORIGIN_CITY_MARKET_ID": "origin city market id",
"ORIGIN": "airport of origin",
"DEST_AIRPORT_ID": "ID of the destination airport",
"DEST_AIRPORT_SEQ_ID": "",
"DEST_CITY_MARKET_ID": "",
"DEST": "Destination airport",
"CRS_DEP_TIME": "",
"DEP_TIME": "Flight departure time",
"DEP_DELAY": "Departure delay indicator",
"DEP_DELAY_NEW": "departure delay new",
"ARR_TIME": "Flight arrival time.",
"ARR_DELAY": "arrival delay time",
"ARR_DELAY_NEW": "arrival delay new",
"CANCELLED": "Flight cancellation indicator.",
"CANCELLATION_CODE": "cancellation code",
"CRS_ELAPSED_TIME": "scheduled elapsed time",
"ACTUAL_ELAPSED_TIME": "actual elapsed time",
"CARRIER_DELAY": "carrier delay",
"WEATHER_DELAY": "delay caused by the wheather problem",
"NAS_DELAY": "delay, in minutes, attributable to the National Aviation System",
"SECURITY_DELAY": "delay attribute to security",
"LATE_AIRCRAFT_DELAY": "delay attribute to late aircraft"
}*/
|
5,893 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE "Air Carriers"
(
Code INTEGER
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM `air carriers` LIMIT 1;
Code || Description
19031 ||Mackey International Inc.: MAC
*/
/* column definitions {
"Code": "the code of the air carriers",
"Description": "the description of air carriers"
}*/
CREATE TABLE Airports
(
Code TEXT
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM airports LIMIT 1;
Code || Description
01A ||Afognak Lake, AK: Afognak Lake Airport
*/
/* column definitions {
"Code": "IATA code of the air airports",
"Description": "the description of airports"
}*/
CREATE TABLE Airlines
(
FL_DATE TEXT,
OP_CARRIER_AIRLINE_ID INTEGER,
TAIL_NUM TEXT,
OP_CARRIER_FL_NUM INTEGER,
ORIGIN_AIRPORT_ID INTEGER,
ORIGIN_AIRPORT_SEQ_ID INTEGER,
ORIGIN_CITY_MARKET_ID INTEGER,
ORIGIN TEXT,
DEST_AIRPORT_ID INTEGER,
DEST_AIRPORT_SEQ_ID INTEGER,
DEST_CITY_MARKET_ID INTEGER,
DEST TEXT,
CRS_DEP_TIME INTEGER,
DEP_TIME INTEGER,
DEP_DELAY INTEGER,
DEP_DELAY_NEW INTEGER,
ARR_TIME INTEGER,
ARR_DELAY INTEGER,
ARR_DELAY_NEW INTEGER,
CANCELLED INTEGER,
CANCELLATION_CODE TEXT,
CRS_ELAPSED_TIME INTEGER,
ACTUAL_ELAPSED_TIME INTEGER,
CARRIER_DELAY INTEGER,
WEATHER_DELAY INTEGER,
NAS_DELAY INTEGER,
SECURITY_DELAY INTEGER,
LATE_AIRCRAFT_DELAY INTEGER,
FOREIGN KEY (ORIGIN) REFERENCES Airports(Code),
FOREIGN KEY (DEST) REFERENCES Airports(Code),
FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code)
)
/*
1 example row:
SELECT * FROM airlines LIMIT 1;
FL_DATE ||OP_CARRIER_AIRLINE_ID ||TAIL_NUM ||OP_CARRIER_FL_NUM ||ORIGIN_AIRPORT_ID ||ORIGIN_AIRPORT_SEQ_ID ||ORIGIN_CITY_MARKET_ID ||ORIGIN ||DEST_AIRPORT_ID ||DEST_AIRPORT_SEQ_ID ||DEST_CITY_MARKET_ID ||DEST ||CRS_DEP_TIME ||DEP_TIME ||DEP_DELAY ||DEP_DELAY_NEW ||ARR_TIME ||ARR_DELAY ||ARR_DELAY_NEW ||CANCELLED ||CANCELLATION_CODE ||CRS_ELAPSED_TIME ||ACTUAL_ELAPSED_TIME ||CARRIER_DELAY ||WEATHER_DELAY ||NAS_DELAY ||SECURITY_DELAY ||LATE_AIRCRAFT_DELAY
2018/8/1 || 19805 || N956AN || 1587 || 12478 || 1247805 || 31703 || JFK || 14107 || 1410702 || 30466 || PHX || 1640 || 1649 || 9 || 9 || 2006 || 44 || 44 || 0 || None || 342 || 377 || 9 || 0 || 35 || 0 || 0
*/
/* column definitions {
"FL_DATE": "flight date",
"OP_CARRIER_AIRLINE_ID": "operator carrier airline id",
"TAIL_NUM": "plane's tail number",
"OP_CARRIER_FL_NUM": "operator carrier flight number",
"ORIGIN_AIRPORT_ID": "origin airport id",
"ORIGIN_AIRPORT_SEQ_ID": "origin airport sequence id",
"ORIGIN_CITY_MARKET_ID": "origin city market id",
"ORIGIN": "airport of origin",
"DEST_AIRPORT_ID": "ID of the destination airport",
"DEST_AIRPORT_SEQ_ID": "",
"DEST_CITY_MARKET_ID": "",
"DEST": "Destination airport",
"CRS_DEP_TIME": "",
"DEP_TIME": "Flight departure time",
"DEP_DELAY": "Departure delay indicator",
"DEP_DELAY_NEW": "departure delay new",
"ARR_TIME": "Flight arrival time.",
"ARR_DELAY": "arrival delay time",
"ARR_DELAY_NEW": "arrival delay new",
"CANCELLED": "Flight cancellation indicator.",
"CANCELLATION_CODE": "cancellation code",
"CRS_ELAPSED_TIME": "scheduled elapsed time",
"ACTUAL_ELAPSED_TIME": "actual elapsed time",
"CARRIER_DELAY": "carrier delay",
"WEATHER_DELAY": "delay caused by the wheather problem",
"NAS_DELAY": "delay, in minutes, attributable to the National Aviation System",
"SECURITY_DELAY": "delay attribute to security",
"LATE_AIRCRAFT_DELAY": "delay attribute to late aircraft"
}*/
### Question
How many flights of air carrier called JetBlue Airways: B6 have 0 new arrival delay?
Clarification: JetBlue Airways refers to Description = '%JetBlue Airway%'; 0 new arrival delay refers to ARR_DELAY_NEW = 0;
| [query_database(**{'query': 'SELECT COUNT(*) FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T1.Description LIKE '%JetBlue Airways: B6%' AND T2.ARR_DELAY_NEW = 0'})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE "Air Carriers"
(
Code INTEGER
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM `air carriers` LIMIT 1;
Code || Description
19031 ||Mackey International Inc.: MAC
*/
/* column definitions {
"Code": "the code of the air carriers",
"Description": "the description of air carriers"
}*/
CREATE TABLE Airports
(
Code TEXT
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM airports LIMIT 1;
Code || Description
01A ||Afognak Lake, AK: Afognak Lake Airport
*/
/* column definitions {
"Code": "IATA code of the air airports",
"Description": "the description of airports"
}*/
CREATE TABLE Airlines
(
FL_DATE TEXT,
OP_CARRIER_AIRLINE_ID INTEGER,
TAIL_NUM TEXT,
OP_CARRIER_FL_NUM INTEGER,
ORIGIN_AIRPORT_ID INTEGER,
ORIGIN_AIRPORT_SEQ_ID INTEGER,
ORIGIN_CITY_MARKET_ID INTEGER,
ORIGIN TEXT,
DEST_AIRPORT_ID INTEGER,
DEST_AIRPORT_SEQ_ID INTEGER,
DEST_CITY_MARKET_ID INTEGER,
DEST TEXT,
CRS_DEP_TIME INTEGER,
DEP_TIME INTEGER,
DEP_DELAY INTEGER,
DEP_DELAY_NEW INTEGER,
ARR_TIME INTEGER,
ARR_DELAY INTEGER,
ARR_DELAY_NEW INTEGER,
CANCELLED INTEGER,
CANCELLATION_CODE TEXT,
CRS_ELAPSED_TIME INTEGER,
ACTUAL_ELAPSED_TIME INTEGER,
CARRIER_DELAY INTEGER,
WEATHER_DELAY INTEGER,
NAS_DELAY INTEGER,
SECURITY_DELAY INTEGER,
LATE_AIRCRAFT_DELAY INTEGER,
FOREIGN KEY (ORIGIN) REFERENCES Airports(Code),
FOREIGN KEY (DEST) REFERENCES Airports(Code),
FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code)
)
/*
1 example row:
SELECT * FROM airlines LIMIT 1;
FL_DATE ||OP_CARRIER_AIRLINE_ID ||TAIL_NUM ||OP_CARRIER_FL_NUM ||ORIGIN_AIRPORT_ID ||ORIGIN_AIRPORT_SEQ_ID ||ORIGIN_CITY_MARKET_ID ||ORIGIN ||DEST_AIRPORT_ID ||DEST_AIRPORT_SEQ_ID ||DEST_CITY_MARKET_ID ||DEST ||CRS_DEP_TIME ||DEP_TIME ||DEP_DELAY ||DEP_DELAY_NEW ||ARR_TIME ||ARR_DELAY ||ARR_DELAY_NEW ||CANCELLED ||CANCELLATION_CODE ||CRS_ELAPSED_TIME ||ACTUAL_ELAPSED_TIME ||CARRIER_DELAY ||WEATHER_DELAY ||NAS_DELAY ||SECURITY_DELAY ||LATE_AIRCRAFT_DELAY
2018/8/1 || 19805 || N956AN || 1587 || 12478 || 1247805 || 31703 || JFK || 14107 || 1410702 || 30466 || PHX || 1640 || 1649 || 9 || 9 || 2006 || 44 || 44 || 0 || None || 342 || 377 || 9 || 0 || 35 || 0 || 0
*/
/* column definitions {
"FL_DATE": "flight date",
"OP_CARRIER_AIRLINE_ID": "operator carrier airline id",
"TAIL_NUM": "plane's tail number",
"OP_CARRIER_FL_NUM": "operator carrier flight number",
"ORIGIN_AIRPORT_ID": "origin airport id",
"ORIGIN_AIRPORT_SEQ_ID": "origin airport sequence id",
"ORIGIN_CITY_MARKET_ID": "origin city market id",
"ORIGIN": "airport of origin",
"DEST_AIRPORT_ID": "ID of the destination airport",
"DEST_AIRPORT_SEQ_ID": "",
"DEST_CITY_MARKET_ID": "",
"DEST": "Destination airport",
"CRS_DEP_TIME": "",
"DEP_TIME": "Flight departure time",
"DEP_DELAY": "Departure delay indicator",
"DEP_DELAY_NEW": "departure delay new",
"ARR_TIME": "Flight arrival time.",
"ARR_DELAY": "arrival delay time",
"ARR_DELAY_NEW": "arrival delay new",
"CANCELLED": "Flight cancellation indicator.",
"CANCELLATION_CODE": "cancellation code",
"CRS_ELAPSED_TIME": "scheduled elapsed time",
"ACTUAL_ELAPSED_TIME": "actual elapsed time",
"CARRIER_DELAY": "carrier delay",
"WEATHER_DELAY": "delay caused by the wheather problem",
"NAS_DELAY": "delay, in minutes, attributable to the National Aviation System",
"SECURITY_DELAY": "delay attribute to security",
"LATE_AIRCRAFT_DELAY": "delay attribute to late aircraft"
}*/
|
5,896 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE "Air Carriers"
(
Code INTEGER
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM `air carriers` LIMIT 1;
Code || Description
19031 ||Mackey International Inc.: MAC
*/
/* column definitions {
"Code": "the code of the air carriers",
"Description": "the description of air carriers"
}*/
CREATE TABLE Airports
(
Code TEXT
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM airports LIMIT 1;
Code || Description
01A ||Afognak Lake, AK: Afognak Lake Airport
*/
/* column definitions {
"Code": "IATA code of the air airports",
"Description": "the description of airports"
}*/
CREATE TABLE Airlines
(
FL_DATE TEXT,
OP_CARRIER_AIRLINE_ID INTEGER,
TAIL_NUM TEXT,
OP_CARRIER_FL_NUM INTEGER,
ORIGIN_AIRPORT_ID INTEGER,
ORIGIN_AIRPORT_SEQ_ID INTEGER,
ORIGIN_CITY_MARKET_ID INTEGER,
ORIGIN TEXT,
DEST_AIRPORT_ID INTEGER,
DEST_AIRPORT_SEQ_ID INTEGER,
DEST_CITY_MARKET_ID INTEGER,
DEST TEXT,
CRS_DEP_TIME INTEGER,
DEP_TIME INTEGER,
DEP_DELAY INTEGER,
DEP_DELAY_NEW INTEGER,
ARR_TIME INTEGER,
ARR_DELAY INTEGER,
ARR_DELAY_NEW INTEGER,
CANCELLED INTEGER,
CANCELLATION_CODE TEXT,
CRS_ELAPSED_TIME INTEGER,
ACTUAL_ELAPSED_TIME INTEGER,
CARRIER_DELAY INTEGER,
WEATHER_DELAY INTEGER,
NAS_DELAY INTEGER,
SECURITY_DELAY INTEGER,
LATE_AIRCRAFT_DELAY INTEGER,
FOREIGN KEY (ORIGIN) REFERENCES Airports(Code),
FOREIGN KEY (DEST) REFERENCES Airports(Code),
FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code)
)
/*
1 example row:
SELECT * FROM airlines LIMIT 1;
FL_DATE ||OP_CARRIER_AIRLINE_ID ||TAIL_NUM ||OP_CARRIER_FL_NUM ||ORIGIN_AIRPORT_ID ||ORIGIN_AIRPORT_SEQ_ID ||ORIGIN_CITY_MARKET_ID ||ORIGIN ||DEST_AIRPORT_ID ||DEST_AIRPORT_SEQ_ID ||DEST_CITY_MARKET_ID ||DEST ||CRS_DEP_TIME ||DEP_TIME ||DEP_DELAY ||DEP_DELAY_NEW ||ARR_TIME ||ARR_DELAY ||ARR_DELAY_NEW ||CANCELLED ||CANCELLATION_CODE ||CRS_ELAPSED_TIME ||ACTUAL_ELAPSED_TIME ||CARRIER_DELAY ||WEATHER_DELAY ||NAS_DELAY ||SECURITY_DELAY ||LATE_AIRCRAFT_DELAY
2018/8/1 || 19805 || N956AN || 1587 || 12478 || 1247805 || 31703 || JFK || 14107 || 1410702 || 30466 || PHX || 1640 || 1649 || 9 || 9 || 2006 || 44 || 44 || 0 || None || 342 || 377 || 9 || 0 || 35 || 0 || 0
*/
/* column definitions {
"FL_DATE": "flight date",
"OP_CARRIER_AIRLINE_ID": "operator carrier airline id",
"TAIL_NUM": "plane's tail number",
"OP_CARRIER_FL_NUM": "operator carrier flight number",
"ORIGIN_AIRPORT_ID": "origin airport id",
"ORIGIN_AIRPORT_SEQ_ID": "origin airport sequence id",
"ORIGIN_CITY_MARKET_ID": "origin city market id",
"ORIGIN": "airport of origin",
"DEST_AIRPORT_ID": "ID of the destination airport",
"DEST_AIRPORT_SEQ_ID": "",
"DEST_CITY_MARKET_ID": "",
"DEST": "Destination airport",
"CRS_DEP_TIME": "",
"DEP_TIME": "Flight departure time",
"DEP_DELAY": "Departure delay indicator",
"DEP_DELAY_NEW": "departure delay new",
"ARR_TIME": "Flight arrival time.",
"ARR_DELAY": "arrival delay time",
"ARR_DELAY_NEW": "arrival delay new",
"CANCELLED": "Flight cancellation indicator.",
"CANCELLATION_CODE": "cancellation code",
"CRS_ELAPSED_TIME": "scheduled elapsed time",
"ACTUAL_ELAPSED_TIME": "actual elapsed time",
"CARRIER_DELAY": "carrier delay",
"WEATHER_DELAY": "delay caused by the wheather problem",
"NAS_DELAY": "delay, in minutes, attributable to the National Aviation System",
"SECURITY_DELAY": "delay attribute to security",
"LATE_AIRCRAFT_DELAY": "delay attribute to late aircraft"
}*/
### Question
Give the actual elapsed time of the flights with air carrier named Semo Aviation Inc.: SEM.
Clarification: actual elapsed time refers to ACTUAL_ELAPSED_TIME; Semo Aviation Inc.: SEM. Refers to Description = 'Semo Aviation Inc.: SEM';
| [query_database(**{'query': 'SELECT T2.ACTUAL_ELAPSED_TIME FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T1.Description = 'Semo Aviation Inc.: SEM''})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE "Air Carriers"
(
Code INTEGER
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM `air carriers` LIMIT 1;
Code || Description
19031 ||Mackey International Inc.: MAC
*/
/* column definitions {
"Code": "the code of the air carriers",
"Description": "the description of air carriers"
}*/
CREATE TABLE Airports
(
Code TEXT
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM airports LIMIT 1;
Code || Description
01A ||Afognak Lake, AK: Afognak Lake Airport
*/
/* column definitions {
"Code": "IATA code of the air airports",
"Description": "the description of airports"
}*/
CREATE TABLE Airlines
(
FL_DATE TEXT,
OP_CARRIER_AIRLINE_ID INTEGER,
TAIL_NUM TEXT,
OP_CARRIER_FL_NUM INTEGER,
ORIGIN_AIRPORT_ID INTEGER,
ORIGIN_AIRPORT_SEQ_ID INTEGER,
ORIGIN_CITY_MARKET_ID INTEGER,
ORIGIN TEXT,
DEST_AIRPORT_ID INTEGER,
DEST_AIRPORT_SEQ_ID INTEGER,
DEST_CITY_MARKET_ID INTEGER,
DEST TEXT,
CRS_DEP_TIME INTEGER,
DEP_TIME INTEGER,
DEP_DELAY INTEGER,
DEP_DELAY_NEW INTEGER,
ARR_TIME INTEGER,
ARR_DELAY INTEGER,
ARR_DELAY_NEW INTEGER,
CANCELLED INTEGER,
CANCELLATION_CODE TEXT,
CRS_ELAPSED_TIME INTEGER,
ACTUAL_ELAPSED_TIME INTEGER,
CARRIER_DELAY INTEGER,
WEATHER_DELAY INTEGER,
NAS_DELAY INTEGER,
SECURITY_DELAY INTEGER,
LATE_AIRCRAFT_DELAY INTEGER,
FOREIGN KEY (ORIGIN) REFERENCES Airports(Code),
FOREIGN KEY (DEST) REFERENCES Airports(Code),
FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code)
)
/*
1 example row:
SELECT * FROM airlines LIMIT 1;
FL_DATE ||OP_CARRIER_AIRLINE_ID ||TAIL_NUM ||OP_CARRIER_FL_NUM ||ORIGIN_AIRPORT_ID ||ORIGIN_AIRPORT_SEQ_ID ||ORIGIN_CITY_MARKET_ID ||ORIGIN ||DEST_AIRPORT_ID ||DEST_AIRPORT_SEQ_ID ||DEST_CITY_MARKET_ID ||DEST ||CRS_DEP_TIME ||DEP_TIME ||DEP_DELAY ||DEP_DELAY_NEW ||ARR_TIME ||ARR_DELAY ||ARR_DELAY_NEW ||CANCELLED ||CANCELLATION_CODE ||CRS_ELAPSED_TIME ||ACTUAL_ELAPSED_TIME ||CARRIER_DELAY ||WEATHER_DELAY ||NAS_DELAY ||SECURITY_DELAY ||LATE_AIRCRAFT_DELAY
2018/8/1 || 19805 || N956AN || 1587 || 12478 || 1247805 || 31703 || JFK || 14107 || 1410702 || 30466 || PHX || 1640 || 1649 || 9 || 9 || 2006 || 44 || 44 || 0 || None || 342 || 377 || 9 || 0 || 35 || 0 || 0
*/
/* column definitions {
"FL_DATE": "flight date",
"OP_CARRIER_AIRLINE_ID": "operator carrier airline id",
"TAIL_NUM": "plane's tail number",
"OP_CARRIER_FL_NUM": "operator carrier flight number",
"ORIGIN_AIRPORT_ID": "origin airport id",
"ORIGIN_AIRPORT_SEQ_ID": "origin airport sequence id",
"ORIGIN_CITY_MARKET_ID": "origin city market id",
"ORIGIN": "airport of origin",
"DEST_AIRPORT_ID": "ID of the destination airport",
"DEST_AIRPORT_SEQ_ID": "",
"DEST_CITY_MARKET_ID": "",
"DEST": "Destination airport",
"CRS_DEP_TIME": "",
"DEP_TIME": "Flight departure time",
"DEP_DELAY": "Departure delay indicator",
"DEP_DELAY_NEW": "departure delay new",
"ARR_TIME": "Flight arrival time.",
"ARR_DELAY": "arrival delay time",
"ARR_DELAY_NEW": "arrival delay new",
"CANCELLED": "Flight cancellation indicator.",
"CANCELLATION_CODE": "cancellation code",
"CRS_ELAPSED_TIME": "scheduled elapsed time",
"ACTUAL_ELAPSED_TIME": "actual elapsed time",
"CARRIER_DELAY": "carrier delay",
"WEATHER_DELAY": "delay caused by the wheather problem",
"NAS_DELAY": "delay, in minutes, attributable to the National Aviation System",
"SECURITY_DELAY": "delay attribute to security",
"LATE_AIRCRAFT_DELAY": "delay attribute to late aircraft"
}*/
|
5,900 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE "Air Carriers"
(
Code INTEGER
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM `air carriers` LIMIT 1;
Code || Description
19031 ||Mackey International Inc.: MAC
*/
/* column definitions {
"Code": "the code of the air carriers",
"Description": "the description of air carriers"
}*/
CREATE TABLE Airports
(
Code TEXT
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM airports LIMIT 1;
Code || Description
01A ||Afognak Lake, AK: Afognak Lake Airport
*/
/* column definitions {
"Code": "IATA code of the air airports",
"Description": "the description of airports"
}*/
CREATE TABLE Airlines
(
FL_DATE TEXT,
OP_CARRIER_AIRLINE_ID INTEGER,
TAIL_NUM TEXT,
OP_CARRIER_FL_NUM INTEGER,
ORIGIN_AIRPORT_ID INTEGER,
ORIGIN_AIRPORT_SEQ_ID INTEGER,
ORIGIN_CITY_MARKET_ID INTEGER,
ORIGIN TEXT,
DEST_AIRPORT_ID INTEGER,
DEST_AIRPORT_SEQ_ID INTEGER,
DEST_CITY_MARKET_ID INTEGER,
DEST TEXT,
CRS_DEP_TIME INTEGER,
DEP_TIME INTEGER,
DEP_DELAY INTEGER,
DEP_DELAY_NEW INTEGER,
ARR_TIME INTEGER,
ARR_DELAY INTEGER,
ARR_DELAY_NEW INTEGER,
CANCELLED INTEGER,
CANCELLATION_CODE TEXT,
CRS_ELAPSED_TIME INTEGER,
ACTUAL_ELAPSED_TIME INTEGER,
CARRIER_DELAY INTEGER,
WEATHER_DELAY INTEGER,
NAS_DELAY INTEGER,
SECURITY_DELAY INTEGER,
LATE_AIRCRAFT_DELAY INTEGER,
FOREIGN KEY (ORIGIN) REFERENCES Airports(Code),
FOREIGN KEY (DEST) REFERENCES Airports(Code),
FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code)
)
/*
1 example row:
SELECT * FROM airlines LIMIT 1;
FL_DATE ||OP_CARRIER_AIRLINE_ID ||TAIL_NUM ||OP_CARRIER_FL_NUM ||ORIGIN_AIRPORT_ID ||ORIGIN_AIRPORT_SEQ_ID ||ORIGIN_CITY_MARKET_ID ||ORIGIN ||DEST_AIRPORT_ID ||DEST_AIRPORT_SEQ_ID ||DEST_CITY_MARKET_ID ||DEST ||CRS_DEP_TIME ||DEP_TIME ||DEP_DELAY ||DEP_DELAY_NEW ||ARR_TIME ||ARR_DELAY ||ARR_DELAY_NEW ||CANCELLED ||CANCELLATION_CODE ||CRS_ELAPSED_TIME ||ACTUAL_ELAPSED_TIME ||CARRIER_DELAY ||WEATHER_DELAY ||NAS_DELAY ||SECURITY_DELAY ||LATE_AIRCRAFT_DELAY
2018/8/1 || 19805 || N956AN || 1587 || 12478 || 1247805 || 31703 || JFK || 14107 || 1410702 || 30466 || PHX || 1640 || 1649 || 9 || 9 || 2006 || 44 || 44 || 0 || None || 342 || 377 || 9 || 0 || 35 || 0 || 0
*/
/* column definitions {
"FL_DATE": "flight date",
"OP_CARRIER_AIRLINE_ID": "operator carrier airline id",
"TAIL_NUM": "plane's tail number",
"OP_CARRIER_FL_NUM": "operator carrier flight number",
"ORIGIN_AIRPORT_ID": "origin airport id",
"ORIGIN_AIRPORT_SEQ_ID": "origin airport sequence id",
"ORIGIN_CITY_MARKET_ID": "origin city market id",
"ORIGIN": "airport of origin",
"DEST_AIRPORT_ID": "ID of the destination airport",
"DEST_AIRPORT_SEQ_ID": "",
"DEST_CITY_MARKET_ID": "",
"DEST": "Destination airport",
"CRS_DEP_TIME": "",
"DEP_TIME": "Flight departure time",
"DEP_DELAY": "Departure delay indicator",
"DEP_DELAY_NEW": "departure delay new",
"ARR_TIME": "Flight arrival time.",
"ARR_DELAY": "arrival delay time",
"ARR_DELAY_NEW": "arrival delay new",
"CANCELLED": "Flight cancellation indicator.",
"CANCELLATION_CODE": "cancellation code",
"CRS_ELAPSED_TIME": "scheduled elapsed time",
"ACTUAL_ELAPSED_TIME": "actual elapsed time",
"CARRIER_DELAY": "carrier delay",
"WEATHER_DELAY": "delay caused by the wheather problem",
"NAS_DELAY": "delay, in minutes, attributable to the National Aviation System",
"SECURITY_DELAY": "delay attribute to security",
"LATE_AIRCRAFT_DELAY": "delay attribute to late aircraft"
}*/
### Question
What are the destinations of the flights with air carrier description "Southeast Alaska Airlines: WEB"?
Clarification: destinations refers to DEST; Southeast Alaska Airlines: WEB refers to Description = 'Southeast Alaska Airlines: WEB';
| [query_database(**{'query': 'SELECT T2.DEST FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T1.Description = 'Southeast Alaska Airlines: WEB''})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE "Air Carriers"
(
Code INTEGER
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM `air carriers` LIMIT 1;
Code || Description
19031 ||Mackey International Inc.: MAC
*/
/* column definitions {
"Code": "the code of the air carriers",
"Description": "the description of air carriers"
}*/
CREATE TABLE Airports
(
Code TEXT
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM airports LIMIT 1;
Code || Description
01A ||Afognak Lake, AK: Afognak Lake Airport
*/
/* column definitions {
"Code": "IATA code of the air airports",
"Description": "the description of airports"
}*/
CREATE TABLE Airlines
(
FL_DATE TEXT,
OP_CARRIER_AIRLINE_ID INTEGER,
TAIL_NUM TEXT,
OP_CARRIER_FL_NUM INTEGER,
ORIGIN_AIRPORT_ID INTEGER,
ORIGIN_AIRPORT_SEQ_ID INTEGER,
ORIGIN_CITY_MARKET_ID INTEGER,
ORIGIN TEXT,
DEST_AIRPORT_ID INTEGER,
DEST_AIRPORT_SEQ_ID INTEGER,
DEST_CITY_MARKET_ID INTEGER,
DEST TEXT,
CRS_DEP_TIME INTEGER,
DEP_TIME INTEGER,
DEP_DELAY INTEGER,
DEP_DELAY_NEW INTEGER,
ARR_TIME INTEGER,
ARR_DELAY INTEGER,
ARR_DELAY_NEW INTEGER,
CANCELLED INTEGER,
CANCELLATION_CODE TEXT,
CRS_ELAPSED_TIME INTEGER,
ACTUAL_ELAPSED_TIME INTEGER,
CARRIER_DELAY INTEGER,
WEATHER_DELAY INTEGER,
NAS_DELAY INTEGER,
SECURITY_DELAY INTEGER,
LATE_AIRCRAFT_DELAY INTEGER,
FOREIGN KEY (ORIGIN) REFERENCES Airports(Code),
FOREIGN KEY (DEST) REFERENCES Airports(Code),
FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code)
)
/*
1 example row:
SELECT * FROM airlines LIMIT 1;
FL_DATE ||OP_CARRIER_AIRLINE_ID ||TAIL_NUM ||OP_CARRIER_FL_NUM ||ORIGIN_AIRPORT_ID ||ORIGIN_AIRPORT_SEQ_ID ||ORIGIN_CITY_MARKET_ID ||ORIGIN ||DEST_AIRPORT_ID ||DEST_AIRPORT_SEQ_ID ||DEST_CITY_MARKET_ID ||DEST ||CRS_DEP_TIME ||DEP_TIME ||DEP_DELAY ||DEP_DELAY_NEW ||ARR_TIME ||ARR_DELAY ||ARR_DELAY_NEW ||CANCELLED ||CANCELLATION_CODE ||CRS_ELAPSED_TIME ||ACTUAL_ELAPSED_TIME ||CARRIER_DELAY ||WEATHER_DELAY ||NAS_DELAY ||SECURITY_DELAY ||LATE_AIRCRAFT_DELAY
2018/8/1 || 19805 || N956AN || 1587 || 12478 || 1247805 || 31703 || JFK || 14107 || 1410702 || 30466 || PHX || 1640 || 1649 || 9 || 9 || 2006 || 44 || 44 || 0 || None || 342 || 377 || 9 || 0 || 35 || 0 || 0
*/
/* column definitions {
"FL_DATE": "flight date",
"OP_CARRIER_AIRLINE_ID": "operator carrier airline id",
"TAIL_NUM": "plane's tail number",
"OP_CARRIER_FL_NUM": "operator carrier flight number",
"ORIGIN_AIRPORT_ID": "origin airport id",
"ORIGIN_AIRPORT_SEQ_ID": "origin airport sequence id",
"ORIGIN_CITY_MARKET_ID": "origin city market id",
"ORIGIN": "airport of origin",
"DEST_AIRPORT_ID": "ID of the destination airport",
"DEST_AIRPORT_SEQ_ID": "",
"DEST_CITY_MARKET_ID": "",
"DEST": "Destination airport",
"CRS_DEP_TIME": "",
"DEP_TIME": "Flight departure time",
"DEP_DELAY": "Departure delay indicator",
"DEP_DELAY_NEW": "departure delay new",
"ARR_TIME": "Flight arrival time.",
"ARR_DELAY": "arrival delay time",
"ARR_DELAY_NEW": "arrival delay new",
"CANCELLED": "Flight cancellation indicator.",
"CANCELLATION_CODE": "cancellation code",
"CRS_ELAPSED_TIME": "scheduled elapsed time",
"ACTUAL_ELAPSED_TIME": "actual elapsed time",
"CARRIER_DELAY": "carrier delay",
"WEATHER_DELAY": "delay caused by the wheather problem",
"NAS_DELAY": "delay, in minutes, attributable to the National Aviation System",
"SECURITY_DELAY": "delay attribute to security",
"LATE_AIRCRAFT_DELAY": "delay attribute to late aircraft"
}*/
|
5,904 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE "Air Carriers"
(
Code INTEGER
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM `air carriers` LIMIT 1;
Code || Description
19031 ||Mackey International Inc.: MAC
*/
/* column definitions {
"Code": "the code of the air carriers",
"Description": "the description of air carriers"
}*/
CREATE TABLE Airports
(
Code TEXT
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM airports LIMIT 1;
Code || Description
01A ||Afognak Lake, AK: Afognak Lake Airport
*/
/* column definitions {
"Code": "IATA code of the air airports",
"Description": "the description of airports"
}*/
CREATE TABLE Airlines
(
FL_DATE TEXT,
OP_CARRIER_AIRLINE_ID INTEGER,
TAIL_NUM TEXT,
OP_CARRIER_FL_NUM INTEGER,
ORIGIN_AIRPORT_ID INTEGER,
ORIGIN_AIRPORT_SEQ_ID INTEGER,
ORIGIN_CITY_MARKET_ID INTEGER,
ORIGIN TEXT,
DEST_AIRPORT_ID INTEGER,
DEST_AIRPORT_SEQ_ID INTEGER,
DEST_CITY_MARKET_ID INTEGER,
DEST TEXT,
CRS_DEP_TIME INTEGER,
DEP_TIME INTEGER,
DEP_DELAY INTEGER,
DEP_DELAY_NEW INTEGER,
ARR_TIME INTEGER,
ARR_DELAY INTEGER,
ARR_DELAY_NEW INTEGER,
CANCELLED INTEGER,
CANCELLATION_CODE TEXT,
CRS_ELAPSED_TIME INTEGER,
ACTUAL_ELAPSED_TIME INTEGER,
CARRIER_DELAY INTEGER,
WEATHER_DELAY INTEGER,
NAS_DELAY INTEGER,
SECURITY_DELAY INTEGER,
LATE_AIRCRAFT_DELAY INTEGER,
FOREIGN KEY (ORIGIN) REFERENCES Airports(Code),
FOREIGN KEY (DEST) REFERENCES Airports(Code),
FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code)
)
/*
1 example row:
SELECT * FROM airlines LIMIT 1;
FL_DATE ||OP_CARRIER_AIRLINE_ID ||TAIL_NUM ||OP_CARRIER_FL_NUM ||ORIGIN_AIRPORT_ID ||ORIGIN_AIRPORT_SEQ_ID ||ORIGIN_CITY_MARKET_ID ||ORIGIN ||DEST_AIRPORT_ID ||DEST_AIRPORT_SEQ_ID ||DEST_CITY_MARKET_ID ||DEST ||CRS_DEP_TIME ||DEP_TIME ||DEP_DELAY ||DEP_DELAY_NEW ||ARR_TIME ||ARR_DELAY ||ARR_DELAY_NEW ||CANCELLED ||CANCELLATION_CODE ||CRS_ELAPSED_TIME ||ACTUAL_ELAPSED_TIME ||CARRIER_DELAY ||WEATHER_DELAY ||NAS_DELAY ||SECURITY_DELAY ||LATE_AIRCRAFT_DELAY
2018/8/1 || 19805 || N956AN || 1587 || 12478 || 1247805 || 31703 || JFK || 14107 || 1410702 || 30466 || PHX || 1640 || 1649 || 9 || 9 || 2006 || 44 || 44 || 0 || None || 342 || 377 || 9 || 0 || 35 || 0 || 0
*/
/* column definitions {
"FL_DATE": "flight date",
"OP_CARRIER_AIRLINE_ID": "operator carrier airline id",
"TAIL_NUM": "plane's tail number",
"OP_CARRIER_FL_NUM": "operator carrier flight number",
"ORIGIN_AIRPORT_ID": "origin airport id",
"ORIGIN_AIRPORT_SEQ_ID": "origin airport sequence id",
"ORIGIN_CITY_MARKET_ID": "origin city market id",
"ORIGIN": "airport of origin",
"DEST_AIRPORT_ID": "ID of the destination airport",
"DEST_AIRPORT_SEQ_ID": "",
"DEST_CITY_MARKET_ID": "",
"DEST": "Destination airport",
"CRS_DEP_TIME": "",
"DEP_TIME": "Flight departure time",
"DEP_DELAY": "Departure delay indicator",
"DEP_DELAY_NEW": "departure delay new",
"ARR_TIME": "Flight arrival time.",
"ARR_DELAY": "arrival delay time",
"ARR_DELAY_NEW": "arrival delay new",
"CANCELLED": "Flight cancellation indicator.",
"CANCELLATION_CODE": "cancellation code",
"CRS_ELAPSED_TIME": "scheduled elapsed time",
"ACTUAL_ELAPSED_TIME": "actual elapsed time",
"CARRIER_DELAY": "carrier delay",
"WEATHER_DELAY": "delay caused by the wheather problem",
"NAS_DELAY": "delay, in minutes, attributable to the National Aviation System",
"SECURITY_DELAY": "delay attribute to security",
"LATE_AIRCRAFT_DELAY": "delay attribute to late aircraft"
}*/
### Question
List the flight date of flights with air carrier described as Profit Airlines Inc.: XBH which have an actual elapsed time below 100.
Clarification: flight date refers to FL_DATE; Profit Airlines Inc.: XBH refers to Description = 'Profit Airlines Inc.: XBH'; actual elapsed time below 100 refers to ACTUAL_ELAPSED_TIME < 100;
| [query_database(**{'query': 'SELECT T2.FL_DATE FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T2.ACTUAL_ELAPSED_TIME < 100 AND T1.Description = 'Profit Airlines Inc.: XBH''})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE "Air Carriers"
(
Code INTEGER
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM `air carriers` LIMIT 1;
Code || Description
19031 ||Mackey International Inc.: MAC
*/
/* column definitions {
"Code": "the code of the air carriers",
"Description": "the description of air carriers"
}*/
CREATE TABLE Airports
(
Code TEXT
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM airports LIMIT 1;
Code || Description
01A ||Afognak Lake, AK: Afognak Lake Airport
*/
/* column definitions {
"Code": "IATA code of the air airports",
"Description": "the description of airports"
}*/
CREATE TABLE Airlines
(
FL_DATE TEXT,
OP_CARRIER_AIRLINE_ID INTEGER,
TAIL_NUM TEXT,
OP_CARRIER_FL_NUM INTEGER,
ORIGIN_AIRPORT_ID INTEGER,
ORIGIN_AIRPORT_SEQ_ID INTEGER,
ORIGIN_CITY_MARKET_ID INTEGER,
ORIGIN TEXT,
DEST_AIRPORT_ID INTEGER,
DEST_AIRPORT_SEQ_ID INTEGER,
DEST_CITY_MARKET_ID INTEGER,
DEST TEXT,
CRS_DEP_TIME INTEGER,
DEP_TIME INTEGER,
DEP_DELAY INTEGER,
DEP_DELAY_NEW INTEGER,
ARR_TIME INTEGER,
ARR_DELAY INTEGER,
ARR_DELAY_NEW INTEGER,
CANCELLED INTEGER,
CANCELLATION_CODE TEXT,
CRS_ELAPSED_TIME INTEGER,
ACTUAL_ELAPSED_TIME INTEGER,
CARRIER_DELAY INTEGER,
WEATHER_DELAY INTEGER,
NAS_DELAY INTEGER,
SECURITY_DELAY INTEGER,
LATE_AIRCRAFT_DELAY INTEGER,
FOREIGN KEY (ORIGIN) REFERENCES Airports(Code),
FOREIGN KEY (DEST) REFERENCES Airports(Code),
FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code)
)
/*
1 example row:
SELECT * FROM airlines LIMIT 1;
FL_DATE ||OP_CARRIER_AIRLINE_ID ||TAIL_NUM ||OP_CARRIER_FL_NUM ||ORIGIN_AIRPORT_ID ||ORIGIN_AIRPORT_SEQ_ID ||ORIGIN_CITY_MARKET_ID ||ORIGIN ||DEST_AIRPORT_ID ||DEST_AIRPORT_SEQ_ID ||DEST_CITY_MARKET_ID ||DEST ||CRS_DEP_TIME ||DEP_TIME ||DEP_DELAY ||DEP_DELAY_NEW ||ARR_TIME ||ARR_DELAY ||ARR_DELAY_NEW ||CANCELLED ||CANCELLATION_CODE ||CRS_ELAPSED_TIME ||ACTUAL_ELAPSED_TIME ||CARRIER_DELAY ||WEATHER_DELAY ||NAS_DELAY ||SECURITY_DELAY ||LATE_AIRCRAFT_DELAY
2018/8/1 || 19805 || N956AN || 1587 || 12478 || 1247805 || 31703 || JFK || 14107 || 1410702 || 30466 || PHX || 1640 || 1649 || 9 || 9 || 2006 || 44 || 44 || 0 || None || 342 || 377 || 9 || 0 || 35 || 0 || 0
*/
/* column definitions {
"FL_DATE": "flight date",
"OP_CARRIER_AIRLINE_ID": "operator carrier airline id",
"TAIL_NUM": "plane's tail number",
"OP_CARRIER_FL_NUM": "operator carrier flight number",
"ORIGIN_AIRPORT_ID": "origin airport id",
"ORIGIN_AIRPORT_SEQ_ID": "origin airport sequence id",
"ORIGIN_CITY_MARKET_ID": "origin city market id",
"ORIGIN": "airport of origin",
"DEST_AIRPORT_ID": "ID of the destination airport",
"DEST_AIRPORT_SEQ_ID": "",
"DEST_CITY_MARKET_ID": "",
"DEST": "Destination airport",
"CRS_DEP_TIME": "",
"DEP_TIME": "Flight departure time",
"DEP_DELAY": "Departure delay indicator",
"DEP_DELAY_NEW": "departure delay new",
"ARR_TIME": "Flight arrival time.",
"ARR_DELAY": "arrival delay time",
"ARR_DELAY_NEW": "arrival delay new",
"CANCELLED": "Flight cancellation indicator.",
"CANCELLATION_CODE": "cancellation code",
"CRS_ELAPSED_TIME": "scheduled elapsed time",
"ACTUAL_ELAPSED_TIME": "actual elapsed time",
"CARRIER_DELAY": "carrier delay",
"WEATHER_DELAY": "delay caused by the wheather problem",
"NAS_DELAY": "delay, in minutes, attributable to the National Aviation System",
"SECURITY_DELAY": "delay attribute to security",
"LATE_AIRCRAFT_DELAY": "delay attribute to late aircraft"
}*/
|
5,908 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE "Air Carriers"
(
Code INTEGER
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM `air carriers` LIMIT 1;
Code || Description
19031 ||Mackey International Inc.: MAC
*/
/* column definitions {
"Code": "the code of the air carriers",
"Description": "the description of air carriers"
}*/
CREATE TABLE Airports
(
Code TEXT
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM airports LIMIT 1;
Code || Description
01A ||Afognak Lake, AK: Afognak Lake Airport
*/
/* column definitions {
"Code": "IATA code of the air airports",
"Description": "the description of airports"
}*/
CREATE TABLE Airlines
(
FL_DATE TEXT,
OP_CARRIER_AIRLINE_ID INTEGER,
TAIL_NUM TEXT,
OP_CARRIER_FL_NUM INTEGER,
ORIGIN_AIRPORT_ID INTEGER,
ORIGIN_AIRPORT_SEQ_ID INTEGER,
ORIGIN_CITY_MARKET_ID INTEGER,
ORIGIN TEXT,
DEST_AIRPORT_ID INTEGER,
DEST_AIRPORT_SEQ_ID INTEGER,
DEST_CITY_MARKET_ID INTEGER,
DEST TEXT,
CRS_DEP_TIME INTEGER,
DEP_TIME INTEGER,
DEP_DELAY INTEGER,
DEP_DELAY_NEW INTEGER,
ARR_TIME INTEGER,
ARR_DELAY INTEGER,
ARR_DELAY_NEW INTEGER,
CANCELLED INTEGER,
CANCELLATION_CODE TEXT,
CRS_ELAPSED_TIME INTEGER,
ACTUAL_ELAPSED_TIME INTEGER,
CARRIER_DELAY INTEGER,
WEATHER_DELAY INTEGER,
NAS_DELAY INTEGER,
SECURITY_DELAY INTEGER,
LATE_AIRCRAFT_DELAY INTEGER,
FOREIGN KEY (ORIGIN) REFERENCES Airports(Code),
FOREIGN KEY (DEST) REFERENCES Airports(Code),
FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code)
)
/*
1 example row:
SELECT * FROM airlines LIMIT 1;
FL_DATE ||OP_CARRIER_AIRLINE_ID ||TAIL_NUM ||OP_CARRIER_FL_NUM ||ORIGIN_AIRPORT_ID ||ORIGIN_AIRPORT_SEQ_ID ||ORIGIN_CITY_MARKET_ID ||ORIGIN ||DEST_AIRPORT_ID ||DEST_AIRPORT_SEQ_ID ||DEST_CITY_MARKET_ID ||DEST ||CRS_DEP_TIME ||DEP_TIME ||DEP_DELAY ||DEP_DELAY_NEW ||ARR_TIME ||ARR_DELAY ||ARR_DELAY_NEW ||CANCELLED ||CANCELLATION_CODE ||CRS_ELAPSED_TIME ||ACTUAL_ELAPSED_TIME ||CARRIER_DELAY ||WEATHER_DELAY ||NAS_DELAY ||SECURITY_DELAY ||LATE_AIRCRAFT_DELAY
2018/8/1 || 19805 || N956AN || 1587 || 12478 || 1247805 || 31703 || JFK || 14107 || 1410702 || 30466 || PHX || 1640 || 1649 || 9 || 9 || 2006 || 44 || 44 || 0 || None || 342 || 377 || 9 || 0 || 35 || 0 || 0
*/
/* column definitions {
"FL_DATE": "flight date",
"OP_CARRIER_AIRLINE_ID": "operator carrier airline id",
"TAIL_NUM": "plane's tail number",
"OP_CARRIER_FL_NUM": "operator carrier flight number",
"ORIGIN_AIRPORT_ID": "origin airport id",
"ORIGIN_AIRPORT_SEQ_ID": "origin airport sequence id",
"ORIGIN_CITY_MARKET_ID": "origin city market id",
"ORIGIN": "airport of origin",
"DEST_AIRPORT_ID": "ID of the destination airport",
"DEST_AIRPORT_SEQ_ID": "",
"DEST_CITY_MARKET_ID": "",
"DEST": "Destination airport",
"CRS_DEP_TIME": "",
"DEP_TIME": "Flight departure time",
"DEP_DELAY": "Departure delay indicator",
"DEP_DELAY_NEW": "departure delay new",
"ARR_TIME": "Flight arrival time.",
"ARR_DELAY": "arrival delay time",
"ARR_DELAY_NEW": "arrival delay new",
"CANCELLED": "Flight cancellation indicator.",
"CANCELLATION_CODE": "cancellation code",
"CRS_ELAPSED_TIME": "scheduled elapsed time",
"ACTUAL_ELAPSED_TIME": "actual elapsed time",
"CARRIER_DELAY": "carrier delay",
"WEATHER_DELAY": "delay caused by the wheather problem",
"NAS_DELAY": "delay, in minutes, attributable to the National Aviation System",
"SECURITY_DELAY": "delay attribute to security",
"LATE_AIRCRAFT_DELAY": "delay attribute to late aircraft"
}*/
### Question
Give the air carrier description of the flights that have an earlier arrival and departure.
Clarification: earlier arrival and departure refers to ARR_DELAY < 0 AND DEP_DELAY < 0;
| [query_database(**{'query': 'SELECT T1.Description FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T2.ARR_DELAY < 0 AND T2.DEP_DELAY < 0 GROUP BY T1.Description'})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE "Air Carriers"
(
Code INTEGER
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM `air carriers` LIMIT 1;
Code || Description
19031 ||Mackey International Inc.: MAC
*/
/* column definitions {
"Code": "the code of the air carriers",
"Description": "the description of air carriers"
}*/
CREATE TABLE Airports
(
Code TEXT
primary key,
Description TEXT
)
/*
1 example row:
SELECT * FROM airports LIMIT 1;
Code || Description
01A ||Afognak Lake, AK: Afognak Lake Airport
*/
/* column definitions {
"Code": "IATA code of the air airports",
"Description": "the description of airports"
}*/
CREATE TABLE Airlines
(
FL_DATE TEXT,
OP_CARRIER_AIRLINE_ID INTEGER,
TAIL_NUM TEXT,
OP_CARRIER_FL_NUM INTEGER,
ORIGIN_AIRPORT_ID INTEGER,
ORIGIN_AIRPORT_SEQ_ID INTEGER,
ORIGIN_CITY_MARKET_ID INTEGER,
ORIGIN TEXT,
DEST_AIRPORT_ID INTEGER,
DEST_AIRPORT_SEQ_ID INTEGER,
DEST_CITY_MARKET_ID INTEGER,
DEST TEXT,
CRS_DEP_TIME INTEGER,
DEP_TIME INTEGER,
DEP_DELAY INTEGER,
DEP_DELAY_NEW INTEGER,
ARR_TIME INTEGER,
ARR_DELAY INTEGER,
ARR_DELAY_NEW INTEGER,
CANCELLED INTEGER,
CANCELLATION_CODE TEXT,
CRS_ELAPSED_TIME INTEGER,
ACTUAL_ELAPSED_TIME INTEGER,
CARRIER_DELAY INTEGER,
WEATHER_DELAY INTEGER,
NAS_DELAY INTEGER,
SECURITY_DELAY INTEGER,
LATE_AIRCRAFT_DELAY INTEGER,
FOREIGN KEY (ORIGIN) REFERENCES Airports(Code),
FOREIGN KEY (DEST) REFERENCES Airports(Code),
FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code)
)
/*
1 example row:
SELECT * FROM airlines LIMIT 1;
FL_DATE ||OP_CARRIER_AIRLINE_ID ||TAIL_NUM ||OP_CARRIER_FL_NUM ||ORIGIN_AIRPORT_ID ||ORIGIN_AIRPORT_SEQ_ID ||ORIGIN_CITY_MARKET_ID ||ORIGIN ||DEST_AIRPORT_ID ||DEST_AIRPORT_SEQ_ID ||DEST_CITY_MARKET_ID ||DEST ||CRS_DEP_TIME ||DEP_TIME ||DEP_DELAY ||DEP_DELAY_NEW ||ARR_TIME ||ARR_DELAY ||ARR_DELAY_NEW ||CANCELLED ||CANCELLATION_CODE ||CRS_ELAPSED_TIME ||ACTUAL_ELAPSED_TIME ||CARRIER_DELAY ||WEATHER_DELAY ||NAS_DELAY ||SECURITY_DELAY ||LATE_AIRCRAFT_DELAY
2018/8/1 || 19805 || N956AN || 1587 || 12478 || 1247805 || 31703 || JFK || 14107 || 1410702 || 30466 || PHX || 1640 || 1649 || 9 || 9 || 2006 || 44 || 44 || 0 || None || 342 || 377 || 9 || 0 || 35 || 0 || 0
*/
/* column definitions {
"FL_DATE": "flight date",
"OP_CARRIER_AIRLINE_ID": "operator carrier airline id",
"TAIL_NUM": "plane's tail number",
"OP_CARRIER_FL_NUM": "operator carrier flight number",
"ORIGIN_AIRPORT_ID": "origin airport id",
"ORIGIN_AIRPORT_SEQ_ID": "origin airport sequence id",
"ORIGIN_CITY_MARKET_ID": "origin city market id",
"ORIGIN": "airport of origin",
"DEST_AIRPORT_ID": "ID of the destination airport",
"DEST_AIRPORT_SEQ_ID": "",
"DEST_CITY_MARKET_ID": "",
"DEST": "Destination airport",
"CRS_DEP_TIME": "",
"DEP_TIME": "Flight departure time",
"DEP_DELAY": "Departure delay indicator",
"DEP_DELAY_NEW": "departure delay new",
"ARR_TIME": "Flight arrival time.",
"ARR_DELAY": "arrival delay time",
"ARR_DELAY_NEW": "arrival delay new",
"CANCELLED": "Flight cancellation indicator.",
"CANCELLATION_CODE": "cancellation code",
"CRS_ELAPSED_TIME": "scheduled elapsed time",
"ACTUAL_ELAPSED_TIME": "actual elapsed time",
"CARRIER_DELAY": "carrier delay",
"WEATHER_DELAY": "delay caused by the wheather problem",
"NAS_DELAY": "delay, in minutes, attributable to the National Aviation System",
"SECURITY_DELAY": "delay attribute to security",
"LATE_AIRCRAFT_DELAY": "delay attribute to late aircraft"
}*/
|
5,912 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE address_status
(
status_id INTEGER
primary key,
address_status TEXT
)
/*
1 example row:
SELECT * FROM address_status LIMIT 1;
status_id ||address_status
1 || Active
*/
/* column definitions {
"status_id": "the unique identifier of the status",
"address_status": "the status of the address"
}*/
CREATE TABLE author
(
author_id INTEGER
primary key,
author_name TEXT
)
/*
1 example row:
SELECT * FROM author LIMIT 1;
author_id || author_name
1 ||A. Bartlett Giamatti
*/
/* column definitions {
"author_id": "the unique identifier of the author",
"author_name": "the name of the author"
}*/
CREATE TABLE book_language
(
language_id INTEGER
primary key,
language_code TEXT,
language_name TEXT
)
/*
1 example row:
SELECT * FROM book_language LIMIT 1;
language_id ||language_code ||language_name
1 || eng || English
*/
/* column definitions {
"language_id": "the unique identifier of the language ",
"language_code": "the language code",
"language_name": "the language name"
}*/
CREATE TABLE country
(
country_id INTEGER
primary key,
country_name TEXT
)
/*
1 example row:
SELECT * FROM country LIMIT 1;
country_id ||country_name
1 || Afghanistan
*/
/* column definitions {
"country_id": "the unique identifier of the country",
"country_name": "the country name"
}*/
CREATE TABLE address
(
address_id INTEGER
primary key,
street_number TEXT,
street_name TEXT,
city TEXT,
country_id INTEGER,
foreign key (country_id) references country(country_id)
)
/*
1 example row:
SELECT * FROM address LIMIT 1;
address_id ||street_number || street_name || city ||country_id
1 || 57 ||Glacier Hill Avenue ||Torbat-e Jām || 95
*/
/* column definitions {
"address_id": "the unique identifier of the address",
"street_number": "the street number of the address",
"street_name": "the street name",
"city": "the city where the address belongs",
"country_id": "the id of the country where the address belongs "
}*/
CREATE TABLE customer
(
customer_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
email TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
customer_id ||first_name ||last_name || email
1 || Ursola || Purdy ||upurdy0@cdbaby.com
*/
/* column definitions {
"customer_id": "the unique identifier of the customer",
"first_name": "the first name of the customer",
"last_name": "the last name of the customer",
"email": "the email of the customer"
}*/
CREATE TABLE customer_address
(
customer_id INTEGER,
address_id INTEGER,
status_id INTEGER,
primary key (customer_id, address_id),
foreign key (address_id) references address(address_id),
foreign key (customer_id) references customer(customer_id)
)
/*
1 example row:
SELECT * FROM customer_address LIMIT 1;
customer_id ||address_id ||status_id
1 || 606 || 1
*/
/* column definitions {
"customer_id": "the id of the customer\nMaps to customer(customer_id)",
"address_id": "the id of the address\nMaps to address(address_id)",
"status_id": "the id of the address status"
}*/
CREATE TABLE order_status
(
status_id INTEGER
primary key,
status_value TEXT
)
/*
1 example row:
SELECT * FROM order_status LIMIT 1;
status_id || status_value
1 ||Order Received
*/
/* column definitions {
"status_id": "the unique identifier of the order status",
"status_value": "the status value"
}*/
CREATE TABLE publisher
(
publisher_id INTEGER
primary key,
publisher_name TEXT
)
/*
1 example row:
SELECT * FROM publisher LIMIT 1;
publisher_id ||publisher_name
1 || 10/18
*/
/* column definitions {
"publisher_id": "the unique identifier of the publisher",
"publisher_name": "the name of the publisher"
}*/
CREATE TABLE book
(
book_id INTEGER
primary key,
title TEXT,
isbn13 TEXT,
language_id INTEGER,
num_pages INTEGER,
publication_date DATE,
publisher_id INTEGER,
foreign key (language_id) references book_language(language_id),
foreign key (publisher_id) references publisher(publisher_id)
)
/*
1 example row:
SELECT * FROM book LIMIT 1;
book_id || title || isbn13 ||language_id ||num_pages ||publication_date ||publisher_id
1 ||The World's First Love: Mary Mother of God ||8987059752 || 2 || 276 || 1996-09-01 || 1010
*/
/* column definitions {
"book_id": "the unique identifier of the book",
"title": "the title of the book ",
"isbn13": "the International Standard Book Number of the book",
"language_id": "the id of the book language\nMaps to book_language (language_id)",
"num_pages": "the number of the pages",
"publication_date": "the publication date of the book",
"publisher_id": "the id of the publisher\nMaps to publisher (publisher_id)"
}*/
CREATE TABLE book_author
(
book_id INTEGER,
author_id INTEGER,
primary key (book_id, author_id),
foreign key (author_id) references author(author_id),
foreign key (book_id) references book(book_id)
)
/*
1 example row:
SELECT * FROM book_author LIMIT 1;
book_id ||author_id
10539 || 1
*/
/* column definitions {
"book_id": "the id of the book\nMaps to book(book_id)",
"author_id": "the id of the author\nMaps to author(author_id)"
}*/
CREATE TABLE shipping_method
(
method_id INTEGER
primary key,
method_name TEXT,
cost REAL
)
/*
1 example row:
SELECT * FROM shipping_method LIMIT 1;
method_id ||method_name ||cost
1 || Standard || 5.9
*/
/* column definitions {
"method_id": "the unique identifier of the method",
"method_name": "the method name",
"cost": "the cost of the shipping method"
}*/
CREATE TABLE "cust_order"
(
order_id INTEGER
primary key autoincrement,
order_date DATETIME,
customer_id INTEGER
references customer,
shipping_method_id INTEGER
references shipping_method,
dest_address_id INTEGER
references address
)
/*
1 example row:
SELECT * FROM cust_order LIMIT 1;
order_id || order_date ||customer_id ||shipping_method_id ||dest_address_id
1 ||2021-07-14 10:47:19 || 387 || 4 || 1
*/
/* column definitions {
"order_id": "the unique identifier of the customer order",
"order_date": "the date of the order",
"customer_id": "the id of the customer\nMaps to customer(customer_Id)",
"shipping_method_id": "the id of the shipping method\nMaps to shipping_method(method_id)",
"dest_address_id": "the id of the destination address\nMaps to address(address_id)"
}*/
CREATE TABLE "order_history"
(
history_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
status_id INTEGER
references order_status,
status_date DATETIME
)
/*
1 example row:
SELECT * FROM order_history LIMIT 1;
history_id ||order_id ||status_id || status_date
1 || 1 || 1 ||2021-07-14 17:04:28
*/
/* column definitions {
"history_id": "the unique identifier of the order history",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"status_id": "the id of the order\nMaps to order_status(status_id)",
"status_date": "the date of the status updated "
}*/
CREATE TABLE "order_line"
(
line_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
book_id INTEGER
references book,
price REAL
)
/*
1 example row:
SELECT * FROM order_line LIMIT 1;
line_id ||order_id ||book_id ||price
1024 || 2051 || 10720 || 3.19
*/
/* column definitions {
"line_id": "the unique identifier of the order line",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"book_id": "the id of the book\nMaps to book(book_id)",
"price": "the price of the order"
}*/
### Question
Among the books published by publisher ID 1929, how many of them have over 500 pages?
Clarification: books have over 500 pages refers to num_pages > 500
| [query_database(**{'query': 'SELECT COUNT(*) FROM book WHERE publisher_id = 1929 AND num_pages > 500'})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE address_status
(
status_id INTEGER
primary key,
address_status TEXT
)
/*
1 example row:
SELECT * FROM address_status LIMIT 1;
status_id ||address_status
1 || Active
*/
/* column definitions {
"status_id": "the unique identifier of the status",
"address_status": "the status of the address"
}*/
CREATE TABLE author
(
author_id INTEGER
primary key,
author_name TEXT
)
/*
1 example row:
SELECT * FROM author LIMIT 1;
author_id || author_name
1 ||A. Bartlett Giamatti
*/
/* column definitions {
"author_id": "the unique identifier of the author",
"author_name": "the name of the author"
}*/
CREATE TABLE book_language
(
language_id INTEGER
primary key,
language_code TEXT,
language_name TEXT
)
/*
1 example row:
SELECT * FROM book_language LIMIT 1;
language_id ||language_code ||language_name
1 || eng || English
*/
/* column definitions {
"language_id": "the unique identifier of the language ",
"language_code": "the language code",
"language_name": "the language name"
}*/
CREATE TABLE country
(
country_id INTEGER
primary key,
country_name TEXT
)
/*
1 example row:
SELECT * FROM country LIMIT 1;
country_id ||country_name
1 || Afghanistan
*/
/* column definitions {
"country_id": "the unique identifier of the country",
"country_name": "the country name"
}*/
CREATE TABLE address
(
address_id INTEGER
primary key,
street_number TEXT,
street_name TEXT,
city TEXT,
country_id INTEGER,
foreign key (country_id) references country(country_id)
)
/*
1 example row:
SELECT * FROM address LIMIT 1;
address_id ||street_number || street_name || city ||country_id
1 || 57 ||Glacier Hill Avenue ||Torbat-e Jām || 95
*/
/* column definitions {
"address_id": "the unique identifier of the address",
"street_number": "the street number of the address",
"street_name": "the street name",
"city": "the city where the address belongs",
"country_id": "the id of the country where the address belongs "
}*/
CREATE TABLE customer
(
customer_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
email TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
customer_id ||first_name ||last_name || email
1 || Ursola || Purdy ||upurdy0@cdbaby.com
*/
/* column definitions {
"customer_id": "the unique identifier of the customer",
"first_name": "the first name of the customer",
"last_name": "the last name of the customer",
"email": "the email of the customer"
}*/
CREATE TABLE customer_address
(
customer_id INTEGER,
address_id INTEGER,
status_id INTEGER,
primary key (customer_id, address_id),
foreign key (address_id) references address(address_id),
foreign key (customer_id) references customer(customer_id)
)
/*
1 example row:
SELECT * FROM customer_address LIMIT 1;
customer_id ||address_id ||status_id
1 || 606 || 1
*/
/* column definitions {
"customer_id": "the id of the customer\nMaps to customer(customer_id)",
"address_id": "the id of the address\nMaps to address(address_id)",
"status_id": "the id of the address status"
}*/
CREATE TABLE order_status
(
status_id INTEGER
primary key,
status_value TEXT
)
/*
1 example row:
SELECT * FROM order_status LIMIT 1;
status_id || status_value
1 ||Order Received
*/
/* column definitions {
"status_id": "the unique identifier of the order status",
"status_value": "the status value"
}*/
CREATE TABLE publisher
(
publisher_id INTEGER
primary key,
publisher_name TEXT
)
/*
1 example row:
SELECT * FROM publisher LIMIT 1;
publisher_id ||publisher_name
1 || 10/18
*/
/* column definitions {
"publisher_id": "the unique identifier of the publisher",
"publisher_name": "the name of the publisher"
}*/
CREATE TABLE book
(
book_id INTEGER
primary key,
title TEXT,
isbn13 TEXT,
language_id INTEGER,
num_pages INTEGER,
publication_date DATE,
publisher_id INTEGER,
foreign key (language_id) references book_language(language_id),
foreign key (publisher_id) references publisher(publisher_id)
)
/*
1 example row:
SELECT * FROM book LIMIT 1;
book_id || title || isbn13 ||language_id ||num_pages ||publication_date ||publisher_id
1 ||The World's First Love: Mary Mother of God ||8987059752 || 2 || 276 || 1996-09-01 || 1010
*/
/* column definitions {
"book_id": "the unique identifier of the book",
"title": "the title of the book ",
"isbn13": "the International Standard Book Number of the book",
"language_id": "the id of the book language\nMaps to book_language (language_id)",
"num_pages": "the number of the pages",
"publication_date": "the publication date of the book",
"publisher_id": "the id of the publisher\nMaps to publisher (publisher_id)"
}*/
CREATE TABLE book_author
(
book_id INTEGER,
author_id INTEGER,
primary key (book_id, author_id),
foreign key (author_id) references author(author_id),
foreign key (book_id) references book(book_id)
)
/*
1 example row:
SELECT * FROM book_author LIMIT 1;
book_id ||author_id
10539 || 1
*/
/* column definitions {
"book_id": "the id of the book\nMaps to book(book_id)",
"author_id": "the id of the author\nMaps to author(author_id)"
}*/
CREATE TABLE shipping_method
(
method_id INTEGER
primary key,
method_name TEXT,
cost REAL
)
/*
1 example row:
SELECT * FROM shipping_method LIMIT 1;
method_id ||method_name ||cost
1 || Standard || 5.9
*/
/* column definitions {
"method_id": "the unique identifier of the method",
"method_name": "the method name",
"cost": "the cost of the shipping method"
}*/
CREATE TABLE "cust_order"
(
order_id INTEGER
primary key autoincrement,
order_date DATETIME,
customer_id INTEGER
references customer,
shipping_method_id INTEGER
references shipping_method,
dest_address_id INTEGER
references address
)
/*
1 example row:
SELECT * FROM cust_order LIMIT 1;
order_id || order_date ||customer_id ||shipping_method_id ||dest_address_id
1 ||2021-07-14 10:47:19 || 387 || 4 || 1
*/
/* column definitions {
"order_id": "the unique identifier of the customer order",
"order_date": "the date of the order",
"customer_id": "the id of the customer\nMaps to customer(customer_Id)",
"shipping_method_id": "the id of the shipping method\nMaps to shipping_method(method_id)",
"dest_address_id": "the id of the destination address\nMaps to address(address_id)"
}*/
CREATE TABLE "order_history"
(
history_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
status_id INTEGER
references order_status,
status_date DATETIME
)
/*
1 example row:
SELECT * FROM order_history LIMIT 1;
history_id ||order_id ||status_id || status_date
1 || 1 || 1 ||2021-07-14 17:04:28
*/
/* column definitions {
"history_id": "the unique identifier of the order history",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"status_id": "the id of the order\nMaps to order_status(status_id)",
"status_date": "the date of the status updated "
}*/
CREATE TABLE "order_line"
(
line_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
book_id INTEGER
references book,
price REAL
)
/*
1 example row:
SELECT * FROM order_line LIMIT 1;
line_id ||order_id ||book_id ||price
1024 || 2051 || 10720 || 3.19
*/
/* column definitions {
"line_id": "the unique identifier of the order line",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"book_id": "the id of the book\nMaps to book(book_id)",
"price": "the price of the order"
}*/
|
5,916 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE address_status
(
status_id INTEGER
primary key,
address_status TEXT
)
/*
1 example row:
SELECT * FROM address_status LIMIT 1;
status_id ||address_status
1 || Active
*/
/* column definitions {
"status_id": "the unique identifier of the status",
"address_status": "the status of the address"
}*/
CREATE TABLE author
(
author_id INTEGER
primary key,
author_name TEXT
)
/*
1 example row:
SELECT * FROM author LIMIT 1;
author_id || author_name
1 ||A. Bartlett Giamatti
*/
/* column definitions {
"author_id": "the unique identifier of the author",
"author_name": "the name of the author"
}*/
CREATE TABLE book_language
(
language_id INTEGER
primary key,
language_code TEXT,
language_name TEXT
)
/*
1 example row:
SELECT * FROM book_language LIMIT 1;
language_id ||language_code ||language_name
1 || eng || English
*/
/* column definitions {
"language_id": "the unique identifier of the language ",
"language_code": "the language code",
"language_name": "the language name"
}*/
CREATE TABLE country
(
country_id INTEGER
primary key,
country_name TEXT
)
/*
1 example row:
SELECT * FROM country LIMIT 1;
country_id ||country_name
1 || Afghanistan
*/
/* column definitions {
"country_id": "the unique identifier of the country",
"country_name": "the country name"
}*/
CREATE TABLE address
(
address_id INTEGER
primary key,
street_number TEXT,
street_name TEXT,
city TEXT,
country_id INTEGER,
foreign key (country_id) references country(country_id)
)
/*
1 example row:
SELECT * FROM address LIMIT 1;
address_id ||street_number || street_name || city ||country_id
1 || 57 ||Glacier Hill Avenue ||Torbat-e Jām || 95
*/
/* column definitions {
"address_id": "the unique identifier of the address",
"street_number": "the street number of the address",
"street_name": "the street name",
"city": "the city where the address belongs",
"country_id": "the id of the country where the address belongs "
}*/
CREATE TABLE customer
(
customer_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
email TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
customer_id ||first_name ||last_name || email
1 || Ursola || Purdy ||upurdy0@cdbaby.com
*/
/* column definitions {
"customer_id": "the unique identifier of the customer",
"first_name": "the first name of the customer",
"last_name": "the last name of the customer",
"email": "the email of the customer"
}*/
CREATE TABLE customer_address
(
customer_id INTEGER,
address_id INTEGER,
status_id INTEGER,
primary key (customer_id, address_id),
foreign key (address_id) references address(address_id),
foreign key (customer_id) references customer(customer_id)
)
/*
1 example row:
SELECT * FROM customer_address LIMIT 1;
customer_id ||address_id ||status_id
1 || 606 || 1
*/
/* column definitions {
"customer_id": "the id of the customer\nMaps to customer(customer_id)",
"address_id": "the id of the address\nMaps to address(address_id)",
"status_id": "the id of the address status"
}*/
CREATE TABLE order_status
(
status_id INTEGER
primary key,
status_value TEXT
)
/*
1 example row:
SELECT * FROM order_status LIMIT 1;
status_id || status_value
1 ||Order Received
*/
/* column definitions {
"status_id": "the unique identifier of the order status",
"status_value": "the status value"
}*/
CREATE TABLE publisher
(
publisher_id INTEGER
primary key,
publisher_name TEXT
)
/*
1 example row:
SELECT * FROM publisher LIMIT 1;
publisher_id ||publisher_name
1 || 10/18
*/
/* column definitions {
"publisher_id": "the unique identifier of the publisher",
"publisher_name": "the name of the publisher"
}*/
CREATE TABLE book
(
book_id INTEGER
primary key,
title TEXT,
isbn13 TEXT,
language_id INTEGER,
num_pages INTEGER,
publication_date DATE,
publisher_id INTEGER,
foreign key (language_id) references book_language(language_id),
foreign key (publisher_id) references publisher(publisher_id)
)
/*
1 example row:
SELECT * FROM book LIMIT 1;
book_id || title || isbn13 ||language_id ||num_pages ||publication_date ||publisher_id
1 ||The World's First Love: Mary Mother of God ||8987059752 || 2 || 276 || 1996-09-01 || 1010
*/
/* column definitions {
"book_id": "the unique identifier of the book",
"title": "the title of the book ",
"isbn13": "the International Standard Book Number of the book",
"language_id": "the id of the book language\nMaps to book_language (language_id)",
"num_pages": "the number of the pages",
"publication_date": "the publication date of the book",
"publisher_id": "the id of the publisher\nMaps to publisher (publisher_id)"
}*/
CREATE TABLE book_author
(
book_id INTEGER,
author_id INTEGER,
primary key (book_id, author_id),
foreign key (author_id) references author(author_id),
foreign key (book_id) references book(book_id)
)
/*
1 example row:
SELECT * FROM book_author LIMIT 1;
book_id ||author_id
10539 || 1
*/
/* column definitions {
"book_id": "the id of the book\nMaps to book(book_id)",
"author_id": "the id of the author\nMaps to author(author_id)"
}*/
CREATE TABLE shipping_method
(
method_id INTEGER
primary key,
method_name TEXT,
cost REAL
)
/*
1 example row:
SELECT * FROM shipping_method LIMIT 1;
method_id ||method_name ||cost
1 || Standard || 5.9
*/
/* column definitions {
"method_id": "the unique identifier of the method",
"method_name": "the method name",
"cost": "the cost of the shipping method"
}*/
CREATE TABLE "cust_order"
(
order_id INTEGER
primary key autoincrement,
order_date DATETIME,
customer_id INTEGER
references customer,
shipping_method_id INTEGER
references shipping_method,
dest_address_id INTEGER
references address
)
/*
1 example row:
SELECT * FROM cust_order LIMIT 1;
order_id || order_date ||customer_id ||shipping_method_id ||dest_address_id
1 ||2021-07-14 10:47:19 || 387 || 4 || 1
*/
/* column definitions {
"order_id": "the unique identifier of the customer order",
"order_date": "the date of the order",
"customer_id": "the id of the customer\nMaps to customer(customer_Id)",
"shipping_method_id": "the id of the shipping method\nMaps to shipping_method(method_id)",
"dest_address_id": "the id of the destination address\nMaps to address(address_id)"
}*/
CREATE TABLE "order_history"
(
history_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
status_id INTEGER
references order_status,
status_date DATETIME
)
/*
1 example row:
SELECT * FROM order_history LIMIT 1;
history_id ||order_id ||status_id || status_date
1 || 1 || 1 ||2021-07-14 17:04:28
*/
/* column definitions {
"history_id": "the unique identifier of the order history",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"status_id": "the id of the order\nMaps to order_status(status_id)",
"status_date": "the date of the status updated "
}*/
CREATE TABLE "order_line"
(
line_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
book_id INTEGER
references book,
price REAL
)
/*
1 example row:
SELECT * FROM order_line LIMIT 1;
line_id ||order_id ||book_id ||price
1024 || 2051 || 10720 || 3.19
*/
/* column definitions {
"line_id": "the unique identifier of the order line",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"book_id": "the id of the book\nMaps to book(book_id)",
"price": "the price of the order"
}*/
### Question
What is the name of the publisher that has published the most number of books?
Clarification: name of publisher refers to publisher_name; publisher published the most number of books refers to Max(Count(book_id))
| [query_database(**{'query': 'SELECT T2.publisher_name FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id GROUP BY T2.publisher_name ORDER BY COUNT(T1.book_id) DESC LIMIT 1'})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE address_status
(
status_id INTEGER
primary key,
address_status TEXT
)
/*
1 example row:
SELECT * FROM address_status LIMIT 1;
status_id ||address_status
1 || Active
*/
/* column definitions {
"status_id": "the unique identifier of the status",
"address_status": "the status of the address"
}*/
CREATE TABLE author
(
author_id INTEGER
primary key,
author_name TEXT
)
/*
1 example row:
SELECT * FROM author LIMIT 1;
author_id || author_name
1 ||A. Bartlett Giamatti
*/
/* column definitions {
"author_id": "the unique identifier of the author",
"author_name": "the name of the author"
}*/
CREATE TABLE book_language
(
language_id INTEGER
primary key,
language_code TEXT,
language_name TEXT
)
/*
1 example row:
SELECT * FROM book_language LIMIT 1;
language_id ||language_code ||language_name
1 || eng || English
*/
/* column definitions {
"language_id": "the unique identifier of the language ",
"language_code": "the language code",
"language_name": "the language name"
}*/
CREATE TABLE country
(
country_id INTEGER
primary key,
country_name TEXT
)
/*
1 example row:
SELECT * FROM country LIMIT 1;
country_id ||country_name
1 || Afghanistan
*/
/* column definitions {
"country_id": "the unique identifier of the country",
"country_name": "the country name"
}*/
CREATE TABLE address
(
address_id INTEGER
primary key,
street_number TEXT,
street_name TEXT,
city TEXT,
country_id INTEGER,
foreign key (country_id) references country(country_id)
)
/*
1 example row:
SELECT * FROM address LIMIT 1;
address_id ||street_number || street_name || city ||country_id
1 || 57 ||Glacier Hill Avenue ||Torbat-e Jām || 95
*/
/* column definitions {
"address_id": "the unique identifier of the address",
"street_number": "the street number of the address",
"street_name": "the street name",
"city": "the city where the address belongs",
"country_id": "the id of the country where the address belongs "
}*/
CREATE TABLE customer
(
customer_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
email TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
customer_id ||first_name ||last_name || email
1 || Ursola || Purdy ||upurdy0@cdbaby.com
*/
/* column definitions {
"customer_id": "the unique identifier of the customer",
"first_name": "the first name of the customer",
"last_name": "the last name of the customer",
"email": "the email of the customer"
}*/
CREATE TABLE customer_address
(
customer_id INTEGER,
address_id INTEGER,
status_id INTEGER,
primary key (customer_id, address_id),
foreign key (address_id) references address(address_id),
foreign key (customer_id) references customer(customer_id)
)
/*
1 example row:
SELECT * FROM customer_address LIMIT 1;
customer_id ||address_id ||status_id
1 || 606 || 1
*/
/* column definitions {
"customer_id": "the id of the customer\nMaps to customer(customer_id)",
"address_id": "the id of the address\nMaps to address(address_id)",
"status_id": "the id of the address status"
}*/
CREATE TABLE order_status
(
status_id INTEGER
primary key,
status_value TEXT
)
/*
1 example row:
SELECT * FROM order_status LIMIT 1;
status_id || status_value
1 ||Order Received
*/
/* column definitions {
"status_id": "the unique identifier of the order status",
"status_value": "the status value"
}*/
CREATE TABLE publisher
(
publisher_id INTEGER
primary key,
publisher_name TEXT
)
/*
1 example row:
SELECT * FROM publisher LIMIT 1;
publisher_id ||publisher_name
1 || 10/18
*/
/* column definitions {
"publisher_id": "the unique identifier of the publisher",
"publisher_name": "the name of the publisher"
}*/
CREATE TABLE book
(
book_id INTEGER
primary key,
title TEXT,
isbn13 TEXT,
language_id INTEGER,
num_pages INTEGER,
publication_date DATE,
publisher_id INTEGER,
foreign key (language_id) references book_language(language_id),
foreign key (publisher_id) references publisher(publisher_id)
)
/*
1 example row:
SELECT * FROM book LIMIT 1;
book_id || title || isbn13 ||language_id ||num_pages ||publication_date ||publisher_id
1 ||The World's First Love: Mary Mother of God ||8987059752 || 2 || 276 || 1996-09-01 || 1010
*/
/* column definitions {
"book_id": "the unique identifier of the book",
"title": "the title of the book ",
"isbn13": "the International Standard Book Number of the book",
"language_id": "the id of the book language\nMaps to book_language (language_id)",
"num_pages": "the number of the pages",
"publication_date": "the publication date of the book",
"publisher_id": "the id of the publisher\nMaps to publisher (publisher_id)"
}*/
CREATE TABLE book_author
(
book_id INTEGER,
author_id INTEGER,
primary key (book_id, author_id),
foreign key (author_id) references author(author_id),
foreign key (book_id) references book(book_id)
)
/*
1 example row:
SELECT * FROM book_author LIMIT 1;
book_id ||author_id
10539 || 1
*/
/* column definitions {
"book_id": "the id of the book\nMaps to book(book_id)",
"author_id": "the id of the author\nMaps to author(author_id)"
}*/
CREATE TABLE shipping_method
(
method_id INTEGER
primary key,
method_name TEXT,
cost REAL
)
/*
1 example row:
SELECT * FROM shipping_method LIMIT 1;
method_id ||method_name ||cost
1 || Standard || 5.9
*/
/* column definitions {
"method_id": "the unique identifier of the method",
"method_name": "the method name",
"cost": "the cost of the shipping method"
}*/
CREATE TABLE "cust_order"
(
order_id INTEGER
primary key autoincrement,
order_date DATETIME,
customer_id INTEGER
references customer,
shipping_method_id INTEGER
references shipping_method,
dest_address_id INTEGER
references address
)
/*
1 example row:
SELECT * FROM cust_order LIMIT 1;
order_id || order_date ||customer_id ||shipping_method_id ||dest_address_id
1 ||2021-07-14 10:47:19 || 387 || 4 || 1
*/
/* column definitions {
"order_id": "the unique identifier of the customer order",
"order_date": "the date of the order",
"customer_id": "the id of the customer\nMaps to customer(customer_Id)",
"shipping_method_id": "the id of the shipping method\nMaps to shipping_method(method_id)",
"dest_address_id": "the id of the destination address\nMaps to address(address_id)"
}*/
CREATE TABLE "order_history"
(
history_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
status_id INTEGER
references order_status,
status_date DATETIME
)
/*
1 example row:
SELECT * FROM order_history LIMIT 1;
history_id ||order_id ||status_id || status_date
1 || 1 || 1 ||2021-07-14 17:04:28
*/
/* column definitions {
"history_id": "the unique identifier of the order history",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"status_id": "the id of the order\nMaps to order_status(status_id)",
"status_date": "the date of the status updated "
}*/
CREATE TABLE "order_line"
(
line_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
book_id INTEGER
references book,
price REAL
)
/*
1 example row:
SELECT * FROM order_line LIMIT 1;
line_id ||order_id ||book_id ||price
1024 || 2051 || 10720 || 3.19
*/
/* column definitions {
"line_id": "the unique identifier of the order line",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"book_id": "the id of the book\nMaps to book(book_id)",
"price": "the price of the order"
}*/
|
5,920 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE address_status
(
status_id INTEGER
primary key,
address_status TEXT
)
/*
1 example row:
SELECT * FROM address_status LIMIT 1;
status_id ||address_status
1 || Active
*/
/* column definitions {
"status_id": "the unique identifier of the status",
"address_status": "the status of the address"
}*/
CREATE TABLE author
(
author_id INTEGER
primary key,
author_name TEXT
)
/*
1 example row:
SELECT * FROM author LIMIT 1;
author_id || author_name
1 ||A. Bartlett Giamatti
*/
/* column definitions {
"author_id": "the unique identifier of the author",
"author_name": "the name of the author"
}*/
CREATE TABLE book_language
(
language_id INTEGER
primary key,
language_code TEXT,
language_name TEXT
)
/*
1 example row:
SELECT * FROM book_language LIMIT 1;
language_id ||language_code ||language_name
1 || eng || English
*/
/* column definitions {
"language_id": "the unique identifier of the language ",
"language_code": "the language code",
"language_name": "the language name"
}*/
CREATE TABLE country
(
country_id INTEGER
primary key,
country_name TEXT
)
/*
1 example row:
SELECT * FROM country LIMIT 1;
country_id ||country_name
1 || Afghanistan
*/
/* column definitions {
"country_id": "the unique identifier of the country",
"country_name": "the country name"
}*/
CREATE TABLE address
(
address_id INTEGER
primary key,
street_number TEXT,
street_name TEXT,
city TEXT,
country_id INTEGER,
foreign key (country_id) references country(country_id)
)
/*
1 example row:
SELECT * FROM address LIMIT 1;
address_id ||street_number || street_name || city ||country_id
1 || 57 ||Glacier Hill Avenue ||Torbat-e Jām || 95
*/
/* column definitions {
"address_id": "the unique identifier of the address",
"street_number": "the street number of the address",
"street_name": "the street name",
"city": "the city where the address belongs",
"country_id": "the id of the country where the address belongs "
}*/
CREATE TABLE customer
(
customer_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
email TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
customer_id ||first_name ||last_name || email
1 || Ursola || Purdy ||upurdy0@cdbaby.com
*/
/* column definitions {
"customer_id": "the unique identifier of the customer",
"first_name": "the first name of the customer",
"last_name": "the last name of the customer",
"email": "the email of the customer"
}*/
CREATE TABLE customer_address
(
customer_id INTEGER,
address_id INTEGER,
status_id INTEGER,
primary key (customer_id, address_id),
foreign key (address_id) references address(address_id),
foreign key (customer_id) references customer(customer_id)
)
/*
1 example row:
SELECT * FROM customer_address LIMIT 1;
customer_id ||address_id ||status_id
1 || 606 || 1
*/
/* column definitions {
"customer_id": "the id of the customer\nMaps to customer(customer_id)",
"address_id": "the id of the address\nMaps to address(address_id)",
"status_id": "the id of the address status"
}*/
CREATE TABLE order_status
(
status_id INTEGER
primary key,
status_value TEXT
)
/*
1 example row:
SELECT * FROM order_status LIMIT 1;
status_id || status_value
1 ||Order Received
*/
/* column definitions {
"status_id": "the unique identifier of the order status",
"status_value": "the status value"
}*/
CREATE TABLE publisher
(
publisher_id INTEGER
primary key,
publisher_name TEXT
)
/*
1 example row:
SELECT * FROM publisher LIMIT 1;
publisher_id ||publisher_name
1 || 10/18
*/
/* column definitions {
"publisher_id": "the unique identifier of the publisher",
"publisher_name": "the name of the publisher"
}*/
CREATE TABLE book
(
book_id INTEGER
primary key,
title TEXT,
isbn13 TEXT,
language_id INTEGER,
num_pages INTEGER,
publication_date DATE,
publisher_id INTEGER,
foreign key (language_id) references book_language(language_id),
foreign key (publisher_id) references publisher(publisher_id)
)
/*
1 example row:
SELECT * FROM book LIMIT 1;
book_id || title || isbn13 ||language_id ||num_pages ||publication_date ||publisher_id
1 ||The World's First Love: Mary Mother of God ||8987059752 || 2 || 276 || 1996-09-01 || 1010
*/
/* column definitions {
"book_id": "the unique identifier of the book",
"title": "the title of the book ",
"isbn13": "the International Standard Book Number of the book",
"language_id": "the id of the book language\nMaps to book_language (language_id)",
"num_pages": "the number of the pages",
"publication_date": "the publication date of the book",
"publisher_id": "the id of the publisher\nMaps to publisher (publisher_id)"
}*/
CREATE TABLE book_author
(
book_id INTEGER,
author_id INTEGER,
primary key (book_id, author_id),
foreign key (author_id) references author(author_id),
foreign key (book_id) references book(book_id)
)
/*
1 example row:
SELECT * FROM book_author LIMIT 1;
book_id ||author_id
10539 || 1
*/
/* column definitions {
"book_id": "the id of the book\nMaps to book(book_id)",
"author_id": "the id of the author\nMaps to author(author_id)"
}*/
CREATE TABLE shipping_method
(
method_id INTEGER
primary key,
method_name TEXT,
cost REAL
)
/*
1 example row:
SELECT * FROM shipping_method LIMIT 1;
method_id ||method_name ||cost
1 || Standard || 5.9
*/
/* column definitions {
"method_id": "the unique identifier of the method",
"method_name": "the method name",
"cost": "the cost of the shipping method"
}*/
CREATE TABLE "cust_order"
(
order_id INTEGER
primary key autoincrement,
order_date DATETIME,
customer_id INTEGER
references customer,
shipping_method_id INTEGER
references shipping_method,
dest_address_id INTEGER
references address
)
/*
1 example row:
SELECT * FROM cust_order LIMIT 1;
order_id || order_date ||customer_id ||shipping_method_id ||dest_address_id
1 ||2021-07-14 10:47:19 || 387 || 4 || 1
*/
/* column definitions {
"order_id": "the unique identifier of the customer order",
"order_date": "the date of the order",
"customer_id": "the id of the customer\nMaps to customer(customer_Id)",
"shipping_method_id": "the id of the shipping method\nMaps to shipping_method(method_id)",
"dest_address_id": "the id of the destination address\nMaps to address(address_id)"
}*/
CREATE TABLE "order_history"
(
history_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
status_id INTEGER
references order_status,
status_date DATETIME
)
/*
1 example row:
SELECT * FROM order_history LIMIT 1;
history_id ||order_id ||status_id || status_date
1 || 1 || 1 ||2021-07-14 17:04:28
*/
/* column definitions {
"history_id": "the unique identifier of the order history",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"status_id": "the id of the order\nMaps to order_status(status_id)",
"status_date": "the date of the status updated "
}*/
CREATE TABLE "order_line"
(
line_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
book_id INTEGER
references book,
price REAL
)
/*
1 example row:
SELECT * FROM order_line LIMIT 1;
line_id ||order_id ||book_id ||price
1024 || 2051 || 10720 || 3.19
*/
/* column definitions {
"line_id": "the unique identifier of the order line",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"book_id": "the id of the book\nMaps to book(book_id)",
"price": "the price of the order"
}*/
### Question
How many books are in English?
Clarification: books in English refers to language_name = 'English'
| [query_database(**{'query': 'SELECT COUNT(*) FROM book AS T1 INNER JOIN book_language AS T2 ON T1.language_id = T2.language_id WHERE T2.language_name = 'English''})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE address_status
(
status_id INTEGER
primary key,
address_status TEXT
)
/*
1 example row:
SELECT * FROM address_status LIMIT 1;
status_id ||address_status
1 || Active
*/
/* column definitions {
"status_id": "the unique identifier of the status",
"address_status": "the status of the address"
}*/
CREATE TABLE author
(
author_id INTEGER
primary key,
author_name TEXT
)
/*
1 example row:
SELECT * FROM author LIMIT 1;
author_id || author_name
1 ||A. Bartlett Giamatti
*/
/* column definitions {
"author_id": "the unique identifier of the author",
"author_name": "the name of the author"
}*/
CREATE TABLE book_language
(
language_id INTEGER
primary key,
language_code TEXT,
language_name TEXT
)
/*
1 example row:
SELECT * FROM book_language LIMIT 1;
language_id ||language_code ||language_name
1 || eng || English
*/
/* column definitions {
"language_id": "the unique identifier of the language ",
"language_code": "the language code",
"language_name": "the language name"
}*/
CREATE TABLE country
(
country_id INTEGER
primary key,
country_name TEXT
)
/*
1 example row:
SELECT * FROM country LIMIT 1;
country_id ||country_name
1 || Afghanistan
*/
/* column definitions {
"country_id": "the unique identifier of the country",
"country_name": "the country name"
}*/
CREATE TABLE address
(
address_id INTEGER
primary key,
street_number TEXT,
street_name TEXT,
city TEXT,
country_id INTEGER,
foreign key (country_id) references country(country_id)
)
/*
1 example row:
SELECT * FROM address LIMIT 1;
address_id ||street_number || street_name || city ||country_id
1 || 57 ||Glacier Hill Avenue ||Torbat-e Jām || 95
*/
/* column definitions {
"address_id": "the unique identifier of the address",
"street_number": "the street number of the address",
"street_name": "the street name",
"city": "the city where the address belongs",
"country_id": "the id of the country where the address belongs "
}*/
CREATE TABLE customer
(
customer_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
email TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
customer_id ||first_name ||last_name || email
1 || Ursola || Purdy ||upurdy0@cdbaby.com
*/
/* column definitions {
"customer_id": "the unique identifier of the customer",
"first_name": "the first name of the customer",
"last_name": "the last name of the customer",
"email": "the email of the customer"
}*/
CREATE TABLE customer_address
(
customer_id INTEGER,
address_id INTEGER,
status_id INTEGER,
primary key (customer_id, address_id),
foreign key (address_id) references address(address_id),
foreign key (customer_id) references customer(customer_id)
)
/*
1 example row:
SELECT * FROM customer_address LIMIT 1;
customer_id ||address_id ||status_id
1 || 606 || 1
*/
/* column definitions {
"customer_id": "the id of the customer\nMaps to customer(customer_id)",
"address_id": "the id of the address\nMaps to address(address_id)",
"status_id": "the id of the address status"
}*/
CREATE TABLE order_status
(
status_id INTEGER
primary key,
status_value TEXT
)
/*
1 example row:
SELECT * FROM order_status LIMIT 1;
status_id || status_value
1 ||Order Received
*/
/* column definitions {
"status_id": "the unique identifier of the order status",
"status_value": "the status value"
}*/
CREATE TABLE publisher
(
publisher_id INTEGER
primary key,
publisher_name TEXT
)
/*
1 example row:
SELECT * FROM publisher LIMIT 1;
publisher_id ||publisher_name
1 || 10/18
*/
/* column definitions {
"publisher_id": "the unique identifier of the publisher",
"publisher_name": "the name of the publisher"
}*/
CREATE TABLE book
(
book_id INTEGER
primary key,
title TEXT,
isbn13 TEXT,
language_id INTEGER,
num_pages INTEGER,
publication_date DATE,
publisher_id INTEGER,
foreign key (language_id) references book_language(language_id),
foreign key (publisher_id) references publisher(publisher_id)
)
/*
1 example row:
SELECT * FROM book LIMIT 1;
book_id || title || isbn13 ||language_id ||num_pages ||publication_date ||publisher_id
1 ||The World's First Love: Mary Mother of God ||8987059752 || 2 || 276 || 1996-09-01 || 1010
*/
/* column definitions {
"book_id": "the unique identifier of the book",
"title": "the title of the book ",
"isbn13": "the International Standard Book Number of the book",
"language_id": "the id of the book language\nMaps to book_language (language_id)",
"num_pages": "the number of the pages",
"publication_date": "the publication date of the book",
"publisher_id": "the id of the publisher\nMaps to publisher (publisher_id)"
}*/
CREATE TABLE book_author
(
book_id INTEGER,
author_id INTEGER,
primary key (book_id, author_id),
foreign key (author_id) references author(author_id),
foreign key (book_id) references book(book_id)
)
/*
1 example row:
SELECT * FROM book_author LIMIT 1;
book_id ||author_id
10539 || 1
*/
/* column definitions {
"book_id": "the id of the book\nMaps to book(book_id)",
"author_id": "the id of the author\nMaps to author(author_id)"
}*/
CREATE TABLE shipping_method
(
method_id INTEGER
primary key,
method_name TEXT,
cost REAL
)
/*
1 example row:
SELECT * FROM shipping_method LIMIT 1;
method_id ||method_name ||cost
1 || Standard || 5.9
*/
/* column definitions {
"method_id": "the unique identifier of the method",
"method_name": "the method name",
"cost": "the cost of the shipping method"
}*/
CREATE TABLE "cust_order"
(
order_id INTEGER
primary key autoincrement,
order_date DATETIME,
customer_id INTEGER
references customer,
shipping_method_id INTEGER
references shipping_method,
dest_address_id INTEGER
references address
)
/*
1 example row:
SELECT * FROM cust_order LIMIT 1;
order_id || order_date ||customer_id ||shipping_method_id ||dest_address_id
1 ||2021-07-14 10:47:19 || 387 || 4 || 1
*/
/* column definitions {
"order_id": "the unique identifier of the customer order",
"order_date": "the date of the order",
"customer_id": "the id of the customer\nMaps to customer(customer_Id)",
"shipping_method_id": "the id of the shipping method\nMaps to shipping_method(method_id)",
"dest_address_id": "the id of the destination address\nMaps to address(address_id)"
}*/
CREATE TABLE "order_history"
(
history_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
status_id INTEGER
references order_status,
status_date DATETIME
)
/*
1 example row:
SELECT * FROM order_history LIMIT 1;
history_id ||order_id ||status_id || status_date
1 || 1 || 1 ||2021-07-14 17:04:28
*/
/* column definitions {
"history_id": "the unique identifier of the order history",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"status_id": "the id of the order\nMaps to order_status(status_id)",
"status_date": "the date of the status updated "
}*/
CREATE TABLE "order_line"
(
line_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
book_id INTEGER
references book,
price REAL
)
/*
1 example row:
SELECT * FROM order_line LIMIT 1;
line_id ||order_id ||book_id ||price
1024 || 2051 || 10720 || 3.19
*/
/* column definitions {
"line_id": "the unique identifier of the order line",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"book_id": "the id of the book\nMaps to book(book_id)",
"price": "the price of the order"
}*/
|
5,924 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE address_status
(
status_id INTEGER
primary key,
address_status TEXT
)
/*
1 example row:
SELECT * FROM address_status LIMIT 1;
status_id ||address_status
1 || Active
*/
/* column definitions {
"status_id": "the unique identifier of the status",
"address_status": "the status of the address"
}*/
CREATE TABLE author
(
author_id INTEGER
primary key,
author_name TEXT
)
/*
1 example row:
SELECT * FROM author LIMIT 1;
author_id || author_name
1 ||A. Bartlett Giamatti
*/
/* column definitions {
"author_id": "the unique identifier of the author",
"author_name": "the name of the author"
}*/
CREATE TABLE book_language
(
language_id INTEGER
primary key,
language_code TEXT,
language_name TEXT
)
/*
1 example row:
SELECT * FROM book_language LIMIT 1;
language_id ||language_code ||language_name
1 || eng || English
*/
/* column definitions {
"language_id": "the unique identifier of the language ",
"language_code": "the language code",
"language_name": "the language name"
}*/
CREATE TABLE country
(
country_id INTEGER
primary key,
country_name TEXT
)
/*
1 example row:
SELECT * FROM country LIMIT 1;
country_id ||country_name
1 || Afghanistan
*/
/* column definitions {
"country_id": "the unique identifier of the country",
"country_name": "the country name"
}*/
CREATE TABLE address
(
address_id INTEGER
primary key,
street_number TEXT,
street_name TEXT,
city TEXT,
country_id INTEGER,
foreign key (country_id) references country(country_id)
)
/*
1 example row:
SELECT * FROM address LIMIT 1;
address_id ||street_number || street_name || city ||country_id
1 || 57 ||Glacier Hill Avenue ||Torbat-e Jām || 95
*/
/* column definitions {
"address_id": "the unique identifier of the address",
"street_number": "the street number of the address",
"street_name": "the street name",
"city": "the city where the address belongs",
"country_id": "the id of the country where the address belongs "
}*/
CREATE TABLE customer
(
customer_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
email TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
customer_id ||first_name ||last_name || email
1 || Ursola || Purdy ||upurdy0@cdbaby.com
*/
/* column definitions {
"customer_id": "the unique identifier of the customer",
"first_name": "the first name of the customer",
"last_name": "the last name of the customer",
"email": "the email of the customer"
}*/
CREATE TABLE customer_address
(
customer_id INTEGER,
address_id INTEGER,
status_id INTEGER,
primary key (customer_id, address_id),
foreign key (address_id) references address(address_id),
foreign key (customer_id) references customer(customer_id)
)
/*
1 example row:
SELECT * FROM customer_address LIMIT 1;
customer_id ||address_id ||status_id
1 || 606 || 1
*/
/* column definitions {
"customer_id": "the id of the customer\nMaps to customer(customer_id)",
"address_id": "the id of the address\nMaps to address(address_id)",
"status_id": "the id of the address status"
}*/
CREATE TABLE order_status
(
status_id INTEGER
primary key,
status_value TEXT
)
/*
1 example row:
SELECT * FROM order_status LIMIT 1;
status_id || status_value
1 ||Order Received
*/
/* column definitions {
"status_id": "the unique identifier of the order status",
"status_value": "the status value"
}*/
CREATE TABLE publisher
(
publisher_id INTEGER
primary key,
publisher_name TEXT
)
/*
1 example row:
SELECT * FROM publisher LIMIT 1;
publisher_id ||publisher_name
1 || 10/18
*/
/* column definitions {
"publisher_id": "the unique identifier of the publisher",
"publisher_name": "the name of the publisher"
}*/
CREATE TABLE book
(
book_id INTEGER
primary key,
title TEXT,
isbn13 TEXT,
language_id INTEGER,
num_pages INTEGER,
publication_date DATE,
publisher_id INTEGER,
foreign key (language_id) references book_language(language_id),
foreign key (publisher_id) references publisher(publisher_id)
)
/*
1 example row:
SELECT * FROM book LIMIT 1;
book_id || title || isbn13 ||language_id ||num_pages ||publication_date ||publisher_id
1 ||The World's First Love: Mary Mother of God ||8987059752 || 2 || 276 || 1996-09-01 || 1010
*/
/* column definitions {
"book_id": "the unique identifier of the book",
"title": "the title of the book ",
"isbn13": "the International Standard Book Number of the book",
"language_id": "the id of the book language\nMaps to book_language (language_id)",
"num_pages": "the number of the pages",
"publication_date": "the publication date of the book",
"publisher_id": "the id of the publisher\nMaps to publisher (publisher_id)"
}*/
CREATE TABLE book_author
(
book_id INTEGER,
author_id INTEGER,
primary key (book_id, author_id),
foreign key (author_id) references author(author_id),
foreign key (book_id) references book(book_id)
)
/*
1 example row:
SELECT * FROM book_author LIMIT 1;
book_id ||author_id
10539 || 1
*/
/* column definitions {
"book_id": "the id of the book\nMaps to book(book_id)",
"author_id": "the id of the author\nMaps to author(author_id)"
}*/
CREATE TABLE shipping_method
(
method_id INTEGER
primary key,
method_name TEXT,
cost REAL
)
/*
1 example row:
SELECT * FROM shipping_method LIMIT 1;
method_id ||method_name ||cost
1 || Standard || 5.9
*/
/* column definitions {
"method_id": "the unique identifier of the method",
"method_name": "the method name",
"cost": "the cost of the shipping method"
}*/
CREATE TABLE "cust_order"
(
order_id INTEGER
primary key autoincrement,
order_date DATETIME,
customer_id INTEGER
references customer,
shipping_method_id INTEGER
references shipping_method,
dest_address_id INTEGER
references address
)
/*
1 example row:
SELECT * FROM cust_order LIMIT 1;
order_id || order_date ||customer_id ||shipping_method_id ||dest_address_id
1 ||2021-07-14 10:47:19 || 387 || 4 || 1
*/
/* column definitions {
"order_id": "the unique identifier of the customer order",
"order_date": "the date of the order",
"customer_id": "the id of the customer\nMaps to customer(customer_Id)",
"shipping_method_id": "the id of the shipping method\nMaps to shipping_method(method_id)",
"dest_address_id": "the id of the destination address\nMaps to address(address_id)"
}*/
CREATE TABLE "order_history"
(
history_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
status_id INTEGER
references order_status,
status_date DATETIME
)
/*
1 example row:
SELECT * FROM order_history LIMIT 1;
history_id ||order_id ||status_id || status_date
1 || 1 || 1 ||2021-07-14 17:04:28
*/
/* column definitions {
"history_id": "the unique identifier of the order history",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"status_id": "the id of the order\nMaps to order_status(status_id)",
"status_date": "the date of the status updated "
}*/
CREATE TABLE "order_line"
(
line_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
book_id INTEGER
references book,
price REAL
)
/*
1 example row:
SELECT * FROM order_line LIMIT 1;
line_id ||order_id ||book_id ||price
1024 || 2051 || 10720 || 3.19
*/
/* column definitions {
"line_id": "the unique identifier of the order line",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"book_id": "the id of the book\nMaps to book(book_id)",
"price": "the price of the order"
}*/
### Question
Among the books ordered by Lucas Wyldbore, how many of them are over 300 pages?
Clarification: books have over 300 pages refers to num_pages > 300
| [query_database(**{'query': 'SELECT COUNT(*) FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id INNER JOIN cust_order AS T3 ON T3.order_id = T2.order_id INNER JOIN customer AS T4 ON T4.customer_id = T3.customer_id WHERE T4.first_name = 'Lucas' AND T4.last_name = 'Wyldbore' AND T1.num_pages > 300'})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE address_status
(
status_id INTEGER
primary key,
address_status TEXT
)
/*
1 example row:
SELECT * FROM address_status LIMIT 1;
status_id ||address_status
1 || Active
*/
/* column definitions {
"status_id": "the unique identifier of the status",
"address_status": "the status of the address"
}*/
CREATE TABLE author
(
author_id INTEGER
primary key,
author_name TEXT
)
/*
1 example row:
SELECT * FROM author LIMIT 1;
author_id || author_name
1 ||A. Bartlett Giamatti
*/
/* column definitions {
"author_id": "the unique identifier of the author",
"author_name": "the name of the author"
}*/
CREATE TABLE book_language
(
language_id INTEGER
primary key,
language_code TEXT,
language_name TEXT
)
/*
1 example row:
SELECT * FROM book_language LIMIT 1;
language_id ||language_code ||language_name
1 || eng || English
*/
/* column definitions {
"language_id": "the unique identifier of the language ",
"language_code": "the language code",
"language_name": "the language name"
}*/
CREATE TABLE country
(
country_id INTEGER
primary key,
country_name TEXT
)
/*
1 example row:
SELECT * FROM country LIMIT 1;
country_id ||country_name
1 || Afghanistan
*/
/* column definitions {
"country_id": "the unique identifier of the country",
"country_name": "the country name"
}*/
CREATE TABLE address
(
address_id INTEGER
primary key,
street_number TEXT,
street_name TEXT,
city TEXT,
country_id INTEGER,
foreign key (country_id) references country(country_id)
)
/*
1 example row:
SELECT * FROM address LIMIT 1;
address_id ||street_number || street_name || city ||country_id
1 || 57 ||Glacier Hill Avenue ||Torbat-e Jām || 95
*/
/* column definitions {
"address_id": "the unique identifier of the address",
"street_number": "the street number of the address",
"street_name": "the street name",
"city": "the city where the address belongs",
"country_id": "the id of the country where the address belongs "
}*/
CREATE TABLE customer
(
customer_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
email TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
customer_id ||first_name ||last_name || email
1 || Ursola || Purdy ||upurdy0@cdbaby.com
*/
/* column definitions {
"customer_id": "the unique identifier of the customer",
"first_name": "the first name of the customer",
"last_name": "the last name of the customer",
"email": "the email of the customer"
}*/
CREATE TABLE customer_address
(
customer_id INTEGER,
address_id INTEGER,
status_id INTEGER,
primary key (customer_id, address_id),
foreign key (address_id) references address(address_id),
foreign key (customer_id) references customer(customer_id)
)
/*
1 example row:
SELECT * FROM customer_address LIMIT 1;
customer_id ||address_id ||status_id
1 || 606 || 1
*/
/* column definitions {
"customer_id": "the id of the customer\nMaps to customer(customer_id)",
"address_id": "the id of the address\nMaps to address(address_id)",
"status_id": "the id of the address status"
}*/
CREATE TABLE order_status
(
status_id INTEGER
primary key,
status_value TEXT
)
/*
1 example row:
SELECT * FROM order_status LIMIT 1;
status_id || status_value
1 ||Order Received
*/
/* column definitions {
"status_id": "the unique identifier of the order status",
"status_value": "the status value"
}*/
CREATE TABLE publisher
(
publisher_id INTEGER
primary key,
publisher_name TEXT
)
/*
1 example row:
SELECT * FROM publisher LIMIT 1;
publisher_id ||publisher_name
1 || 10/18
*/
/* column definitions {
"publisher_id": "the unique identifier of the publisher",
"publisher_name": "the name of the publisher"
}*/
CREATE TABLE book
(
book_id INTEGER
primary key,
title TEXT,
isbn13 TEXT,
language_id INTEGER,
num_pages INTEGER,
publication_date DATE,
publisher_id INTEGER,
foreign key (language_id) references book_language(language_id),
foreign key (publisher_id) references publisher(publisher_id)
)
/*
1 example row:
SELECT * FROM book LIMIT 1;
book_id || title || isbn13 ||language_id ||num_pages ||publication_date ||publisher_id
1 ||The World's First Love: Mary Mother of God ||8987059752 || 2 || 276 || 1996-09-01 || 1010
*/
/* column definitions {
"book_id": "the unique identifier of the book",
"title": "the title of the book ",
"isbn13": "the International Standard Book Number of the book",
"language_id": "the id of the book language\nMaps to book_language (language_id)",
"num_pages": "the number of the pages",
"publication_date": "the publication date of the book",
"publisher_id": "the id of the publisher\nMaps to publisher (publisher_id)"
}*/
CREATE TABLE book_author
(
book_id INTEGER,
author_id INTEGER,
primary key (book_id, author_id),
foreign key (author_id) references author(author_id),
foreign key (book_id) references book(book_id)
)
/*
1 example row:
SELECT * FROM book_author LIMIT 1;
book_id ||author_id
10539 || 1
*/
/* column definitions {
"book_id": "the id of the book\nMaps to book(book_id)",
"author_id": "the id of the author\nMaps to author(author_id)"
}*/
CREATE TABLE shipping_method
(
method_id INTEGER
primary key,
method_name TEXT,
cost REAL
)
/*
1 example row:
SELECT * FROM shipping_method LIMIT 1;
method_id ||method_name ||cost
1 || Standard || 5.9
*/
/* column definitions {
"method_id": "the unique identifier of the method",
"method_name": "the method name",
"cost": "the cost of the shipping method"
}*/
CREATE TABLE "cust_order"
(
order_id INTEGER
primary key autoincrement,
order_date DATETIME,
customer_id INTEGER
references customer,
shipping_method_id INTEGER
references shipping_method,
dest_address_id INTEGER
references address
)
/*
1 example row:
SELECT * FROM cust_order LIMIT 1;
order_id || order_date ||customer_id ||shipping_method_id ||dest_address_id
1 ||2021-07-14 10:47:19 || 387 || 4 || 1
*/
/* column definitions {
"order_id": "the unique identifier of the customer order",
"order_date": "the date of the order",
"customer_id": "the id of the customer\nMaps to customer(customer_Id)",
"shipping_method_id": "the id of the shipping method\nMaps to shipping_method(method_id)",
"dest_address_id": "the id of the destination address\nMaps to address(address_id)"
}*/
CREATE TABLE "order_history"
(
history_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
status_id INTEGER
references order_status,
status_date DATETIME
)
/*
1 example row:
SELECT * FROM order_history LIMIT 1;
history_id ||order_id ||status_id || status_date
1 || 1 || 1 ||2021-07-14 17:04:28
*/
/* column definitions {
"history_id": "the unique identifier of the order history",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"status_id": "the id of the order\nMaps to order_status(status_id)",
"status_date": "the date of the status updated "
}*/
CREATE TABLE "order_line"
(
line_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
book_id INTEGER
references book,
price REAL
)
/*
1 example row:
SELECT * FROM order_line LIMIT 1;
line_id ||order_id ||book_id ||price
1024 || 2051 || 10720 || 3.19
*/
/* column definitions {
"line_id": "the unique identifier of the order line",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"book_id": "the id of the book\nMaps to book(book_id)",
"price": "the price of the order"
}*/
|
5,928 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE address_status
(
status_id INTEGER
primary key,
address_status TEXT
)
/*
1 example row:
SELECT * FROM address_status LIMIT 1;
status_id ||address_status
1 || Active
*/
/* column definitions {
"status_id": "the unique identifier of the status",
"address_status": "the status of the address"
}*/
CREATE TABLE author
(
author_id INTEGER
primary key,
author_name TEXT
)
/*
1 example row:
SELECT * FROM author LIMIT 1;
author_id || author_name
1 ||A. Bartlett Giamatti
*/
/* column definitions {
"author_id": "the unique identifier of the author",
"author_name": "the name of the author"
}*/
CREATE TABLE book_language
(
language_id INTEGER
primary key,
language_code TEXT,
language_name TEXT
)
/*
1 example row:
SELECT * FROM book_language LIMIT 1;
language_id ||language_code ||language_name
1 || eng || English
*/
/* column definitions {
"language_id": "the unique identifier of the language ",
"language_code": "the language code",
"language_name": "the language name"
}*/
CREATE TABLE country
(
country_id INTEGER
primary key,
country_name TEXT
)
/*
1 example row:
SELECT * FROM country LIMIT 1;
country_id ||country_name
1 || Afghanistan
*/
/* column definitions {
"country_id": "the unique identifier of the country",
"country_name": "the country name"
}*/
CREATE TABLE address
(
address_id INTEGER
primary key,
street_number TEXT,
street_name TEXT,
city TEXT,
country_id INTEGER,
foreign key (country_id) references country(country_id)
)
/*
1 example row:
SELECT * FROM address LIMIT 1;
address_id ||street_number || street_name || city ||country_id
1 || 57 ||Glacier Hill Avenue ||Torbat-e Jām || 95
*/
/* column definitions {
"address_id": "the unique identifier of the address",
"street_number": "the street number of the address",
"street_name": "the street name",
"city": "the city where the address belongs",
"country_id": "the id of the country where the address belongs "
}*/
CREATE TABLE customer
(
customer_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
email TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
customer_id ||first_name ||last_name || email
1 || Ursola || Purdy ||upurdy0@cdbaby.com
*/
/* column definitions {
"customer_id": "the unique identifier of the customer",
"first_name": "the first name of the customer",
"last_name": "the last name of the customer",
"email": "the email of the customer"
}*/
CREATE TABLE customer_address
(
customer_id INTEGER,
address_id INTEGER,
status_id INTEGER,
primary key (customer_id, address_id),
foreign key (address_id) references address(address_id),
foreign key (customer_id) references customer(customer_id)
)
/*
1 example row:
SELECT * FROM customer_address LIMIT 1;
customer_id ||address_id ||status_id
1 || 606 || 1
*/
/* column definitions {
"customer_id": "the id of the customer\nMaps to customer(customer_id)",
"address_id": "the id of the address\nMaps to address(address_id)",
"status_id": "the id of the address status"
}*/
CREATE TABLE order_status
(
status_id INTEGER
primary key,
status_value TEXT
)
/*
1 example row:
SELECT * FROM order_status LIMIT 1;
status_id || status_value
1 ||Order Received
*/
/* column definitions {
"status_id": "the unique identifier of the order status",
"status_value": "the status value"
}*/
CREATE TABLE publisher
(
publisher_id INTEGER
primary key,
publisher_name TEXT
)
/*
1 example row:
SELECT * FROM publisher LIMIT 1;
publisher_id ||publisher_name
1 || 10/18
*/
/* column definitions {
"publisher_id": "the unique identifier of the publisher",
"publisher_name": "the name of the publisher"
}*/
CREATE TABLE book
(
book_id INTEGER
primary key,
title TEXT,
isbn13 TEXT,
language_id INTEGER,
num_pages INTEGER,
publication_date DATE,
publisher_id INTEGER,
foreign key (language_id) references book_language(language_id),
foreign key (publisher_id) references publisher(publisher_id)
)
/*
1 example row:
SELECT * FROM book LIMIT 1;
book_id || title || isbn13 ||language_id ||num_pages ||publication_date ||publisher_id
1 ||The World's First Love: Mary Mother of God ||8987059752 || 2 || 276 || 1996-09-01 || 1010
*/
/* column definitions {
"book_id": "the unique identifier of the book",
"title": "the title of the book ",
"isbn13": "the International Standard Book Number of the book",
"language_id": "the id of the book language\nMaps to book_language (language_id)",
"num_pages": "the number of the pages",
"publication_date": "the publication date of the book",
"publisher_id": "the id of the publisher\nMaps to publisher (publisher_id)"
}*/
CREATE TABLE book_author
(
book_id INTEGER,
author_id INTEGER,
primary key (book_id, author_id),
foreign key (author_id) references author(author_id),
foreign key (book_id) references book(book_id)
)
/*
1 example row:
SELECT * FROM book_author LIMIT 1;
book_id ||author_id
10539 || 1
*/
/* column definitions {
"book_id": "the id of the book\nMaps to book(book_id)",
"author_id": "the id of the author\nMaps to author(author_id)"
}*/
CREATE TABLE shipping_method
(
method_id INTEGER
primary key,
method_name TEXT,
cost REAL
)
/*
1 example row:
SELECT * FROM shipping_method LIMIT 1;
method_id ||method_name ||cost
1 || Standard || 5.9
*/
/* column definitions {
"method_id": "the unique identifier of the method",
"method_name": "the method name",
"cost": "the cost of the shipping method"
}*/
CREATE TABLE "cust_order"
(
order_id INTEGER
primary key autoincrement,
order_date DATETIME,
customer_id INTEGER
references customer,
shipping_method_id INTEGER
references shipping_method,
dest_address_id INTEGER
references address
)
/*
1 example row:
SELECT * FROM cust_order LIMIT 1;
order_id || order_date ||customer_id ||shipping_method_id ||dest_address_id
1 ||2021-07-14 10:47:19 || 387 || 4 || 1
*/
/* column definitions {
"order_id": "the unique identifier of the customer order",
"order_date": "the date of the order",
"customer_id": "the id of the customer\nMaps to customer(customer_Id)",
"shipping_method_id": "the id of the shipping method\nMaps to shipping_method(method_id)",
"dest_address_id": "the id of the destination address\nMaps to address(address_id)"
}*/
CREATE TABLE "order_history"
(
history_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
status_id INTEGER
references order_status,
status_date DATETIME
)
/*
1 example row:
SELECT * FROM order_history LIMIT 1;
history_id ||order_id ||status_id || status_date
1 || 1 || 1 ||2021-07-14 17:04:28
*/
/* column definitions {
"history_id": "the unique identifier of the order history",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"status_id": "the id of the order\nMaps to order_status(status_id)",
"status_date": "the date of the status updated "
}*/
CREATE TABLE "order_line"
(
line_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
book_id INTEGER
references book,
price REAL
)
/*
1 example row:
SELECT * FROM order_line LIMIT 1;
line_id ||order_id ||book_id ||price
1024 || 2051 || 10720 || 3.19
*/
/* column definitions {
"line_id": "the unique identifier of the order line",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"book_id": "the id of the book\nMaps to book(book_id)",
"price": "the price of the order"
}*/
### Question
Which city does the address id 547 belong to?
Clarification:
| [query_database(**{'query': 'SELECT city FROM address WHERE address_id = 547'})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE address_status
(
status_id INTEGER
primary key,
address_status TEXT
)
/*
1 example row:
SELECT * FROM address_status LIMIT 1;
status_id ||address_status
1 || Active
*/
/* column definitions {
"status_id": "the unique identifier of the status",
"address_status": "the status of the address"
}*/
CREATE TABLE author
(
author_id INTEGER
primary key,
author_name TEXT
)
/*
1 example row:
SELECT * FROM author LIMIT 1;
author_id || author_name
1 ||A. Bartlett Giamatti
*/
/* column definitions {
"author_id": "the unique identifier of the author",
"author_name": "the name of the author"
}*/
CREATE TABLE book_language
(
language_id INTEGER
primary key,
language_code TEXT,
language_name TEXT
)
/*
1 example row:
SELECT * FROM book_language LIMIT 1;
language_id ||language_code ||language_name
1 || eng || English
*/
/* column definitions {
"language_id": "the unique identifier of the language ",
"language_code": "the language code",
"language_name": "the language name"
}*/
CREATE TABLE country
(
country_id INTEGER
primary key,
country_name TEXT
)
/*
1 example row:
SELECT * FROM country LIMIT 1;
country_id ||country_name
1 || Afghanistan
*/
/* column definitions {
"country_id": "the unique identifier of the country",
"country_name": "the country name"
}*/
CREATE TABLE address
(
address_id INTEGER
primary key,
street_number TEXT,
street_name TEXT,
city TEXT,
country_id INTEGER,
foreign key (country_id) references country(country_id)
)
/*
1 example row:
SELECT * FROM address LIMIT 1;
address_id ||street_number || street_name || city ||country_id
1 || 57 ||Glacier Hill Avenue ||Torbat-e Jām || 95
*/
/* column definitions {
"address_id": "the unique identifier of the address",
"street_number": "the street number of the address",
"street_name": "the street name",
"city": "the city where the address belongs",
"country_id": "the id of the country where the address belongs "
}*/
CREATE TABLE customer
(
customer_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
email TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
customer_id ||first_name ||last_name || email
1 || Ursola || Purdy ||upurdy0@cdbaby.com
*/
/* column definitions {
"customer_id": "the unique identifier of the customer",
"first_name": "the first name of the customer",
"last_name": "the last name of the customer",
"email": "the email of the customer"
}*/
CREATE TABLE customer_address
(
customer_id INTEGER,
address_id INTEGER,
status_id INTEGER,
primary key (customer_id, address_id),
foreign key (address_id) references address(address_id),
foreign key (customer_id) references customer(customer_id)
)
/*
1 example row:
SELECT * FROM customer_address LIMIT 1;
customer_id ||address_id ||status_id
1 || 606 || 1
*/
/* column definitions {
"customer_id": "the id of the customer\nMaps to customer(customer_id)",
"address_id": "the id of the address\nMaps to address(address_id)",
"status_id": "the id of the address status"
}*/
CREATE TABLE order_status
(
status_id INTEGER
primary key,
status_value TEXT
)
/*
1 example row:
SELECT * FROM order_status LIMIT 1;
status_id || status_value
1 ||Order Received
*/
/* column definitions {
"status_id": "the unique identifier of the order status",
"status_value": "the status value"
}*/
CREATE TABLE publisher
(
publisher_id INTEGER
primary key,
publisher_name TEXT
)
/*
1 example row:
SELECT * FROM publisher LIMIT 1;
publisher_id ||publisher_name
1 || 10/18
*/
/* column definitions {
"publisher_id": "the unique identifier of the publisher",
"publisher_name": "the name of the publisher"
}*/
CREATE TABLE book
(
book_id INTEGER
primary key,
title TEXT,
isbn13 TEXT,
language_id INTEGER,
num_pages INTEGER,
publication_date DATE,
publisher_id INTEGER,
foreign key (language_id) references book_language(language_id),
foreign key (publisher_id) references publisher(publisher_id)
)
/*
1 example row:
SELECT * FROM book LIMIT 1;
book_id || title || isbn13 ||language_id ||num_pages ||publication_date ||publisher_id
1 ||The World's First Love: Mary Mother of God ||8987059752 || 2 || 276 || 1996-09-01 || 1010
*/
/* column definitions {
"book_id": "the unique identifier of the book",
"title": "the title of the book ",
"isbn13": "the International Standard Book Number of the book",
"language_id": "the id of the book language\nMaps to book_language (language_id)",
"num_pages": "the number of the pages",
"publication_date": "the publication date of the book",
"publisher_id": "the id of the publisher\nMaps to publisher (publisher_id)"
}*/
CREATE TABLE book_author
(
book_id INTEGER,
author_id INTEGER,
primary key (book_id, author_id),
foreign key (author_id) references author(author_id),
foreign key (book_id) references book(book_id)
)
/*
1 example row:
SELECT * FROM book_author LIMIT 1;
book_id ||author_id
10539 || 1
*/
/* column definitions {
"book_id": "the id of the book\nMaps to book(book_id)",
"author_id": "the id of the author\nMaps to author(author_id)"
}*/
CREATE TABLE shipping_method
(
method_id INTEGER
primary key,
method_name TEXT,
cost REAL
)
/*
1 example row:
SELECT * FROM shipping_method LIMIT 1;
method_id ||method_name ||cost
1 || Standard || 5.9
*/
/* column definitions {
"method_id": "the unique identifier of the method",
"method_name": "the method name",
"cost": "the cost of the shipping method"
}*/
CREATE TABLE "cust_order"
(
order_id INTEGER
primary key autoincrement,
order_date DATETIME,
customer_id INTEGER
references customer,
shipping_method_id INTEGER
references shipping_method,
dest_address_id INTEGER
references address
)
/*
1 example row:
SELECT * FROM cust_order LIMIT 1;
order_id || order_date ||customer_id ||shipping_method_id ||dest_address_id
1 ||2021-07-14 10:47:19 || 387 || 4 || 1
*/
/* column definitions {
"order_id": "the unique identifier of the customer order",
"order_date": "the date of the order",
"customer_id": "the id of the customer\nMaps to customer(customer_Id)",
"shipping_method_id": "the id of the shipping method\nMaps to shipping_method(method_id)",
"dest_address_id": "the id of the destination address\nMaps to address(address_id)"
}*/
CREATE TABLE "order_history"
(
history_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
status_id INTEGER
references order_status,
status_date DATETIME
)
/*
1 example row:
SELECT * FROM order_history LIMIT 1;
history_id ||order_id ||status_id || status_date
1 || 1 || 1 ||2021-07-14 17:04:28
*/
/* column definitions {
"history_id": "the unique identifier of the order history",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"status_id": "the id of the order\nMaps to order_status(status_id)",
"status_date": "the date of the status updated "
}*/
CREATE TABLE "order_line"
(
line_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
book_id INTEGER
references book,
price REAL
)
/*
1 example row:
SELECT * FROM order_line LIMIT 1;
line_id ||order_id ||book_id ||price
1024 || 2051 || 10720 || 3.19
*/
/* column definitions {
"line_id": "the unique identifier of the order line",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"book_id": "the id of the book\nMaps to book(book_id)",
"price": "the price of the order"
}*/
|
5,932 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE address_status
(
status_id INTEGER
primary key,
address_status TEXT
)
/*
1 example row:
SELECT * FROM address_status LIMIT 1;
status_id ||address_status
1 || Active
*/
/* column definitions {
"status_id": "the unique identifier of the status",
"address_status": "the status of the address"
}*/
CREATE TABLE author
(
author_id INTEGER
primary key,
author_name TEXT
)
/*
1 example row:
SELECT * FROM author LIMIT 1;
author_id || author_name
1 ||A. Bartlett Giamatti
*/
/* column definitions {
"author_id": "the unique identifier of the author",
"author_name": "the name of the author"
}*/
CREATE TABLE book_language
(
language_id INTEGER
primary key,
language_code TEXT,
language_name TEXT
)
/*
1 example row:
SELECT * FROM book_language LIMIT 1;
language_id ||language_code ||language_name
1 || eng || English
*/
/* column definitions {
"language_id": "the unique identifier of the language ",
"language_code": "the language code",
"language_name": "the language name"
}*/
CREATE TABLE country
(
country_id INTEGER
primary key,
country_name TEXT
)
/*
1 example row:
SELECT * FROM country LIMIT 1;
country_id ||country_name
1 || Afghanistan
*/
/* column definitions {
"country_id": "the unique identifier of the country",
"country_name": "the country name"
}*/
CREATE TABLE address
(
address_id INTEGER
primary key,
street_number TEXT,
street_name TEXT,
city TEXT,
country_id INTEGER,
foreign key (country_id) references country(country_id)
)
/*
1 example row:
SELECT * FROM address LIMIT 1;
address_id ||street_number || street_name || city ||country_id
1 || 57 ||Glacier Hill Avenue ||Torbat-e Jām || 95
*/
/* column definitions {
"address_id": "the unique identifier of the address",
"street_number": "the street number of the address",
"street_name": "the street name",
"city": "the city where the address belongs",
"country_id": "the id of the country where the address belongs "
}*/
CREATE TABLE customer
(
customer_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
email TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
customer_id ||first_name ||last_name || email
1 || Ursola || Purdy ||upurdy0@cdbaby.com
*/
/* column definitions {
"customer_id": "the unique identifier of the customer",
"first_name": "the first name of the customer",
"last_name": "the last name of the customer",
"email": "the email of the customer"
}*/
CREATE TABLE customer_address
(
customer_id INTEGER,
address_id INTEGER,
status_id INTEGER,
primary key (customer_id, address_id),
foreign key (address_id) references address(address_id),
foreign key (customer_id) references customer(customer_id)
)
/*
1 example row:
SELECT * FROM customer_address LIMIT 1;
customer_id ||address_id ||status_id
1 || 606 || 1
*/
/* column definitions {
"customer_id": "the id of the customer\nMaps to customer(customer_id)",
"address_id": "the id of the address\nMaps to address(address_id)",
"status_id": "the id of the address status"
}*/
CREATE TABLE order_status
(
status_id INTEGER
primary key,
status_value TEXT
)
/*
1 example row:
SELECT * FROM order_status LIMIT 1;
status_id || status_value
1 ||Order Received
*/
/* column definitions {
"status_id": "the unique identifier of the order status",
"status_value": "the status value"
}*/
CREATE TABLE publisher
(
publisher_id INTEGER
primary key,
publisher_name TEXT
)
/*
1 example row:
SELECT * FROM publisher LIMIT 1;
publisher_id ||publisher_name
1 || 10/18
*/
/* column definitions {
"publisher_id": "the unique identifier of the publisher",
"publisher_name": "the name of the publisher"
}*/
CREATE TABLE book
(
book_id INTEGER
primary key,
title TEXT,
isbn13 TEXT,
language_id INTEGER,
num_pages INTEGER,
publication_date DATE,
publisher_id INTEGER,
foreign key (language_id) references book_language(language_id),
foreign key (publisher_id) references publisher(publisher_id)
)
/*
1 example row:
SELECT * FROM book LIMIT 1;
book_id || title || isbn13 ||language_id ||num_pages ||publication_date ||publisher_id
1 ||The World's First Love: Mary Mother of God ||8987059752 || 2 || 276 || 1996-09-01 || 1010
*/
/* column definitions {
"book_id": "the unique identifier of the book",
"title": "the title of the book ",
"isbn13": "the International Standard Book Number of the book",
"language_id": "the id of the book language\nMaps to book_language (language_id)",
"num_pages": "the number of the pages",
"publication_date": "the publication date of the book",
"publisher_id": "the id of the publisher\nMaps to publisher (publisher_id)"
}*/
CREATE TABLE book_author
(
book_id INTEGER,
author_id INTEGER,
primary key (book_id, author_id),
foreign key (author_id) references author(author_id),
foreign key (book_id) references book(book_id)
)
/*
1 example row:
SELECT * FROM book_author LIMIT 1;
book_id ||author_id
10539 || 1
*/
/* column definitions {
"book_id": "the id of the book\nMaps to book(book_id)",
"author_id": "the id of the author\nMaps to author(author_id)"
}*/
CREATE TABLE shipping_method
(
method_id INTEGER
primary key,
method_name TEXT,
cost REAL
)
/*
1 example row:
SELECT * FROM shipping_method LIMIT 1;
method_id ||method_name ||cost
1 || Standard || 5.9
*/
/* column definitions {
"method_id": "the unique identifier of the method",
"method_name": "the method name",
"cost": "the cost of the shipping method"
}*/
CREATE TABLE "cust_order"
(
order_id INTEGER
primary key autoincrement,
order_date DATETIME,
customer_id INTEGER
references customer,
shipping_method_id INTEGER
references shipping_method,
dest_address_id INTEGER
references address
)
/*
1 example row:
SELECT * FROM cust_order LIMIT 1;
order_id || order_date ||customer_id ||shipping_method_id ||dest_address_id
1 ||2021-07-14 10:47:19 || 387 || 4 || 1
*/
/* column definitions {
"order_id": "the unique identifier of the customer order",
"order_date": "the date of the order",
"customer_id": "the id of the customer\nMaps to customer(customer_Id)",
"shipping_method_id": "the id of the shipping method\nMaps to shipping_method(method_id)",
"dest_address_id": "the id of the destination address\nMaps to address(address_id)"
}*/
CREATE TABLE "order_history"
(
history_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
status_id INTEGER
references order_status,
status_date DATETIME
)
/*
1 example row:
SELECT * FROM order_history LIMIT 1;
history_id ||order_id ||status_id || status_date
1 || 1 || 1 ||2021-07-14 17:04:28
*/
/* column definitions {
"history_id": "the unique identifier of the order history",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"status_id": "the id of the order\nMaps to order_status(status_id)",
"status_date": "the date of the status updated "
}*/
CREATE TABLE "order_line"
(
line_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
book_id INTEGER
references book,
price REAL
)
/*
1 example row:
SELECT * FROM order_line LIMIT 1;
line_id ||order_id ||book_id ||price
1024 || 2051 || 10720 || 3.19
*/
/* column definitions {
"line_id": "the unique identifier of the order line",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"book_id": "the id of the book\nMaps to book(book_id)",
"price": "the price of the order"
}*/
### Question
How many books were published by Kensington?
Clarification: "Kensington" is the publisher_name;
| [query_database(**{'query': 'SELECT COUNT(T1.book_id) FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T2.publisher_name = 'Kensington''})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE address_status
(
status_id INTEGER
primary key,
address_status TEXT
)
/*
1 example row:
SELECT * FROM address_status LIMIT 1;
status_id ||address_status
1 || Active
*/
/* column definitions {
"status_id": "the unique identifier of the status",
"address_status": "the status of the address"
}*/
CREATE TABLE author
(
author_id INTEGER
primary key,
author_name TEXT
)
/*
1 example row:
SELECT * FROM author LIMIT 1;
author_id || author_name
1 ||A. Bartlett Giamatti
*/
/* column definitions {
"author_id": "the unique identifier of the author",
"author_name": "the name of the author"
}*/
CREATE TABLE book_language
(
language_id INTEGER
primary key,
language_code TEXT,
language_name TEXT
)
/*
1 example row:
SELECT * FROM book_language LIMIT 1;
language_id ||language_code ||language_name
1 || eng || English
*/
/* column definitions {
"language_id": "the unique identifier of the language ",
"language_code": "the language code",
"language_name": "the language name"
}*/
CREATE TABLE country
(
country_id INTEGER
primary key,
country_name TEXT
)
/*
1 example row:
SELECT * FROM country LIMIT 1;
country_id ||country_name
1 || Afghanistan
*/
/* column definitions {
"country_id": "the unique identifier of the country",
"country_name": "the country name"
}*/
CREATE TABLE address
(
address_id INTEGER
primary key,
street_number TEXT,
street_name TEXT,
city TEXT,
country_id INTEGER,
foreign key (country_id) references country(country_id)
)
/*
1 example row:
SELECT * FROM address LIMIT 1;
address_id ||street_number || street_name || city ||country_id
1 || 57 ||Glacier Hill Avenue ||Torbat-e Jām || 95
*/
/* column definitions {
"address_id": "the unique identifier of the address",
"street_number": "the street number of the address",
"street_name": "the street name",
"city": "the city where the address belongs",
"country_id": "the id of the country where the address belongs "
}*/
CREATE TABLE customer
(
customer_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
email TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
customer_id ||first_name ||last_name || email
1 || Ursola || Purdy ||upurdy0@cdbaby.com
*/
/* column definitions {
"customer_id": "the unique identifier of the customer",
"first_name": "the first name of the customer",
"last_name": "the last name of the customer",
"email": "the email of the customer"
}*/
CREATE TABLE customer_address
(
customer_id INTEGER,
address_id INTEGER,
status_id INTEGER,
primary key (customer_id, address_id),
foreign key (address_id) references address(address_id),
foreign key (customer_id) references customer(customer_id)
)
/*
1 example row:
SELECT * FROM customer_address LIMIT 1;
customer_id ||address_id ||status_id
1 || 606 || 1
*/
/* column definitions {
"customer_id": "the id of the customer\nMaps to customer(customer_id)",
"address_id": "the id of the address\nMaps to address(address_id)",
"status_id": "the id of the address status"
}*/
CREATE TABLE order_status
(
status_id INTEGER
primary key,
status_value TEXT
)
/*
1 example row:
SELECT * FROM order_status LIMIT 1;
status_id || status_value
1 ||Order Received
*/
/* column definitions {
"status_id": "the unique identifier of the order status",
"status_value": "the status value"
}*/
CREATE TABLE publisher
(
publisher_id INTEGER
primary key,
publisher_name TEXT
)
/*
1 example row:
SELECT * FROM publisher LIMIT 1;
publisher_id ||publisher_name
1 || 10/18
*/
/* column definitions {
"publisher_id": "the unique identifier of the publisher",
"publisher_name": "the name of the publisher"
}*/
CREATE TABLE book
(
book_id INTEGER
primary key,
title TEXT,
isbn13 TEXT,
language_id INTEGER,
num_pages INTEGER,
publication_date DATE,
publisher_id INTEGER,
foreign key (language_id) references book_language(language_id),
foreign key (publisher_id) references publisher(publisher_id)
)
/*
1 example row:
SELECT * FROM book LIMIT 1;
book_id || title || isbn13 ||language_id ||num_pages ||publication_date ||publisher_id
1 ||The World's First Love: Mary Mother of God ||8987059752 || 2 || 276 || 1996-09-01 || 1010
*/
/* column definitions {
"book_id": "the unique identifier of the book",
"title": "the title of the book ",
"isbn13": "the International Standard Book Number of the book",
"language_id": "the id of the book language\nMaps to book_language (language_id)",
"num_pages": "the number of the pages",
"publication_date": "the publication date of the book",
"publisher_id": "the id of the publisher\nMaps to publisher (publisher_id)"
}*/
CREATE TABLE book_author
(
book_id INTEGER,
author_id INTEGER,
primary key (book_id, author_id),
foreign key (author_id) references author(author_id),
foreign key (book_id) references book(book_id)
)
/*
1 example row:
SELECT * FROM book_author LIMIT 1;
book_id ||author_id
10539 || 1
*/
/* column definitions {
"book_id": "the id of the book\nMaps to book(book_id)",
"author_id": "the id of the author\nMaps to author(author_id)"
}*/
CREATE TABLE shipping_method
(
method_id INTEGER
primary key,
method_name TEXT,
cost REAL
)
/*
1 example row:
SELECT * FROM shipping_method LIMIT 1;
method_id ||method_name ||cost
1 || Standard || 5.9
*/
/* column definitions {
"method_id": "the unique identifier of the method",
"method_name": "the method name",
"cost": "the cost of the shipping method"
}*/
CREATE TABLE "cust_order"
(
order_id INTEGER
primary key autoincrement,
order_date DATETIME,
customer_id INTEGER
references customer,
shipping_method_id INTEGER
references shipping_method,
dest_address_id INTEGER
references address
)
/*
1 example row:
SELECT * FROM cust_order LIMIT 1;
order_id || order_date ||customer_id ||shipping_method_id ||dest_address_id
1 ||2021-07-14 10:47:19 || 387 || 4 || 1
*/
/* column definitions {
"order_id": "the unique identifier of the customer order",
"order_date": "the date of the order",
"customer_id": "the id of the customer\nMaps to customer(customer_Id)",
"shipping_method_id": "the id of the shipping method\nMaps to shipping_method(method_id)",
"dest_address_id": "the id of the destination address\nMaps to address(address_id)"
}*/
CREATE TABLE "order_history"
(
history_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
status_id INTEGER
references order_status,
status_date DATETIME
)
/*
1 example row:
SELECT * FROM order_history LIMIT 1;
history_id ||order_id ||status_id || status_date
1 || 1 || 1 ||2021-07-14 17:04:28
*/
/* column definitions {
"history_id": "the unique identifier of the order history",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"status_id": "the id of the order\nMaps to order_status(status_id)",
"status_date": "the date of the status updated "
}*/
CREATE TABLE "order_line"
(
line_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
book_id INTEGER
references book,
price REAL
)
/*
1 example row:
SELECT * FROM order_line LIMIT 1;
line_id ||order_id ||book_id ||price
1024 || 2051 || 10720 || 3.19
*/
/* column definitions {
"line_id": "the unique identifier of the order line",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"book_id": "the id of the book\nMaps to book(book_id)",
"price": "the price of the order"
}*/
|
5,936 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE address_status
(
status_id INTEGER
primary key,
address_status TEXT
)
/*
1 example row:
SELECT * FROM address_status LIMIT 1;
status_id ||address_status
1 || Active
*/
/* column definitions {
"status_id": "the unique identifier of the status",
"address_status": "the status of the address"
}*/
CREATE TABLE author
(
author_id INTEGER
primary key,
author_name TEXT
)
/*
1 example row:
SELECT * FROM author LIMIT 1;
author_id || author_name
1 ||A. Bartlett Giamatti
*/
/* column definitions {
"author_id": "the unique identifier of the author",
"author_name": "the name of the author"
}*/
CREATE TABLE book_language
(
language_id INTEGER
primary key,
language_code TEXT,
language_name TEXT
)
/*
1 example row:
SELECT * FROM book_language LIMIT 1;
language_id ||language_code ||language_name
1 || eng || English
*/
/* column definitions {
"language_id": "the unique identifier of the language ",
"language_code": "the language code",
"language_name": "the language name"
}*/
CREATE TABLE country
(
country_id INTEGER
primary key,
country_name TEXT
)
/*
1 example row:
SELECT * FROM country LIMIT 1;
country_id ||country_name
1 || Afghanistan
*/
/* column definitions {
"country_id": "the unique identifier of the country",
"country_name": "the country name"
}*/
CREATE TABLE address
(
address_id INTEGER
primary key,
street_number TEXT,
street_name TEXT,
city TEXT,
country_id INTEGER,
foreign key (country_id) references country(country_id)
)
/*
1 example row:
SELECT * FROM address LIMIT 1;
address_id ||street_number || street_name || city ||country_id
1 || 57 ||Glacier Hill Avenue ||Torbat-e Jām || 95
*/
/* column definitions {
"address_id": "the unique identifier of the address",
"street_number": "the street number of the address",
"street_name": "the street name",
"city": "the city where the address belongs",
"country_id": "the id of the country where the address belongs "
}*/
CREATE TABLE customer
(
customer_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
email TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
customer_id ||first_name ||last_name || email
1 || Ursola || Purdy ||upurdy0@cdbaby.com
*/
/* column definitions {
"customer_id": "the unique identifier of the customer",
"first_name": "the first name of the customer",
"last_name": "the last name of the customer",
"email": "the email of the customer"
}*/
CREATE TABLE customer_address
(
customer_id INTEGER,
address_id INTEGER,
status_id INTEGER,
primary key (customer_id, address_id),
foreign key (address_id) references address(address_id),
foreign key (customer_id) references customer(customer_id)
)
/*
1 example row:
SELECT * FROM customer_address LIMIT 1;
customer_id ||address_id ||status_id
1 || 606 || 1
*/
/* column definitions {
"customer_id": "the id of the customer\nMaps to customer(customer_id)",
"address_id": "the id of the address\nMaps to address(address_id)",
"status_id": "the id of the address status"
}*/
CREATE TABLE order_status
(
status_id INTEGER
primary key,
status_value TEXT
)
/*
1 example row:
SELECT * FROM order_status LIMIT 1;
status_id || status_value
1 ||Order Received
*/
/* column definitions {
"status_id": "the unique identifier of the order status",
"status_value": "the status value"
}*/
CREATE TABLE publisher
(
publisher_id INTEGER
primary key,
publisher_name TEXT
)
/*
1 example row:
SELECT * FROM publisher LIMIT 1;
publisher_id ||publisher_name
1 || 10/18
*/
/* column definitions {
"publisher_id": "the unique identifier of the publisher",
"publisher_name": "the name of the publisher"
}*/
CREATE TABLE book
(
book_id INTEGER
primary key,
title TEXT,
isbn13 TEXT,
language_id INTEGER,
num_pages INTEGER,
publication_date DATE,
publisher_id INTEGER,
foreign key (language_id) references book_language(language_id),
foreign key (publisher_id) references publisher(publisher_id)
)
/*
1 example row:
SELECT * FROM book LIMIT 1;
book_id || title || isbn13 ||language_id ||num_pages ||publication_date ||publisher_id
1 ||The World's First Love: Mary Mother of God ||8987059752 || 2 || 276 || 1996-09-01 || 1010
*/
/* column definitions {
"book_id": "the unique identifier of the book",
"title": "the title of the book ",
"isbn13": "the International Standard Book Number of the book",
"language_id": "the id of the book language\nMaps to book_language (language_id)",
"num_pages": "the number of the pages",
"publication_date": "the publication date of the book",
"publisher_id": "the id of the publisher\nMaps to publisher (publisher_id)"
}*/
CREATE TABLE book_author
(
book_id INTEGER,
author_id INTEGER,
primary key (book_id, author_id),
foreign key (author_id) references author(author_id),
foreign key (book_id) references book(book_id)
)
/*
1 example row:
SELECT * FROM book_author LIMIT 1;
book_id ||author_id
10539 || 1
*/
/* column definitions {
"book_id": "the id of the book\nMaps to book(book_id)",
"author_id": "the id of the author\nMaps to author(author_id)"
}*/
CREATE TABLE shipping_method
(
method_id INTEGER
primary key,
method_name TEXT,
cost REAL
)
/*
1 example row:
SELECT * FROM shipping_method LIMIT 1;
method_id ||method_name ||cost
1 || Standard || 5.9
*/
/* column definitions {
"method_id": "the unique identifier of the method",
"method_name": "the method name",
"cost": "the cost of the shipping method"
}*/
CREATE TABLE "cust_order"
(
order_id INTEGER
primary key autoincrement,
order_date DATETIME,
customer_id INTEGER
references customer,
shipping_method_id INTEGER
references shipping_method,
dest_address_id INTEGER
references address
)
/*
1 example row:
SELECT * FROM cust_order LIMIT 1;
order_id || order_date ||customer_id ||shipping_method_id ||dest_address_id
1 ||2021-07-14 10:47:19 || 387 || 4 || 1
*/
/* column definitions {
"order_id": "the unique identifier of the customer order",
"order_date": "the date of the order",
"customer_id": "the id of the customer\nMaps to customer(customer_Id)",
"shipping_method_id": "the id of the shipping method\nMaps to shipping_method(method_id)",
"dest_address_id": "the id of the destination address\nMaps to address(address_id)"
}*/
CREATE TABLE "order_history"
(
history_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
status_id INTEGER
references order_status,
status_date DATETIME
)
/*
1 example row:
SELECT * FROM order_history LIMIT 1;
history_id ||order_id ||status_id || status_date
1 || 1 || 1 ||2021-07-14 17:04:28
*/
/* column definitions {
"history_id": "the unique identifier of the order history",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"status_id": "the id of the order\nMaps to order_status(status_id)",
"status_date": "the date of the status updated "
}*/
CREATE TABLE "order_line"
(
line_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
book_id INTEGER
references book,
price REAL
)
/*
1 example row:
SELECT * FROM order_line LIMIT 1;
line_id ||order_id ||book_id ||price
1024 || 2051 || 10720 || 3.19
*/
/* column definitions {
"line_id": "the unique identifier of the order line",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"book_id": "the id of the book\nMaps to book(book_id)",
"price": "the price of the order"
}*/
### Question
How many books did David Foster Wallace write?
Clarification: "David Foster Wallace" is the author_name;
| [query_database(**{'query': 'SELECT COUNT(T1.title) FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id WHERE T3.author_name = 'David Foster Wallace''})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE address_status
(
status_id INTEGER
primary key,
address_status TEXT
)
/*
1 example row:
SELECT * FROM address_status LIMIT 1;
status_id ||address_status
1 || Active
*/
/* column definitions {
"status_id": "the unique identifier of the status",
"address_status": "the status of the address"
}*/
CREATE TABLE author
(
author_id INTEGER
primary key,
author_name TEXT
)
/*
1 example row:
SELECT * FROM author LIMIT 1;
author_id || author_name
1 ||A. Bartlett Giamatti
*/
/* column definitions {
"author_id": "the unique identifier of the author",
"author_name": "the name of the author"
}*/
CREATE TABLE book_language
(
language_id INTEGER
primary key,
language_code TEXT,
language_name TEXT
)
/*
1 example row:
SELECT * FROM book_language LIMIT 1;
language_id ||language_code ||language_name
1 || eng || English
*/
/* column definitions {
"language_id": "the unique identifier of the language ",
"language_code": "the language code",
"language_name": "the language name"
}*/
CREATE TABLE country
(
country_id INTEGER
primary key,
country_name TEXT
)
/*
1 example row:
SELECT * FROM country LIMIT 1;
country_id ||country_name
1 || Afghanistan
*/
/* column definitions {
"country_id": "the unique identifier of the country",
"country_name": "the country name"
}*/
CREATE TABLE address
(
address_id INTEGER
primary key,
street_number TEXT,
street_name TEXT,
city TEXT,
country_id INTEGER,
foreign key (country_id) references country(country_id)
)
/*
1 example row:
SELECT * FROM address LIMIT 1;
address_id ||street_number || street_name || city ||country_id
1 || 57 ||Glacier Hill Avenue ||Torbat-e Jām || 95
*/
/* column definitions {
"address_id": "the unique identifier of the address",
"street_number": "the street number of the address",
"street_name": "the street name",
"city": "the city where the address belongs",
"country_id": "the id of the country where the address belongs "
}*/
CREATE TABLE customer
(
customer_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
email TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
customer_id ||first_name ||last_name || email
1 || Ursola || Purdy ||upurdy0@cdbaby.com
*/
/* column definitions {
"customer_id": "the unique identifier of the customer",
"first_name": "the first name of the customer",
"last_name": "the last name of the customer",
"email": "the email of the customer"
}*/
CREATE TABLE customer_address
(
customer_id INTEGER,
address_id INTEGER,
status_id INTEGER,
primary key (customer_id, address_id),
foreign key (address_id) references address(address_id),
foreign key (customer_id) references customer(customer_id)
)
/*
1 example row:
SELECT * FROM customer_address LIMIT 1;
customer_id ||address_id ||status_id
1 || 606 || 1
*/
/* column definitions {
"customer_id": "the id of the customer\nMaps to customer(customer_id)",
"address_id": "the id of the address\nMaps to address(address_id)",
"status_id": "the id of the address status"
}*/
CREATE TABLE order_status
(
status_id INTEGER
primary key,
status_value TEXT
)
/*
1 example row:
SELECT * FROM order_status LIMIT 1;
status_id || status_value
1 ||Order Received
*/
/* column definitions {
"status_id": "the unique identifier of the order status",
"status_value": "the status value"
}*/
CREATE TABLE publisher
(
publisher_id INTEGER
primary key,
publisher_name TEXT
)
/*
1 example row:
SELECT * FROM publisher LIMIT 1;
publisher_id ||publisher_name
1 || 10/18
*/
/* column definitions {
"publisher_id": "the unique identifier of the publisher",
"publisher_name": "the name of the publisher"
}*/
CREATE TABLE book
(
book_id INTEGER
primary key,
title TEXT,
isbn13 TEXT,
language_id INTEGER,
num_pages INTEGER,
publication_date DATE,
publisher_id INTEGER,
foreign key (language_id) references book_language(language_id),
foreign key (publisher_id) references publisher(publisher_id)
)
/*
1 example row:
SELECT * FROM book LIMIT 1;
book_id || title || isbn13 ||language_id ||num_pages ||publication_date ||publisher_id
1 ||The World's First Love: Mary Mother of God ||8987059752 || 2 || 276 || 1996-09-01 || 1010
*/
/* column definitions {
"book_id": "the unique identifier of the book",
"title": "the title of the book ",
"isbn13": "the International Standard Book Number of the book",
"language_id": "the id of the book language\nMaps to book_language (language_id)",
"num_pages": "the number of the pages",
"publication_date": "the publication date of the book",
"publisher_id": "the id of the publisher\nMaps to publisher (publisher_id)"
}*/
CREATE TABLE book_author
(
book_id INTEGER,
author_id INTEGER,
primary key (book_id, author_id),
foreign key (author_id) references author(author_id),
foreign key (book_id) references book(book_id)
)
/*
1 example row:
SELECT * FROM book_author LIMIT 1;
book_id ||author_id
10539 || 1
*/
/* column definitions {
"book_id": "the id of the book\nMaps to book(book_id)",
"author_id": "the id of the author\nMaps to author(author_id)"
}*/
CREATE TABLE shipping_method
(
method_id INTEGER
primary key,
method_name TEXT,
cost REAL
)
/*
1 example row:
SELECT * FROM shipping_method LIMIT 1;
method_id ||method_name ||cost
1 || Standard || 5.9
*/
/* column definitions {
"method_id": "the unique identifier of the method",
"method_name": "the method name",
"cost": "the cost of the shipping method"
}*/
CREATE TABLE "cust_order"
(
order_id INTEGER
primary key autoincrement,
order_date DATETIME,
customer_id INTEGER
references customer,
shipping_method_id INTEGER
references shipping_method,
dest_address_id INTEGER
references address
)
/*
1 example row:
SELECT * FROM cust_order LIMIT 1;
order_id || order_date ||customer_id ||shipping_method_id ||dest_address_id
1 ||2021-07-14 10:47:19 || 387 || 4 || 1
*/
/* column definitions {
"order_id": "the unique identifier of the customer order",
"order_date": "the date of the order",
"customer_id": "the id of the customer\nMaps to customer(customer_Id)",
"shipping_method_id": "the id of the shipping method\nMaps to shipping_method(method_id)",
"dest_address_id": "the id of the destination address\nMaps to address(address_id)"
}*/
CREATE TABLE "order_history"
(
history_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
status_id INTEGER
references order_status,
status_date DATETIME
)
/*
1 example row:
SELECT * FROM order_history LIMIT 1;
history_id ||order_id ||status_id || status_date
1 || 1 || 1 ||2021-07-14 17:04:28
*/
/* column definitions {
"history_id": "the unique identifier of the order history",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"status_id": "the id of the order\nMaps to order_status(status_id)",
"status_date": "the date of the status updated "
}*/
CREATE TABLE "order_line"
(
line_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
book_id INTEGER
references book,
price REAL
)
/*
1 example row:
SELECT * FROM order_line LIMIT 1;
line_id ||order_id ||book_id ||price
1024 || 2051 || 10720 || 3.19
*/
/* column definitions {
"line_id": "the unique identifier of the order line",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"book_id": "the id of the book\nMaps to book(book_id)",
"price": "the price of the order"
}*/
|
5,940 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE address_status
(
status_id INTEGER
primary key,
address_status TEXT
)
/*
1 example row:
SELECT * FROM address_status LIMIT 1;
status_id ||address_status
1 || Active
*/
/* column definitions {
"status_id": "the unique identifier of the status",
"address_status": "the status of the address"
}*/
CREATE TABLE author
(
author_id INTEGER
primary key,
author_name TEXT
)
/*
1 example row:
SELECT * FROM author LIMIT 1;
author_id || author_name
1 ||A. Bartlett Giamatti
*/
/* column definitions {
"author_id": "the unique identifier of the author",
"author_name": "the name of the author"
}*/
CREATE TABLE book_language
(
language_id INTEGER
primary key,
language_code TEXT,
language_name TEXT
)
/*
1 example row:
SELECT * FROM book_language LIMIT 1;
language_id ||language_code ||language_name
1 || eng || English
*/
/* column definitions {
"language_id": "the unique identifier of the language ",
"language_code": "the language code",
"language_name": "the language name"
}*/
CREATE TABLE country
(
country_id INTEGER
primary key,
country_name TEXT
)
/*
1 example row:
SELECT * FROM country LIMIT 1;
country_id ||country_name
1 || Afghanistan
*/
/* column definitions {
"country_id": "the unique identifier of the country",
"country_name": "the country name"
}*/
CREATE TABLE address
(
address_id INTEGER
primary key,
street_number TEXT,
street_name TEXT,
city TEXT,
country_id INTEGER,
foreign key (country_id) references country(country_id)
)
/*
1 example row:
SELECT * FROM address LIMIT 1;
address_id ||street_number || street_name || city ||country_id
1 || 57 ||Glacier Hill Avenue ||Torbat-e Jām || 95
*/
/* column definitions {
"address_id": "the unique identifier of the address",
"street_number": "the street number of the address",
"street_name": "the street name",
"city": "the city where the address belongs",
"country_id": "the id of the country where the address belongs "
}*/
CREATE TABLE customer
(
customer_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
email TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
customer_id ||first_name ||last_name || email
1 || Ursola || Purdy ||upurdy0@cdbaby.com
*/
/* column definitions {
"customer_id": "the unique identifier of the customer",
"first_name": "the first name of the customer",
"last_name": "the last name of the customer",
"email": "the email of the customer"
}*/
CREATE TABLE customer_address
(
customer_id INTEGER,
address_id INTEGER,
status_id INTEGER,
primary key (customer_id, address_id),
foreign key (address_id) references address(address_id),
foreign key (customer_id) references customer(customer_id)
)
/*
1 example row:
SELECT * FROM customer_address LIMIT 1;
customer_id ||address_id ||status_id
1 || 606 || 1
*/
/* column definitions {
"customer_id": "the id of the customer\nMaps to customer(customer_id)",
"address_id": "the id of the address\nMaps to address(address_id)",
"status_id": "the id of the address status"
}*/
CREATE TABLE order_status
(
status_id INTEGER
primary key,
status_value TEXT
)
/*
1 example row:
SELECT * FROM order_status LIMIT 1;
status_id || status_value
1 ||Order Received
*/
/* column definitions {
"status_id": "the unique identifier of the order status",
"status_value": "the status value"
}*/
CREATE TABLE publisher
(
publisher_id INTEGER
primary key,
publisher_name TEXT
)
/*
1 example row:
SELECT * FROM publisher LIMIT 1;
publisher_id ||publisher_name
1 || 10/18
*/
/* column definitions {
"publisher_id": "the unique identifier of the publisher",
"publisher_name": "the name of the publisher"
}*/
CREATE TABLE book
(
book_id INTEGER
primary key,
title TEXT,
isbn13 TEXT,
language_id INTEGER,
num_pages INTEGER,
publication_date DATE,
publisher_id INTEGER,
foreign key (language_id) references book_language(language_id),
foreign key (publisher_id) references publisher(publisher_id)
)
/*
1 example row:
SELECT * FROM book LIMIT 1;
book_id || title || isbn13 ||language_id ||num_pages ||publication_date ||publisher_id
1 ||The World's First Love: Mary Mother of God ||8987059752 || 2 || 276 || 1996-09-01 || 1010
*/
/* column definitions {
"book_id": "the unique identifier of the book",
"title": "the title of the book ",
"isbn13": "the International Standard Book Number of the book",
"language_id": "the id of the book language\nMaps to book_language (language_id)",
"num_pages": "the number of the pages",
"publication_date": "the publication date of the book",
"publisher_id": "the id of the publisher\nMaps to publisher (publisher_id)"
}*/
CREATE TABLE book_author
(
book_id INTEGER,
author_id INTEGER,
primary key (book_id, author_id),
foreign key (author_id) references author(author_id),
foreign key (book_id) references book(book_id)
)
/*
1 example row:
SELECT * FROM book_author LIMIT 1;
book_id ||author_id
10539 || 1
*/
/* column definitions {
"book_id": "the id of the book\nMaps to book(book_id)",
"author_id": "the id of the author\nMaps to author(author_id)"
}*/
CREATE TABLE shipping_method
(
method_id INTEGER
primary key,
method_name TEXT,
cost REAL
)
/*
1 example row:
SELECT * FROM shipping_method LIMIT 1;
method_id ||method_name ||cost
1 || Standard || 5.9
*/
/* column definitions {
"method_id": "the unique identifier of the method",
"method_name": "the method name",
"cost": "the cost of the shipping method"
}*/
CREATE TABLE "cust_order"
(
order_id INTEGER
primary key autoincrement,
order_date DATETIME,
customer_id INTEGER
references customer,
shipping_method_id INTEGER
references shipping_method,
dest_address_id INTEGER
references address
)
/*
1 example row:
SELECT * FROM cust_order LIMIT 1;
order_id || order_date ||customer_id ||shipping_method_id ||dest_address_id
1 ||2021-07-14 10:47:19 || 387 || 4 || 1
*/
/* column definitions {
"order_id": "the unique identifier of the customer order",
"order_date": "the date of the order",
"customer_id": "the id of the customer\nMaps to customer(customer_Id)",
"shipping_method_id": "the id of the shipping method\nMaps to shipping_method(method_id)",
"dest_address_id": "the id of the destination address\nMaps to address(address_id)"
}*/
CREATE TABLE "order_history"
(
history_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
status_id INTEGER
references order_status,
status_date DATETIME
)
/*
1 example row:
SELECT * FROM order_history LIMIT 1;
history_id ||order_id ||status_id || status_date
1 || 1 || 1 ||2021-07-14 17:04:28
*/
/* column definitions {
"history_id": "the unique identifier of the order history",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"status_id": "the id of the order\nMaps to order_status(status_id)",
"status_date": "the date of the status updated "
}*/
CREATE TABLE "order_line"
(
line_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
book_id INTEGER
references book,
price REAL
)
/*
1 example row:
SELECT * FROM order_line LIMIT 1;
line_id ||order_id ||book_id ||price
1024 || 2051 || 10720 || 3.19
*/
/* column definitions {
"line_id": "the unique identifier of the order line",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"book_id": "the id of the book\nMaps to book(book_id)",
"price": "the price of the order"
}*/
### Question
Which country does Žirovnica city belong to?
Clarification: "Žirovnica" is the city; country refers to country_name
| [query_database(**{'query': 'SELECT T1.country_name FROM country AS T1 INNER JOIN address AS T2 ON T1.country_id = T2.country_id WHERE T2.city = 'Žirovnica''})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE address_status
(
status_id INTEGER
primary key,
address_status TEXT
)
/*
1 example row:
SELECT * FROM address_status LIMIT 1;
status_id ||address_status
1 || Active
*/
/* column definitions {
"status_id": "the unique identifier of the status",
"address_status": "the status of the address"
}*/
CREATE TABLE author
(
author_id INTEGER
primary key,
author_name TEXT
)
/*
1 example row:
SELECT * FROM author LIMIT 1;
author_id || author_name
1 ||A. Bartlett Giamatti
*/
/* column definitions {
"author_id": "the unique identifier of the author",
"author_name": "the name of the author"
}*/
CREATE TABLE book_language
(
language_id INTEGER
primary key,
language_code TEXT,
language_name TEXT
)
/*
1 example row:
SELECT * FROM book_language LIMIT 1;
language_id ||language_code ||language_name
1 || eng || English
*/
/* column definitions {
"language_id": "the unique identifier of the language ",
"language_code": "the language code",
"language_name": "the language name"
}*/
CREATE TABLE country
(
country_id INTEGER
primary key,
country_name TEXT
)
/*
1 example row:
SELECT * FROM country LIMIT 1;
country_id ||country_name
1 || Afghanistan
*/
/* column definitions {
"country_id": "the unique identifier of the country",
"country_name": "the country name"
}*/
CREATE TABLE address
(
address_id INTEGER
primary key,
street_number TEXT,
street_name TEXT,
city TEXT,
country_id INTEGER,
foreign key (country_id) references country(country_id)
)
/*
1 example row:
SELECT * FROM address LIMIT 1;
address_id ||street_number || street_name || city ||country_id
1 || 57 ||Glacier Hill Avenue ||Torbat-e Jām || 95
*/
/* column definitions {
"address_id": "the unique identifier of the address",
"street_number": "the street number of the address",
"street_name": "the street name",
"city": "the city where the address belongs",
"country_id": "the id of the country where the address belongs "
}*/
CREATE TABLE customer
(
customer_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
email TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
customer_id ||first_name ||last_name || email
1 || Ursola || Purdy ||upurdy0@cdbaby.com
*/
/* column definitions {
"customer_id": "the unique identifier of the customer",
"first_name": "the first name of the customer",
"last_name": "the last name of the customer",
"email": "the email of the customer"
}*/
CREATE TABLE customer_address
(
customer_id INTEGER,
address_id INTEGER,
status_id INTEGER,
primary key (customer_id, address_id),
foreign key (address_id) references address(address_id),
foreign key (customer_id) references customer(customer_id)
)
/*
1 example row:
SELECT * FROM customer_address LIMIT 1;
customer_id ||address_id ||status_id
1 || 606 || 1
*/
/* column definitions {
"customer_id": "the id of the customer\nMaps to customer(customer_id)",
"address_id": "the id of the address\nMaps to address(address_id)",
"status_id": "the id of the address status"
}*/
CREATE TABLE order_status
(
status_id INTEGER
primary key,
status_value TEXT
)
/*
1 example row:
SELECT * FROM order_status LIMIT 1;
status_id || status_value
1 ||Order Received
*/
/* column definitions {
"status_id": "the unique identifier of the order status",
"status_value": "the status value"
}*/
CREATE TABLE publisher
(
publisher_id INTEGER
primary key,
publisher_name TEXT
)
/*
1 example row:
SELECT * FROM publisher LIMIT 1;
publisher_id ||publisher_name
1 || 10/18
*/
/* column definitions {
"publisher_id": "the unique identifier of the publisher",
"publisher_name": "the name of the publisher"
}*/
CREATE TABLE book
(
book_id INTEGER
primary key,
title TEXT,
isbn13 TEXT,
language_id INTEGER,
num_pages INTEGER,
publication_date DATE,
publisher_id INTEGER,
foreign key (language_id) references book_language(language_id),
foreign key (publisher_id) references publisher(publisher_id)
)
/*
1 example row:
SELECT * FROM book LIMIT 1;
book_id || title || isbn13 ||language_id ||num_pages ||publication_date ||publisher_id
1 ||The World's First Love: Mary Mother of God ||8987059752 || 2 || 276 || 1996-09-01 || 1010
*/
/* column definitions {
"book_id": "the unique identifier of the book",
"title": "the title of the book ",
"isbn13": "the International Standard Book Number of the book",
"language_id": "the id of the book language\nMaps to book_language (language_id)",
"num_pages": "the number of the pages",
"publication_date": "the publication date of the book",
"publisher_id": "the id of the publisher\nMaps to publisher (publisher_id)"
}*/
CREATE TABLE book_author
(
book_id INTEGER,
author_id INTEGER,
primary key (book_id, author_id),
foreign key (author_id) references author(author_id),
foreign key (book_id) references book(book_id)
)
/*
1 example row:
SELECT * FROM book_author LIMIT 1;
book_id ||author_id
10539 || 1
*/
/* column definitions {
"book_id": "the id of the book\nMaps to book(book_id)",
"author_id": "the id of the author\nMaps to author(author_id)"
}*/
CREATE TABLE shipping_method
(
method_id INTEGER
primary key,
method_name TEXT,
cost REAL
)
/*
1 example row:
SELECT * FROM shipping_method LIMIT 1;
method_id ||method_name ||cost
1 || Standard || 5.9
*/
/* column definitions {
"method_id": "the unique identifier of the method",
"method_name": "the method name",
"cost": "the cost of the shipping method"
}*/
CREATE TABLE "cust_order"
(
order_id INTEGER
primary key autoincrement,
order_date DATETIME,
customer_id INTEGER
references customer,
shipping_method_id INTEGER
references shipping_method,
dest_address_id INTEGER
references address
)
/*
1 example row:
SELECT * FROM cust_order LIMIT 1;
order_id || order_date ||customer_id ||shipping_method_id ||dest_address_id
1 ||2021-07-14 10:47:19 || 387 || 4 || 1
*/
/* column definitions {
"order_id": "the unique identifier of the customer order",
"order_date": "the date of the order",
"customer_id": "the id of the customer\nMaps to customer(customer_Id)",
"shipping_method_id": "the id of the shipping method\nMaps to shipping_method(method_id)",
"dest_address_id": "the id of the destination address\nMaps to address(address_id)"
}*/
CREATE TABLE "order_history"
(
history_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
status_id INTEGER
references order_status,
status_date DATETIME
)
/*
1 example row:
SELECT * FROM order_history LIMIT 1;
history_id ||order_id ||status_id || status_date
1 || 1 || 1 ||2021-07-14 17:04:28
*/
/* column definitions {
"history_id": "the unique identifier of the order history",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"status_id": "the id of the order\nMaps to order_status(status_id)",
"status_date": "the date of the status updated "
}*/
CREATE TABLE "order_line"
(
line_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
book_id INTEGER
references book,
price REAL
)
/*
1 example row:
SELECT * FROM order_line LIMIT 1;
line_id ||order_id ||book_id ||price
1024 || 2051 || 10720 || 3.19
*/
/* column definitions {
"line_id": "the unique identifier of the order line",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"book_id": "the id of the book\nMaps to book(book_id)",
"price": "the price of the order"
}*/
|
5,944 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE address_status
(
status_id INTEGER
primary key,
address_status TEXT
)
/*
1 example row:
SELECT * FROM address_status LIMIT 1;
status_id ||address_status
1 || Active
*/
/* column definitions {
"status_id": "the unique identifier of the status",
"address_status": "the status of the address"
}*/
CREATE TABLE author
(
author_id INTEGER
primary key,
author_name TEXT
)
/*
1 example row:
SELECT * FROM author LIMIT 1;
author_id || author_name
1 ||A. Bartlett Giamatti
*/
/* column definitions {
"author_id": "the unique identifier of the author",
"author_name": "the name of the author"
}*/
CREATE TABLE book_language
(
language_id INTEGER
primary key,
language_code TEXT,
language_name TEXT
)
/*
1 example row:
SELECT * FROM book_language LIMIT 1;
language_id ||language_code ||language_name
1 || eng || English
*/
/* column definitions {
"language_id": "the unique identifier of the language ",
"language_code": "the language code",
"language_name": "the language name"
}*/
CREATE TABLE country
(
country_id INTEGER
primary key,
country_name TEXT
)
/*
1 example row:
SELECT * FROM country LIMIT 1;
country_id ||country_name
1 || Afghanistan
*/
/* column definitions {
"country_id": "the unique identifier of the country",
"country_name": "the country name"
}*/
CREATE TABLE address
(
address_id INTEGER
primary key,
street_number TEXT,
street_name TEXT,
city TEXT,
country_id INTEGER,
foreign key (country_id) references country(country_id)
)
/*
1 example row:
SELECT * FROM address LIMIT 1;
address_id ||street_number || street_name || city ||country_id
1 || 57 ||Glacier Hill Avenue ||Torbat-e Jām || 95
*/
/* column definitions {
"address_id": "the unique identifier of the address",
"street_number": "the street number of the address",
"street_name": "the street name",
"city": "the city where the address belongs",
"country_id": "the id of the country where the address belongs "
}*/
CREATE TABLE customer
(
customer_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
email TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
customer_id ||first_name ||last_name || email
1 || Ursola || Purdy ||upurdy0@cdbaby.com
*/
/* column definitions {
"customer_id": "the unique identifier of the customer",
"first_name": "the first name of the customer",
"last_name": "the last name of the customer",
"email": "the email of the customer"
}*/
CREATE TABLE customer_address
(
customer_id INTEGER,
address_id INTEGER,
status_id INTEGER,
primary key (customer_id, address_id),
foreign key (address_id) references address(address_id),
foreign key (customer_id) references customer(customer_id)
)
/*
1 example row:
SELECT * FROM customer_address LIMIT 1;
customer_id ||address_id ||status_id
1 || 606 || 1
*/
/* column definitions {
"customer_id": "the id of the customer\nMaps to customer(customer_id)",
"address_id": "the id of the address\nMaps to address(address_id)",
"status_id": "the id of the address status"
}*/
CREATE TABLE order_status
(
status_id INTEGER
primary key,
status_value TEXT
)
/*
1 example row:
SELECT * FROM order_status LIMIT 1;
status_id || status_value
1 ||Order Received
*/
/* column definitions {
"status_id": "the unique identifier of the order status",
"status_value": "the status value"
}*/
CREATE TABLE publisher
(
publisher_id INTEGER
primary key,
publisher_name TEXT
)
/*
1 example row:
SELECT * FROM publisher LIMIT 1;
publisher_id ||publisher_name
1 || 10/18
*/
/* column definitions {
"publisher_id": "the unique identifier of the publisher",
"publisher_name": "the name of the publisher"
}*/
CREATE TABLE book
(
book_id INTEGER
primary key,
title TEXT,
isbn13 TEXT,
language_id INTEGER,
num_pages INTEGER,
publication_date DATE,
publisher_id INTEGER,
foreign key (language_id) references book_language(language_id),
foreign key (publisher_id) references publisher(publisher_id)
)
/*
1 example row:
SELECT * FROM book LIMIT 1;
book_id || title || isbn13 ||language_id ||num_pages ||publication_date ||publisher_id
1 ||The World's First Love: Mary Mother of God ||8987059752 || 2 || 276 || 1996-09-01 || 1010
*/
/* column definitions {
"book_id": "the unique identifier of the book",
"title": "the title of the book ",
"isbn13": "the International Standard Book Number of the book",
"language_id": "the id of the book language\nMaps to book_language (language_id)",
"num_pages": "the number of the pages",
"publication_date": "the publication date of the book",
"publisher_id": "the id of the publisher\nMaps to publisher (publisher_id)"
}*/
CREATE TABLE book_author
(
book_id INTEGER,
author_id INTEGER,
primary key (book_id, author_id),
foreign key (author_id) references author(author_id),
foreign key (book_id) references book(book_id)
)
/*
1 example row:
SELECT * FROM book_author LIMIT 1;
book_id ||author_id
10539 || 1
*/
/* column definitions {
"book_id": "the id of the book\nMaps to book(book_id)",
"author_id": "the id of the author\nMaps to author(author_id)"
}*/
CREATE TABLE shipping_method
(
method_id INTEGER
primary key,
method_name TEXT,
cost REAL
)
/*
1 example row:
SELECT * FROM shipping_method LIMIT 1;
method_id ||method_name ||cost
1 || Standard || 5.9
*/
/* column definitions {
"method_id": "the unique identifier of the method",
"method_name": "the method name",
"cost": "the cost of the shipping method"
}*/
CREATE TABLE "cust_order"
(
order_id INTEGER
primary key autoincrement,
order_date DATETIME,
customer_id INTEGER
references customer,
shipping_method_id INTEGER
references shipping_method,
dest_address_id INTEGER
references address
)
/*
1 example row:
SELECT * FROM cust_order LIMIT 1;
order_id || order_date ||customer_id ||shipping_method_id ||dest_address_id
1 ||2021-07-14 10:47:19 || 387 || 4 || 1
*/
/* column definitions {
"order_id": "the unique identifier of the customer order",
"order_date": "the date of the order",
"customer_id": "the id of the customer\nMaps to customer(customer_Id)",
"shipping_method_id": "the id of the shipping method\nMaps to shipping_method(method_id)",
"dest_address_id": "the id of the destination address\nMaps to address(address_id)"
}*/
CREATE TABLE "order_history"
(
history_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
status_id INTEGER
references order_status,
status_date DATETIME
)
/*
1 example row:
SELECT * FROM order_history LIMIT 1;
history_id ||order_id ||status_id || status_date
1 || 1 || 1 ||2021-07-14 17:04:28
*/
/* column definitions {
"history_id": "the unique identifier of the order history",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"status_id": "the id of the order\nMaps to order_status(status_id)",
"status_date": "the date of the status updated "
}*/
CREATE TABLE "order_line"
(
line_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
book_id INTEGER
references book,
price REAL
)
/*
1 example row:
SELECT * FROM order_line LIMIT 1;
line_id ||order_id ||book_id ||price
1024 || 2051 || 10720 || 3.19
*/
/* column definitions {
"line_id": "the unique identifier of the order line",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"book_id": "the id of the book\nMaps to book(book_id)",
"price": "the price of the order"
}*/
### Question
What is the title of the first book that was published in 1900?
Clarification: published in 1900 refers to publication_date LIKE '1900%'; first book refers to Min(publication_date)
| [query_database(**{'query': 'SELECT title FROM book WHERE STRFTIME('%Y', publication_date) = '1900' ORDER BY publication_date LIMIT 1'})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE address_status
(
status_id INTEGER
primary key,
address_status TEXT
)
/*
1 example row:
SELECT * FROM address_status LIMIT 1;
status_id ||address_status
1 || Active
*/
/* column definitions {
"status_id": "the unique identifier of the status",
"address_status": "the status of the address"
}*/
CREATE TABLE author
(
author_id INTEGER
primary key,
author_name TEXT
)
/*
1 example row:
SELECT * FROM author LIMIT 1;
author_id || author_name
1 ||A. Bartlett Giamatti
*/
/* column definitions {
"author_id": "the unique identifier of the author",
"author_name": "the name of the author"
}*/
CREATE TABLE book_language
(
language_id INTEGER
primary key,
language_code TEXT,
language_name TEXT
)
/*
1 example row:
SELECT * FROM book_language LIMIT 1;
language_id ||language_code ||language_name
1 || eng || English
*/
/* column definitions {
"language_id": "the unique identifier of the language ",
"language_code": "the language code",
"language_name": "the language name"
}*/
CREATE TABLE country
(
country_id INTEGER
primary key,
country_name TEXT
)
/*
1 example row:
SELECT * FROM country LIMIT 1;
country_id ||country_name
1 || Afghanistan
*/
/* column definitions {
"country_id": "the unique identifier of the country",
"country_name": "the country name"
}*/
CREATE TABLE address
(
address_id INTEGER
primary key,
street_number TEXT,
street_name TEXT,
city TEXT,
country_id INTEGER,
foreign key (country_id) references country(country_id)
)
/*
1 example row:
SELECT * FROM address LIMIT 1;
address_id ||street_number || street_name || city ||country_id
1 || 57 ||Glacier Hill Avenue ||Torbat-e Jām || 95
*/
/* column definitions {
"address_id": "the unique identifier of the address",
"street_number": "the street number of the address",
"street_name": "the street name",
"city": "the city where the address belongs",
"country_id": "the id of the country where the address belongs "
}*/
CREATE TABLE customer
(
customer_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
email TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
customer_id ||first_name ||last_name || email
1 || Ursola || Purdy ||upurdy0@cdbaby.com
*/
/* column definitions {
"customer_id": "the unique identifier of the customer",
"first_name": "the first name of the customer",
"last_name": "the last name of the customer",
"email": "the email of the customer"
}*/
CREATE TABLE customer_address
(
customer_id INTEGER,
address_id INTEGER,
status_id INTEGER,
primary key (customer_id, address_id),
foreign key (address_id) references address(address_id),
foreign key (customer_id) references customer(customer_id)
)
/*
1 example row:
SELECT * FROM customer_address LIMIT 1;
customer_id ||address_id ||status_id
1 || 606 || 1
*/
/* column definitions {
"customer_id": "the id of the customer\nMaps to customer(customer_id)",
"address_id": "the id of the address\nMaps to address(address_id)",
"status_id": "the id of the address status"
}*/
CREATE TABLE order_status
(
status_id INTEGER
primary key,
status_value TEXT
)
/*
1 example row:
SELECT * FROM order_status LIMIT 1;
status_id || status_value
1 ||Order Received
*/
/* column definitions {
"status_id": "the unique identifier of the order status",
"status_value": "the status value"
}*/
CREATE TABLE publisher
(
publisher_id INTEGER
primary key,
publisher_name TEXT
)
/*
1 example row:
SELECT * FROM publisher LIMIT 1;
publisher_id ||publisher_name
1 || 10/18
*/
/* column definitions {
"publisher_id": "the unique identifier of the publisher",
"publisher_name": "the name of the publisher"
}*/
CREATE TABLE book
(
book_id INTEGER
primary key,
title TEXT,
isbn13 TEXT,
language_id INTEGER,
num_pages INTEGER,
publication_date DATE,
publisher_id INTEGER,
foreign key (language_id) references book_language(language_id),
foreign key (publisher_id) references publisher(publisher_id)
)
/*
1 example row:
SELECT * FROM book LIMIT 1;
book_id || title || isbn13 ||language_id ||num_pages ||publication_date ||publisher_id
1 ||The World's First Love: Mary Mother of God ||8987059752 || 2 || 276 || 1996-09-01 || 1010
*/
/* column definitions {
"book_id": "the unique identifier of the book",
"title": "the title of the book ",
"isbn13": "the International Standard Book Number of the book",
"language_id": "the id of the book language\nMaps to book_language (language_id)",
"num_pages": "the number of the pages",
"publication_date": "the publication date of the book",
"publisher_id": "the id of the publisher\nMaps to publisher (publisher_id)"
}*/
CREATE TABLE book_author
(
book_id INTEGER,
author_id INTEGER,
primary key (book_id, author_id),
foreign key (author_id) references author(author_id),
foreign key (book_id) references book(book_id)
)
/*
1 example row:
SELECT * FROM book_author LIMIT 1;
book_id ||author_id
10539 || 1
*/
/* column definitions {
"book_id": "the id of the book\nMaps to book(book_id)",
"author_id": "the id of the author\nMaps to author(author_id)"
}*/
CREATE TABLE shipping_method
(
method_id INTEGER
primary key,
method_name TEXT,
cost REAL
)
/*
1 example row:
SELECT * FROM shipping_method LIMIT 1;
method_id ||method_name ||cost
1 || Standard || 5.9
*/
/* column definitions {
"method_id": "the unique identifier of the method",
"method_name": "the method name",
"cost": "the cost of the shipping method"
}*/
CREATE TABLE "cust_order"
(
order_id INTEGER
primary key autoincrement,
order_date DATETIME,
customer_id INTEGER
references customer,
shipping_method_id INTEGER
references shipping_method,
dest_address_id INTEGER
references address
)
/*
1 example row:
SELECT * FROM cust_order LIMIT 1;
order_id || order_date ||customer_id ||shipping_method_id ||dest_address_id
1 ||2021-07-14 10:47:19 || 387 || 4 || 1
*/
/* column definitions {
"order_id": "the unique identifier of the customer order",
"order_date": "the date of the order",
"customer_id": "the id of the customer\nMaps to customer(customer_Id)",
"shipping_method_id": "the id of the shipping method\nMaps to shipping_method(method_id)",
"dest_address_id": "the id of the destination address\nMaps to address(address_id)"
}*/
CREATE TABLE "order_history"
(
history_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
status_id INTEGER
references order_status,
status_date DATETIME
)
/*
1 example row:
SELECT * FROM order_history LIMIT 1;
history_id ||order_id ||status_id || status_date
1 || 1 || 1 ||2021-07-14 17:04:28
*/
/* column definitions {
"history_id": "the unique identifier of the order history",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"status_id": "the id of the order\nMaps to order_status(status_id)",
"status_date": "the date of the status updated "
}*/
CREATE TABLE "order_line"
(
line_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
book_id INTEGER
references book,
price REAL
)
/*
1 example row:
SELECT * FROM order_line LIMIT 1;
line_id ||order_id ||book_id ||price
1024 || 2051 || 10720 || 3.19
*/
/* column definitions {
"line_id": "the unique identifier of the order line",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"book_id": "the id of the book\nMaps to book(book_id)",
"price": "the price of the order"
}*/
|
5,948 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE address_status
(
status_id INTEGER
primary key,
address_status TEXT
)
/*
1 example row:
SELECT * FROM address_status LIMIT 1;
status_id ||address_status
1 || Active
*/
/* column definitions {
"status_id": "the unique identifier of the status",
"address_status": "the status of the address"
}*/
CREATE TABLE author
(
author_id INTEGER
primary key,
author_name TEXT
)
/*
1 example row:
SELECT * FROM author LIMIT 1;
author_id || author_name
1 ||A. Bartlett Giamatti
*/
/* column definitions {
"author_id": "the unique identifier of the author",
"author_name": "the name of the author"
}*/
CREATE TABLE book_language
(
language_id INTEGER
primary key,
language_code TEXT,
language_name TEXT
)
/*
1 example row:
SELECT * FROM book_language LIMIT 1;
language_id ||language_code ||language_name
1 || eng || English
*/
/* column definitions {
"language_id": "the unique identifier of the language ",
"language_code": "the language code",
"language_name": "the language name"
}*/
CREATE TABLE country
(
country_id INTEGER
primary key,
country_name TEXT
)
/*
1 example row:
SELECT * FROM country LIMIT 1;
country_id ||country_name
1 || Afghanistan
*/
/* column definitions {
"country_id": "the unique identifier of the country",
"country_name": "the country name"
}*/
CREATE TABLE address
(
address_id INTEGER
primary key,
street_number TEXT,
street_name TEXT,
city TEXT,
country_id INTEGER,
foreign key (country_id) references country(country_id)
)
/*
1 example row:
SELECT * FROM address LIMIT 1;
address_id ||street_number || street_name || city ||country_id
1 || 57 ||Glacier Hill Avenue ||Torbat-e Jām || 95
*/
/* column definitions {
"address_id": "the unique identifier of the address",
"street_number": "the street number of the address",
"street_name": "the street name",
"city": "the city where the address belongs",
"country_id": "the id of the country where the address belongs "
}*/
CREATE TABLE customer
(
customer_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
email TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
customer_id ||first_name ||last_name || email
1 || Ursola || Purdy ||upurdy0@cdbaby.com
*/
/* column definitions {
"customer_id": "the unique identifier of the customer",
"first_name": "the first name of the customer",
"last_name": "the last name of the customer",
"email": "the email of the customer"
}*/
CREATE TABLE customer_address
(
customer_id INTEGER,
address_id INTEGER,
status_id INTEGER,
primary key (customer_id, address_id),
foreign key (address_id) references address(address_id),
foreign key (customer_id) references customer(customer_id)
)
/*
1 example row:
SELECT * FROM customer_address LIMIT 1;
customer_id ||address_id ||status_id
1 || 606 || 1
*/
/* column definitions {
"customer_id": "the id of the customer\nMaps to customer(customer_id)",
"address_id": "the id of the address\nMaps to address(address_id)",
"status_id": "the id of the address status"
}*/
CREATE TABLE order_status
(
status_id INTEGER
primary key,
status_value TEXT
)
/*
1 example row:
SELECT * FROM order_status LIMIT 1;
status_id || status_value
1 ||Order Received
*/
/* column definitions {
"status_id": "the unique identifier of the order status",
"status_value": "the status value"
}*/
CREATE TABLE publisher
(
publisher_id INTEGER
primary key,
publisher_name TEXT
)
/*
1 example row:
SELECT * FROM publisher LIMIT 1;
publisher_id ||publisher_name
1 || 10/18
*/
/* column definitions {
"publisher_id": "the unique identifier of the publisher",
"publisher_name": "the name of the publisher"
}*/
CREATE TABLE book
(
book_id INTEGER
primary key,
title TEXT,
isbn13 TEXT,
language_id INTEGER,
num_pages INTEGER,
publication_date DATE,
publisher_id INTEGER,
foreign key (language_id) references book_language(language_id),
foreign key (publisher_id) references publisher(publisher_id)
)
/*
1 example row:
SELECT * FROM book LIMIT 1;
book_id || title || isbn13 ||language_id ||num_pages ||publication_date ||publisher_id
1 ||The World's First Love: Mary Mother of God ||8987059752 || 2 || 276 || 1996-09-01 || 1010
*/
/* column definitions {
"book_id": "the unique identifier of the book",
"title": "the title of the book ",
"isbn13": "the International Standard Book Number of the book",
"language_id": "the id of the book language\nMaps to book_language (language_id)",
"num_pages": "the number of the pages",
"publication_date": "the publication date of the book",
"publisher_id": "the id of the publisher\nMaps to publisher (publisher_id)"
}*/
CREATE TABLE book_author
(
book_id INTEGER,
author_id INTEGER,
primary key (book_id, author_id),
foreign key (author_id) references author(author_id),
foreign key (book_id) references book(book_id)
)
/*
1 example row:
SELECT * FROM book_author LIMIT 1;
book_id ||author_id
10539 || 1
*/
/* column definitions {
"book_id": "the id of the book\nMaps to book(book_id)",
"author_id": "the id of the author\nMaps to author(author_id)"
}*/
CREATE TABLE shipping_method
(
method_id INTEGER
primary key,
method_name TEXT,
cost REAL
)
/*
1 example row:
SELECT * FROM shipping_method LIMIT 1;
method_id ||method_name ||cost
1 || Standard || 5.9
*/
/* column definitions {
"method_id": "the unique identifier of the method",
"method_name": "the method name",
"cost": "the cost of the shipping method"
}*/
CREATE TABLE "cust_order"
(
order_id INTEGER
primary key autoincrement,
order_date DATETIME,
customer_id INTEGER
references customer,
shipping_method_id INTEGER
references shipping_method,
dest_address_id INTEGER
references address
)
/*
1 example row:
SELECT * FROM cust_order LIMIT 1;
order_id || order_date ||customer_id ||shipping_method_id ||dest_address_id
1 ||2021-07-14 10:47:19 || 387 || 4 || 1
*/
/* column definitions {
"order_id": "the unique identifier of the customer order",
"order_date": "the date of the order",
"customer_id": "the id of the customer\nMaps to customer(customer_Id)",
"shipping_method_id": "the id of the shipping method\nMaps to shipping_method(method_id)",
"dest_address_id": "the id of the destination address\nMaps to address(address_id)"
}*/
CREATE TABLE "order_history"
(
history_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
status_id INTEGER
references order_status,
status_date DATETIME
)
/*
1 example row:
SELECT * FROM order_history LIMIT 1;
history_id ||order_id ||status_id || status_date
1 || 1 || 1 ||2021-07-14 17:04:28
*/
/* column definitions {
"history_id": "the unique identifier of the order history",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"status_id": "the id of the order\nMaps to order_status(status_id)",
"status_date": "the date of the status updated "
}*/
CREATE TABLE "order_line"
(
line_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
book_id INTEGER
references book,
price REAL
)
/*
1 example row:
SELECT * FROM order_line LIMIT 1;
line_id ||order_id ||book_id ||price
1024 || 2051 || 10720 || 3.19
*/
/* column definitions {
"line_id": "the unique identifier of the order line",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"book_id": "the id of the book\nMaps to book(book_id)",
"price": "the price of the order"
}*/
### Question
What is the full name of the customer who ordered the most books of all time?
Clarification: customer who ordered the most book refers to customer_id where Max(count(order_id)); full name refers to first_name, last_name
| [query_database(**{'query': 'SELECT T1.first_name, T1.last_name FROM customer AS T1 INNER JOIN cust_order AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.first_name, T1.last_name ORDER BY COUNT(*) DESC LIMIT 1'})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE address_status
(
status_id INTEGER
primary key,
address_status TEXT
)
/*
1 example row:
SELECT * FROM address_status LIMIT 1;
status_id ||address_status
1 || Active
*/
/* column definitions {
"status_id": "the unique identifier of the status",
"address_status": "the status of the address"
}*/
CREATE TABLE author
(
author_id INTEGER
primary key,
author_name TEXT
)
/*
1 example row:
SELECT * FROM author LIMIT 1;
author_id || author_name
1 ||A. Bartlett Giamatti
*/
/* column definitions {
"author_id": "the unique identifier of the author",
"author_name": "the name of the author"
}*/
CREATE TABLE book_language
(
language_id INTEGER
primary key,
language_code TEXT,
language_name TEXT
)
/*
1 example row:
SELECT * FROM book_language LIMIT 1;
language_id ||language_code ||language_name
1 || eng || English
*/
/* column definitions {
"language_id": "the unique identifier of the language ",
"language_code": "the language code",
"language_name": "the language name"
}*/
CREATE TABLE country
(
country_id INTEGER
primary key,
country_name TEXT
)
/*
1 example row:
SELECT * FROM country LIMIT 1;
country_id ||country_name
1 || Afghanistan
*/
/* column definitions {
"country_id": "the unique identifier of the country",
"country_name": "the country name"
}*/
CREATE TABLE address
(
address_id INTEGER
primary key,
street_number TEXT,
street_name TEXT,
city TEXT,
country_id INTEGER,
foreign key (country_id) references country(country_id)
)
/*
1 example row:
SELECT * FROM address LIMIT 1;
address_id ||street_number || street_name || city ||country_id
1 || 57 ||Glacier Hill Avenue ||Torbat-e Jām || 95
*/
/* column definitions {
"address_id": "the unique identifier of the address",
"street_number": "the street number of the address",
"street_name": "the street name",
"city": "the city where the address belongs",
"country_id": "the id of the country where the address belongs "
}*/
CREATE TABLE customer
(
customer_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
email TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
customer_id ||first_name ||last_name || email
1 || Ursola || Purdy ||upurdy0@cdbaby.com
*/
/* column definitions {
"customer_id": "the unique identifier of the customer",
"first_name": "the first name of the customer",
"last_name": "the last name of the customer",
"email": "the email of the customer"
}*/
CREATE TABLE customer_address
(
customer_id INTEGER,
address_id INTEGER,
status_id INTEGER,
primary key (customer_id, address_id),
foreign key (address_id) references address(address_id),
foreign key (customer_id) references customer(customer_id)
)
/*
1 example row:
SELECT * FROM customer_address LIMIT 1;
customer_id ||address_id ||status_id
1 || 606 || 1
*/
/* column definitions {
"customer_id": "the id of the customer\nMaps to customer(customer_id)",
"address_id": "the id of the address\nMaps to address(address_id)",
"status_id": "the id of the address status"
}*/
CREATE TABLE order_status
(
status_id INTEGER
primary key,
status_value TEXT
)
/*
1 example row:
SELECT * FROM order_status LIMIT 1;
status_id || status_value
1 ||Order Received
*/
/* column definitions {
"status_id": "the unique identifier of the order status",
"status_value": "the status value"
}*/
CREATE TABLE publisher
(
publisher_id INTEGER
primary key,
publisher_name TEXT
)
/*
1 example row:
SELECT * FROM publisher LIMIT 1;
publisher_id ||publisher_name
1 || 10/18
*/
/* column definitions {
"publisher_id": "the unique identifier of the publisher",
"publisher_name": "the name of the publisher"
}*/
CREATE TABLE book
(
book_id INTEGER
primary key,
title TEXT,
isbn13 TEXT,
language_id INTEGER,
num_pages INTEGER,
publication_date DATE,
publisher_id INTEGER,
foreign key (language_id) references book_language(language_id),
foreign key (publisher_id) references publisher(publisher_id)
)
/*
1 example row:
SELECT * FROM book LIMIT 1;
book_id || title || isbn13 ||language_id ||num_pages ||publication_date ||publisher_id
1 ||The World's First Love: Mary Mother of God ||8987059752 || 2 || 276 || 1996-09-01 || 1010
*/
/* column definitions {
"book_id": "the unique identifier of the book",
"title": "the title of the book ",
"isbn13": "the International Standard Book Number of the book",
"language_id": "the id of the book language\nMaps to book_language (language_id)",
"num_pages": "the number of the pages",
"publication_date": "the publication date of the book",
"publisher_id": "the id of the publisher\nMaps to publisher (publisher_id)"
}*/
CREATE TABLE book_author
(
book_id INTEGER,
author_id INTEGER,
primary key (book_id, author_id),
foreign key (author_id) references author(author_id),
foreign key (book_id) references book(book_id)
)
/*
1 example row:
SELECT * FROM book_author LIMIT 1;
book_id ||author_id
10539 || 1
*/
/* column definitions {
"book_id": "the id of the book\nMaps to book(book_id)",
"author_id": "the id of the author\nMaps to author(author_id)"
}*/
CREATE TABLE shipping_method
(
method_id INTEGER
primary key,
method_name TEXT,
cost REAL
)
/*
1 example row:
SELECT * FROM shipping_method LIMIT 1;
method_id ||method_name ||cost
1 || Standard || 5.9
*/
/* column definitions {
"method_id": "the unique identifier of the method",
"method_name": "the method name",
"cost": "the cost of the shipping method"
}*/
CREATE TABLE "cust_order"
(
order_id INTEGER
primary key autoincrement,
order_date DATETIME,
customer_id INTEGER
references customer,
shipping_method_id INTEGER
references shipping_method,
dest_address_id INTEGER
references address
)
/*
1 example row:
SELECT * FROM cust_order LIMIT 1;
order_id || order_date ||customer_id ||shipping_method_id ||dest_address_id
1 ||2021-07-14 10:47:19 || 387 || 4 || 1
*/
/* column definitions {
"order_id": "the unique identifier of the customer order",
"order_date": "the date of the order",
"customer_id": "the id of the customer\nMaps to customer(customer_Id)",
"shipping_method_id": "the id of the shipping method\nMaps to shipping_method(method_id)",
"dest_address_id": "the id of the destination address\nMaps to address(address_id)"
}*/
CREATE TABLE "order_history"
(
history_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
status_id INTEGER
references order_status,
status_date DATETIME
)
/*
1 example row:
SELECT * FROM order_history LIMIT 1;
history_id ||order_id ||status_id || status_date
1 || 1 || 1 ||2021-07-14 17:04:28
*/
/* column definitions {
"history_id": "the unique identifier of the order history",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"status_id": "the id of the order\nMaps to order_status(status_id)",
"status_date": "the date of the status updated "
}*/
CREATE TABLE "order_line"
(
line_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
book_id INTEGER
references book,
price REAL
)
/*
1 example row:
SELECT * FROM order_line LIMIT 1;
line_id ||order_id ||book_id ||price
1024 || 2051 || 10720 || 3.19
*/
/* column definitions {
"line_id": "the unique identifier of the order line",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"book_id": "the id of the book\nMaps to book(book_id)",
"price": "the price of the order"
}*/
|
5,952 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE address_status
(
status_id INTEGER
primary key,
address_status TEXT
)
/*
1 example row:
SELECT * FROM address_status LIMIT 1;
status_id ||address_status
1 || Active
*/
/* column definitions {
"status_id": "the unique identifier of the status",
"address_status": "the status of the address"
}*/
CREATE TABLE author
(
author_id INTEGER
primary key,
author_name TEXT
)
/*
1 example row:
SELECT * FROM author LIMIT 1;
author_id || author_name
1 ||A. Bartlett Giamatti
*/
/* column definitions {
"author_id": "the unique identifier of the author",
"author_name": "the name of the author"
}*/
CREATE TABLE book_language
(
language_id INTEGER
primary key,
language_code TEXT,
language_name TEXT
)
/*
1 example row:
SELECT * FROM book_language LIMIT 1;
language_id ||language_code ||language_name
1 || eng || English
*/
/* column definitions {
"language_id": "the unique identifier of the language ",
"language_code": "the language code",
"language_name": "the language name"
}*/
CREATE TABLE country
(
country_id INTEGER
primary key,
country_name TEXT
)
/*
1 example row:
SELECT * FROM country LIMIT 1;
country_id ||country_name
1 || Afghanistan
*/
/* column definitions {
"country_id": "the unique identifier of the country",
"country_name": "the country name"
}*/
CREATE TABLE address
(
address_id INTEGER
primary key,
street_number TEXT,
street_name TEXT,
city TEXT,
country_id INTEGER,
foreign key (country_id) references country(country_id)
)
/*
1 example row:
SELECT * FROM address LIMIT 1;
address_id ||street_number || street_name || city ||country_id
1 || 57 ||Glacier Hill Avenue ||Torbat-e Jām || 95
*/
/* column definitions {
"address_id": "the unique identifier of the address",
"street_number": "the street number of the address",
"street_name": "the street name",
"city": "the city where the address belongs",
"country_id": "the id of the country where the address belongs "
}*/
CREATE TABLE customer
(
customer_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
email TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
customer_id ||first_name ||last_name || email
1 || Ursola || Purdy ||upurdy0@cdbaby.com
*/
/* column definitions {
"customer_id": "the unique identifier of the customer",
"first_name": "the first name of the customer",
"last_name": "the last name of the customer",
"email": "the email of the customer"
}*/
CREATE TABLE customer_address
(
customer_id INTEGER,
address_id INTEGER,
status_id INTEGER,
primary key (customer_id, address_id),
foreign key (address_id) references address(address_id),
foreign key (customer_id) references customer(customer_id)
)
/*
1 example row:
SELECT * FROM customer_address LIMIT 1;
customer_id ||address_id ||status_id
1 || 606 || 1
*/
/* column definitions {
"customer_id": "the id of the customer\nMaps to customer(customer_id)",
"address_id": "the id of the address\nMaps to address(address_id)",
"status_id": "the id of the address status"
}*/
CREATE TABLE order_status
(
status_id INTEGER
primary key,
status_value TEXT
)
/*
1 example row:
SELECT * FROM order_status LIMIT 1;
status_id || status_value
1 ||Order Received
*/
/* column definitions {
"status_id": "the unique identifier of the order status",
"status_value": "the status value"
}*/
CREATE TABLE publisher
(
publisher_id INTEGER
primary key,
publisher_name TEXT
)
/*
1 example row:
SELECT * FROM publisher LIMIT 1;
publisher_id ||publisher_name
1 || 10/18
*/
/* column definitions {
"publisher_id": "the unique identifier of the publisher",
"publisher_name": "the name of the publisher"
}*/
CREATE TABLE book
(
book_id INTEGER
primary key,
title TEXT,
isbn13 TEXT,
language_id INTEGER,
num_pages INTEGER,
publication_date DATE,
publisher_id INTEGER,
foreign key (language_id) references book_language(language_id),
foreign key (publisher_id) references publisher(publisher_id)
)
/*
1 example row:
SELECT * FROM book LIMIT 1;
book_id || title || isbn13 ||language_id ||num_pages ||publication_date ||publisher_id
1 ||The World's First Love: Mary Mother of God ||8987059752 || 2 || 276 || 1996-09-01 || 1010
*/
/* column definitions {
"book_id": "the unique identifier of the book",
"title": "the title of the book ",
"isbn13": "the International Standard Book Number of the book",
"language_id": "the id of the book language\nMaps to book_language (language_id)",
"num_pages": "the number of the pages",
"publication_date": "the publication date of the book",
"publisher_id": "the id of the publisher\nMaps to publisher (publisher_id)"
}*/
CREATE TABLE book_author
(
book_id INTEGER,
author_id INTEGER,
primary key (book_id, author_id),
foreign key (author_id) references author(author_id),
foreign key (book_id) references book(book_id)
)
/*
1 example row:
SELECT * FROM book_author LIMIT 1;
book_id ||author_id
10539 || 1
*/
/* column definitions {
"book_id": "the id of the book\nMaps to book(book_id)",
"author_id": "the id of the author\nMaps to author(author_id)"
}*/
CREATE TABLE shipping_method
(
method_id INTEGER
primary key,
method_name TEXT,
cost REAL
)
/*
1 example row:
SELECT * FROM shipping_method LIMIT 1;
method_id ||method_name ||cost
1 || Standard || 5.9
*/
/* column definitions {
"method_id": "the unique identifier of the method",
"method_name": "the method name",
"cost": "the cost of the shipping method"
}*/
CREATE TABLE "cust_order"
(
order_id INTEGER
primary key autoincrement,
order_date DATETIME,
customer_id INTEGER
references customer,
shipping_method_id INTEGER
references shipping_method,
dest_address_id INTEGER
references address
)
/*
1 example row:
SELECT * FROM cust_order LIMIT 1;
order_id || order_date ||customer_id ||shipping_method_id ||dest_address_id
1 ||2021-07-14 10:47:19 || 387 || 4 || 1
*/
/* column definitions {
"order_id": "the unique identifier of the customer order",
"order_date": "the date of the order",
"customer_id": "the id of the customer\nMaps to customer(customer_Id)",
"shipping_method_id": "the id of the shipping method\nMaps to shipping_method(method_id)",
"dest_address_id": "the id of the destination address\nMaps to address(address_id)"
}*/
CREATE TABLE "order_history"
(
history_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
status_id INTEGER
references order_status,
status_date DATETIME
)
/*
1 example row:
SELECT * FROM order_history LIMIT 1;
history_id ||order_id ||status_id || status_date
1 || 1 || 1 ||2021-07-14 17:04:28
*/
/* column definitions {
"history_id": "the unique identifier of the order history",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"status_id": "the id of the order\nMaps to order_status(status_id)",
"status_date": "the date of the status updated "
}*/
CREATE TABLE "order_line"
(
line_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
book_id INTEGER
references book,
price REAL
)
/*
1 example row:
SELECT * FROM order_line LIMIT 1;
line_id ||order_id ||book_id ||price
1024 || 2051 || 10720 || 3.19
*/
/* column definitions {
"line_id": "the unique identifier of the order line",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"book_id": "the id of the book\nMaps to book(book_id)",
"price": "the price of the order"
}*/
### Question
What is the name of the first book written by J.K Rowling?
Clarification: "J.K Rowling" is the author_name; first published book refers to book_id where Min(publication_date); name of the book refers to title
| [query_database(**{'query': 'SELECT T1.title FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id WHERE T3.author_name = 'J.K. Rowling' ORDER BY T1.publication_date ASC LIMIT 1'})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE address_status
(
status_id INTEGER
primary key,
address_status TEXT
)
/*
1 example row:
SELECT * FROM address_status LIMIT 1;
status_id ||address_status
1 || Active
*/
/* column definitions {
"status_id": "the unique identifier of the status",
"address_status": "the status of the address"
}*/
CREATE TABLE author
(
author_id INTEGER
primary key,
author_name TEXT
)
/*
1 example row:
SELECT * FROM author LIMIT 1;
author_id || author_name
1 ||A. Bartlett Giamatti
*/
/* column definitions {
"author_id": "the unique identifier of the author",
"author_name": "the name of the author"
}*/
CREATE TABLE book_language
(
language_id INTEGER
primary key,
language_code TEXT,
language_name TEXT
)
/*
1 example row:
SELECT * FROM book_language LIMIT 1;
language_id ||language_code ||language_name
1 || eng || English
*/
/* column definitions {
"language_id": "the unique identifier of the language ",
"language_code": "the language code",
"language_name": "the language name"
}*/
CREATE TABLE country
(
country_id INTEGER
primary key,
country_name TEXT
)
/*
1 example row:
SELECT * FROM country LIMIT 1;
country_id ||country_name
1 || Afghanistan
*/
/* column definitions {
"country_id": "the unique identifier of the country",
"country_name": "the country name"
}*/
CREATE TABLE address
(
address_id INTEGER
primary key,
street_number TEXT,
street_name TEXT,
city TEXT,
country_id INTEGER,
foreign key (country_id) references country(country_id)
)
/*
1 example row:
SELECT * FROM address LIMIT 1;
address_id ||street_number || street_name || city ||country_id
1 || 57 ||Glacier Hill Avenue ||Torbat-e Jām || 95
*/
/* column definitions {
"address_id": "the unique identifier of the address",
"street_number": "the street number of the address",
"street_name": "the street name",
"city": "the city where the address belongs",
"country_id": "the id of the country where the address belongs "
}*/
CREATE TABLE customer
(
customer_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
email TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
customer_id ||first_name ||last_name || email
1 || Ursola || Purdy ||upurdy0@cdbaby.com
*/
/* column definitions {
"customer_id": "the unique identifier of the customer",
"first_name": "the first name of the customer",
"last_name": "the last name of the customer",
"email": "the email of the customer"
}*/
CREATE TABLE customer_address
(
customer_id INTEGER,
address_id INTEGER,
status_id INTEGER,
primary key (customer_id, address_id),
foreign key (address_id) references address(address_id),
foreign key (customer_id) references customer(customer_id)
)
/*
1 example row:
SELECT * FROM customer_address LIMIT 1;
customer_id ||address_id ||status_id
1 || 606 || 1
*/
/* column definitions {
"customer_id": "the id of the customer\nMaps to customer(customer_id)",
"address_id": "the id of the address\nMaps to address(address_id)",
"status_id": "the id of the address status"
}*/
CREATE TABLE order_status
(
status_id INTEGER
primary key,
status_value TEXT
)
/*
1 example row:
SELECT * FROM order_status LIMIT 1;
status_id || status_value
1 ||Order Received
*/
/* column definitions {
"status_id": "the unique identifier of the order status",
"status_value": "the status value"
}*/
CREATE TABLE publisher
(
publisher_id INTEGER
primary key,
publisher_name TEXT
)
/*
1 example row:
SELECT * FROM publisher LIMIT 1;
publisher_id ||publisher_name
1 || 10/18
*/
/* column definitions {
"publisher_id": "the unique identifier of the publisher",
"publisher_name": "the name of the publisher"
}*/
CREATE TABLE book
(
book_id INTEGER
primary key,
title TEXT,
isbn13 TEXT,
language_id INTEGER,
num_pages INTEGER,
publication_date DATE,
publisher_id INTEGER,
foreign key (language_id) references book_language(language_id),
foreign key (publisher_id) references publisher(publisher_id)
)
/*
1 example row:
SELECT * FROM book LIMIT 1;
book_id || title || isbn13 ||language_id ||num_pages ||publication_date ||publisher_id
1 ||The World's First Love: Mary Mother of God ||8987059752 || 2 || 276 || 1996-09-01 || 1010
*/
/* column definitions {
"book_id": "the unique identifier of the book",
"title": "the title of the book ",
"isbn13": "the International Standard Book Number of the book",
"language_id": "the id of the book language\nMaps to book_language (language_id)",
"num_pages": "the number of the pages",
"publication_date": "the publication date of the book",
"publisher_id": "the id of the publisher\nMaps to publisher (publisher_id)"
}*/
CREATE TABLE book_author
(
book_id INTEGER,
author_id INTEGER,
primary key (book_id, author_id),
foreign key (author_id) references author(author_id),
foreign key (book_id) references book(book_id)
)
/*
1 example row:
SELECT * FROM book_author LIMIT 1;
book_id ||author_id
10539 || 1
*/
/* column definitions {
"book_id": "the id of the book\nMaps to book(book_id)",
"author_id": "the id of the author\nMaps to author(author_id)"
}*/
CREATE TABLE shipping_method
(
method_id INTEGER
primary key,
method_name TEXT,
cost REAL
)
/*
1 example row:
SELECT * FROM shipping_method LIMIT 1;
method_id ||method_name ||cost
1 || Standard || 5.9
*/
/* column definitions {
"method_id": "the unique identifier of the method",
"method_name": "the method name",
"cost": "the cost of the shipping method"
}*/
CREATE TABLE "cust_order"
(
order_id INTEGER
primary key autoincrement,
order_date DATETIME,
customer_id INTEGER
references customer,
shipping_method_id INTEGER
references shipping_method,
dest_address_id INTEGER
references address
)
/*
1 example row:
SELECT * FROM cust_order LIMIT 1;
order_id || order_date ||customer_id ||shipping_method_id ||dest_address_id
1 ||2021-07-14 10:47:19 || 387 || 4 || 1
*/
/* column definitions {
"order_id": "the unique identifier of the customer order",
"order_date": "the date of the order",
"customer_id": "the id of the customer\nMaps to customer(customer_Id)",
"shipping_method_id": "the id of the shipping method\nMaps to shipping_method(method_id)",
"dest_address_id": "the id of the destination address\nMaps to address(address_id)"
}*/
CREATE TABLE "order_history"
(
history_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
status_id INTEGER
references order_status,
status_date DATETIME
)
/*
1 example row:
SELECT * FROM order_history LIMIT 1;
history_id ||order_id ||status_id || status_date
1 || 1 || 1 ||2021-07-14 17:04:28
*/
/* column definitions {
"history_id": "the unique identifier of the order history",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"status_id": "the id of the order\nMaps to order_status(status_id)",
"status_date": "the date of the status updated "
}*/
CREATE TABLE "order_line"
(
line_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
book_id INTEGER
references book,
price REAL
)
/*
1 example row:
SELECT * FROM order_line LIMIT 1;
line_id ||order_id ||book_id ||price
1024 || 2051 || 10720 || 3.19
*/
/* column definitions {
"line_id": "the unique identifier of the order line",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"book_id": "the id of the book\nMaps to book(book_id)",
"price": "the price of the order"
}*/
|
5,956 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE address_status
(
status_id INTEGER
primary key,
address_status TEXT
)
/*
1 example row:
SELECT * FROM address_status LIMIT 1;
status_id ||address_status
1 || Active
*/
/* column definitions {
"status_id": "the unique identifier of the status",
"address_status": "the status of the address"
}*/
CREATE TABLE author
(
author_id INTEGER
primary key,
author_name TEXT
)
/*
1 example row:
SELECT * FROM author LIMIT 1;
author_id || author_name
1 ||A. Bartlett Giamatti
*/
/* column definitions {
"author_id": "the unique identifier of the author",
"author_name": "the name of the author"
}*/
CREATE TABLE book_language
(
language_id INTEGER
primary key,
language_code TEXT,
language_name TEXT
)
/*
1 example row:
SELECT * FROM book_language LIMIT 1;
language_id ||language_code ||language_name
1 || eng || English
*/
/* column definitions {
"language_id": "the unique identifier of the language ",
"language_code": "the language code",
"language_name": "the language name"
}*/
CREATE TABLE country
(
country_id INTEGER
primary key,
country_name TEXT
)
/*
1 example row:
SELECT * FROM country LIMIT 1;
country_id ||country_name
1 || Afghanistan
*/
/* column definitions {
"country_id": "the unique identifier of the country",
"country_name": "the country name"
}*/
CREATE TABLE address
(
address_id INTEGER
primary key,
street_number TEXT,
street_name TEXT,
city TEXT,
country_id INTEGER,
foreign key (country_id) references country(country_id)
)
/*
1 example row:
SELECT * FROM address LIMIT 1;
address_id ||street_number || street_name || city ||country_id
1 || 57 ||Glacier Hill Avenue ||Torbat-e Jām || 95
*/
/* column definitions {
"address_id": "the unique identifier of the address",
"street_number": "the street number of the address",
"street_name": "the street name",
"city": "the city where the address belongs",
"country_id": "the id of the country where the address belongs "
}*/
CREATE TABLE customer
(
customer_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
email TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
customer_id ||first_name ||last_name || email
1 || Ursola || Purdy ||upurdy0@cdbaby.com
*/
/* column definitions {
"customer_id": "the unique identifier of the customer",
"first_name": "the first name of the customer",
"last_name": "the last name of the customer",
"email": "the email of the customer"
}*/
CREATE TABLE customer_address
(
customer_id INTEGER,
address_id INTEGER,
status_id INTEGER,
primary key (customer_id, address_id),
foreign key (address_id) references address(address_id),
foreign key (customer_id) references customer(customer_id)
)
/*
1 example row:
SELECT * FROM customer_address LIMIT 1;
customer_id ||address_id ||status_id
1 || 606 || 1
*/
/* column definitions {
"customer_id": "the id of the customer\nMaps to customer(customer_id)",
"address_id": "the id of the address\nMaps to address(address_id)",
"status_id": "the id of the address status"
}*/
CREATE TABLE order_status
(
status_id INTEGER
primary key,
status_value TEXT
)
/*
1 example row:
SELECT * FROM order_status LIMIT 1;
status_id || status_value
1 ||Order Received
*/
/* column definitions {
"status_id": "the unique identifier of the order status",
"status_value": "the status value"
}*/
CREATE TABLE publisher
(
publisher_id INTEGER
primary key,
publisher_name TEXT
)
/*
1 example row:
SELECT * FROM publisher LIMIT 1;
publisher_id ||publisher_name
1 || 10/18
*/
/* column definitions {
"publisher_id": "the unique identifier of the publisher",
"publisher_name": "the name of the publisher"
}*/
CREATE TABLE book
(
book_id INTEGER
primary key,
title TEXT,
isbn13 TEXT,
language_id INTEGER,
num_pages INTEGER,
publication_date DATE,
publisher_id INTEGER,
foreign key (language_id) references book_language(language_id),
foreign key (publisher_id) references publisher(publisher_id)
)
/*
1 example row:
SELECT * FROM book LIMIT 1;
book_id || title || isbn13 ||language_id ||num_pages ||publication_date ||publisher_id
1 ||The World's First Love: Mary Mother of God ||8987059752 || 2 || 276 || 1996-09-01 || 1010
*/
/* column definitions {
"book_id": "the unique identifier of the book",
"title": "the title of the book ",
"isbn13": "the International Standard Book Number of the book",
"language_id": "the id of the book language\nMaps to book_language (language_id)",
"num_pages": "the number of the pages",
"publication_date": "the publication date of the book",
"publisher_id": "the id of the publisher\nMaps to publisher (publisher_id)"
}*/
CREATE TABLE book_author
(
book_id INTEGER,
author_id INTEGER,
primary key (book_id, author_id),
foreign key (author_id) references author(author_id),
foreign key (book_id) references book(book_id)
)
/*
1 example row:
SELECT * FROM book_author LIMIT 1;
book_id ||author_id
10539 || 1
*/
/* column definitions {
"book_id": "the id of the book\nMaps to book(book_id)",
"author_id": "the id of the author\nMaps to author(author_id)"
}*/
CREATE TABLE shipping_method
(
method_id INTEGER
primary key,
method_name TEXT,
cost REAL
)
/*
1 example row:
SELECT * FROM shipping_method LIMIT 1;
method_id ||method_name ||cost
1 || Standard || 5.9
*/
/* column definitions {
"method_id": "the unique identifier of the method",
"method_name": "the method name",
"cost": "the cost of the shipping method"
}*/
CREATE TABLE "cust_order"
(
order_id INTEGER
primary key autoincrement,
order_date DATETIME,
customer_id INTEGER
references customer,
shipping_method_id INTEGER
references shipping_method,
dest_address_id INTEGER
references address
)
/*
1 example row:
SELECT * FROM cust_order LIMIT 1;
order_id || order_date ||customer_id ||shipping_method_id ||dest_address_id
1 ||2021-07-14 10:47:19 || 387 || 4 || 1
*/
/* column definitions {
"order_id": "the unique identifier of the customer order",
"order_date": "the date of the order",
"customer_id": "the id of the customer\nMaps to customer(customer_Id)",
"shipping_method_id": "the id of the shipping method\nMaps to shipping_method(method_id)",
"dest_address_id": "the id of the destination address\nMaps to address(address_id)"
}*/
CREATE TABLE "order_history"
(
history_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
status_id INTEGER
references order_status,
status_date DATETIME
)
/*
1 example row:
SELECT * FROM order_history LIMIT 1;
history_id ||order_id ||status_id || status_date
1 || 1 || 1 ||2021-07-14 17:04:28
*/
/* column definitions {
"history_id": "the unique identifier of the order history",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"status_id": "the id of the order\nMaps to order_status(status_id)",
"status_date": "the date of the status updated "
}*/
CREATE TABLE "order_line"
(
line_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
book_id INTEGER
references book,
price REAL
)
/*
1 example row:
SELECT * FROM order_line LIMIT 1;
line_id ||order_id ||book_id ||price
1024 || 2051 || 10720 || 3.19
*/
/* column definitions {
"line_id": "the unique identifier of the order line",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"book_id": "the id of the book\nMaps to book(book_id)",
"price": "the price of the order"
}*/
### Question
How many books by William Shakespeare were published by Penguin Classics?
Clarification: "William Shakespeare" is the author_name; "Penguin Classics" is the publisher_name
| [query_database(**{'query': 'SELECT COUNT(*) FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id INNER JOIN publisher AS T4 ON T4.publisher_id = T1.publisher_id WHERE T3.author_name = 'William Shakespeare' AND T4.publisher_name = 'Penguin Classics''})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE address_status
(
status_id INTEGER
primary key,
address_status TEXT
)
/*
1 example row:
SELECT * FROM address_status LIMIT 1;
status_id ||address_status
1 || Active
*/
/* column definitions {
"status_id": "the unique identifier of the status",
"address_status": "the status of the address"
}*/
CREATE TABLE author
(
author_id INTEGER
primary key,
author_name TEXT
)
/*
1 example row:
SELECT * FROM author LIMIT 1;
author_id || author_name
1 ||A. Bartlett Giamatti
*/
/* column definitions {
"author_id": "the unique identifier of the author",
"author_name": "the name of the author"
}*/
CREATE TABLE book_language
(
language_id INTEGER
primary key,
language_code TEXT,
language_name TEXT
)
/*
1 example row:
SELECT * FROM book_language LIMIT 1;
language_id ||language_code ||language_name
1 || eng || English
*/
/* column definitions {
"language_id": "the unique identifier of the language ",
"language_code": "the language code",
"language_name": "the language name"
}*/
CREATE TABLE country
(
country_id INTEGER
primary key,
country_name TEXT
)
/*
1 example row:
SELECT * FROM country LIMIT 1;
country_id ||country_name
1 || Afghanistan
*/
/* column definitions {
"country_id": "the unique identifier of the country",
"country_name": "the country name"
}*/
CREATE TABLE address
(
address_id INTEGER
primary key,
street_number TEXT,
street_name TEXT,
city TEXT,
country_id INTEGER,
foreign key (country_id) references country(country_id)
)
/*
1 example row:
SELECT * FROM address LIMIT 1;
address_id ||street_number || street_name || city ||country_id
1 || 57 ||Glacier Hill Avenue ||Torbat-e Jām || 95
*/
/* column definitions {
"address_id": "the unique identifier of the address",
"street_number": "the street number of the address",
"street_name": "the street name",
"city": "the city where the address belongs",
"country_id": "the id of the country where the address belongs "
}*/
CREATE TABLE customer
(
customer_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
email TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
customer_id ||first_name ||last_name || email
1 || Ursola || Purdy ||upurdy0@cdbaby.com
*/
/* column definitions {
"customer_id": "the unique identifier of the customer",
"first_name": "the first name of the customer",
"last_name": "the last name of the customer",
"email": "the email of the customer"
}*/
CREATE TABLE customer_address
(
customer_id INTEGER,
address_id INTEGER,
status_id INTEGER,
primary key (customer_id, address_id),
foreign key (address_id) references address(address_id),
foreign key (customer_id) references customer(customer_id)
)
/*
1 example row:
SELECT * FROM customer_address LIMIT 1;
customer_id ||address_id ||status_id
1 || 606 || 1
*/
/* column definitions {
"customer_id": "the id of the customer\nMaps to customer(customer_id)",
"address_id": "the id of the address\nMaps to address(address_id)",
"status_id": "the id of the address status"
}*/
CREATE TABLE order_status
(
status_id INTEGER
primary key,
status_value TEXT
)
/*
1 example row:
SELECT * FROM order_status LIMIT 1;
status_id || status_value
1 ||Order Received
*/
/* column definitions {
"status_id": "the unique identifier of the order status",
"status_value": "the status value"
}*/
CREATE TABLE publisher
(
publisher_id INTEGER
primary key,
publisher_name TEXT
)
/*
1 example row:
SELECT * FROM publisher LIMIT 1;
publisher_id ||publisher_name
1 || 10/18
*/
/* column definitions {
"publisher_id": "the unique identifier of the publisher",
"publisher_name": "the name of the publisher"
}*/
CREATE TABLE book
(
book_id INTEGER
primary key,
title TEXT,
isbn13 TEXT,
language_id INTEGER,
num_pages INTEGER,
publication_date DATE,
publisher_id INTEGER,
foreign key (language_id) references book_language(language_id),
foreign key (publisher_id) references publisher(publisher_id)
)
/*
1 example row:
SELECT * FROM book LIMIT 1;
book_id || title || isbn13 ||language_id ||num_pages ||publication_date ||publisher_id
1 ||The World's First Love: Mary Mother of God ||8987059752 || 2 || 276 || 1996-09-01 || 1010
*/
/* column definitions {
"book_id": "the unique identifier of the book",
"title": "the title of the book ",
"isbn13": "the International Standard Book Number of the book",
"language_id": "the id of the book language\nMaps to book_language (language_id)",
"num_pages": "the number of the pages",
"publication_date": "the publication date of the book",
"publisher_id": "the id of the publisher\nMaps to publisher (publisher_id)"
}*/
CREATE TABLE book_author
(
book_id INTEGER,
author_id INTEGER,
primary key (book_id, author_id),
foreign key (author_id) references author(author_id),
foreign key (book_id) references book(book_id)
)
/*
1 example row:
SELECT * FROM book_author LIMIT 1;
book_id ||author_id
10539 || 1
*/
/* column definitions {
"book_id": "the id of the book\nMaps to book(book_id)",
"author_id": "the id of the author\nMaps to author(author_id)"
}*/
CREATE TABLE shipping_method
(
method_id INTEGER
primary key,
method_name TEXT,
cost REAL
)
/*
1 example row:
SELECT * FROM shipping_method LIMIT 1;
method_id ||method_name ||cost
1 || Standard || 5.9
*/
/* column definitions {
"method_id": "the unique identifier of the method",
"method_name": "the method name",
"cost": "the cost of the shipping method"
}*/
CREATE TABLE "cust_order"
(
order_id INTEGER
primary key autoincrement,
order_date DATETIME,
customer_id INTEGER
references customer,
shipping_method_id INTEGER
references shipping_method,
dest_address_id INTEGER
references address
)
/*
1 example row:
SELECT * FROM cust_order LIMIT 1;
order_id || order_date ||customer_id ||shipping_method_id ||dest_address_id
1 ||2021-07-14 10:47:19 || 387 || 4 || 1
*/
/* column definitions {
"order_id": "the unique identifier of the customer order",
"order_date": "the date of the order",
"customer_id": "the id of the customer\nMaps to customer(customer_Id)",
"shipping_method_id": "the id of the shipping method\nMaps to shipping_method(method_id)",
"dest_address_id": "the id of the destination address\nMaps to address(address_id)"
}*/
CREATE TABLE "order_history"
(
history_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
status_id INTEGER
references order_status,
status_date DATETIME
)
/*
1 example row:
SELECT * FROM order_history LIMIT 1;
history_id ||order_id ||status_id || status_date
1 || 1 || 1 ||2021-07-14 17:04:28
*/
/* column definitions {
"history_id": "the unique identifier of the order history",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"status_id": "the id of the order\nMaps to order_status(status_id)",
"status_date": "the date of the status updated "
}*/
CREATE TABLE "order_line"
(
line_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
book_id INTEGER
references book,
price REAL
)
/*
1 example row:
SELECT * FROM order_line LIMIT 1;
line_id ||order_id ||book_id ||price
1024 || 2051 || 10720 || 3.19
*/
/* column definitions {
"line_id": "the unique identifier of the order line",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"book_id": "the id of the book\nMaps to book(book_id)",
"price": "the price of the order"
}*/
|
5,960 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE address_status
(
status_id INTEGER
primary key,
address_status TEXT
)
/*
1 example row:
SELECT * FROM address_status LIMIT 1;
status_id ||address_status
1 || Active
*/
/* column definitions {
"status_id": "the unique identifier of the status",
"address_status": "the status of the address"
}*/
CREATE TABLE author
(
author_id INTEGER
primary key,
author_name TEXT
)
/*
1 example row:
SELECT * FROM author LIMIT 1;
author_id || author_name
1 ||A. Bartlett Giamatti
*/
/* column definitions {
"author_id": "the unique identifier of the author",
"author_name": "the name of the author"
}*/
CREATE TABLE book_language
(
language_id INTEGER
primary key,
language_code TEXT,
language_name TEXT
)
/*
1 example row:
SELECT * FROM book_language LIMIT 1;
language_id ||language_code ||language_name
1 || eng || English
*/
/* column definitions {
"language_id": "the unique identifier of the language ",
"language_code": "the language code",
"language_name": "the language name"
}*/
CREATE TABLE country
(
country_id INTEGER
primary key,
country_name TEXT
)
/*
1 example row:
SELECT * FROM country LIMIT 1;
country_id ||country_name
1 || Afghanistan
*/
/* column definitions {
"country_id": "the unique identifier of the country",
"country_name": "the country name"
}*/
CREATE TABLE address
(
address_id INTEGER
primary key,
street_number TEXT,
street_name TEXT,
city TEXT,
country_id INTEGER,
foreign key (country_id) references country(country_id)
)
/*
1 example row:
SELECT * FROM address LIMIT 1;
address_id ||street_number || street_name || city ||country_id
1 || 57 ||Glacier Hill Avenue ||Torbat-e Jām || 95
*/
/* column definitions {
"address_id": "the unique identifier of the address",
"street_number": "the street number of the address",
"street_name": "the street name",
"city": "the city where the address belongs",
"country_id": "the id of the country where the address belongs "
}*/
CREATE TABLE customer
(
customer_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
email TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
customer_id ||first_name ||last_name || email
1 || Ursola || Purdy ||upurdy0@cdbaby.com
*/
/* column definitions {
"customer_id": "the unique identifier of the customer",
"first_name": "the first name of the customer",
"last_name": "the last name of the customer",
"email": "the email of the customer"
}*/
CREATE TABLE customer_address
(
customer_id INTEGER,
address_id INTEGER,
status_id INTEGER,
primary key (customer_id, address_id),
foreign key (address_id) references address(address_id),
foreign key (customer_id) references customer(customer_id)
)
/*
1 example row:
SELECT * FROM customer_address LIMIT 1;
customer_id ||address_id ||status_id
1 || 606 || 1
*/
/* column definitions {
"customer_id": "the id of the customer\nMaps to customer(customer_id)",
"address_id": "the id of the address\nMaps to address(address_id)",
"status_id": "the id of the address status"
}*/
CREATE TABLE order_status
(
status_id INTEGER
primary key,
status_value TEXT
)
/*
1 example row:
SELECT * FROM order_status LIMIT 1;
status_id || status_value
1 ||Order Received
*/
/* column definitions {
"status_id": "the unique identifier of the order status",
"status_value": "the status value"
}*/
CREATE TABLE publisher
(
publisher_id INTEGER
primary key,
publisher_name TEXT
)
/*
1 example row:
SELECT * FROM publisher LIMIT 1;
publisher_id ||publisher_name
1 || 10/18
*/
/* column definitions {
"publisher_id": "the unique identifier of the publisher",
"publisher_name": "the name of the publisher"
}*/
CREATE TABLE book
(
book_id INTEGER
primary key,
title TEXT,
isbn13 TEXT,
language_id INTEGER,
num_pages INTEGER,
publication_date DATE,
publisher_id INTEGER,
foreign key (language_id) references book_language(language_id),
foreign key (publisher_id) references publisher(publisher_id)
)
/*
1 example row:
SELECT * FROM book LIMIT 1;
book_id || title || isbn13 ||language_id ||num_pages ||publication_date ||publisher_id
1 ||The World's First Love: Mary Mother of God ||8987059752 || 2 || 276 || 1996-09-01 || 1010
*/
/* column definitions {
"book_id": "the unique identifier of the book",
"title": "the title of the book ",
"isbn13": "the International Standard Book Number of the book",
"language_id": "the id of the book language\nMaps to book_language (language_id)",
"num_pages": "the number of the pages",
"publication_date": "the publication date of the book",
"publisher_id": "the id of the publisher\nMaps to publisher (publisher_id)"
}*/
CREATE TABLE book_author
(
book_id INTEGER,
author_id INTEGER,
primary key (book_id, author_id),
foreign key (author_id) references author(author_id),
foreign key (book_id) references book(book_id)
)
/*
1 example row:
SELECT * FROM book_author LIMIT 1;
book_id ||author_id
10539 || 1
*/
/* column definitions {
"book_id": "the id of the book\nMaps to book(book_id)",
"author_id": "the id of the author\nMaps to author(author_id)"
}*/
CREATE TABLE shipping_method
(
method_id INTEGER
primary key,
method_name TEXT,
cost REAL
)
/*
1 example row:
SELECT * FROM shipping_method LIMIT 1;
method_id ||method_name ||cost
1 || Standard || 5.9
*/
/* column definitions {
"method_id": "the unique identifier of the method",
"method_name": "the method name",
"cost": "the cost of the shipping method"
}*/
CREATE TABLE "cust_order"
(
order_id INTEGER
primary key autoincrement,
order_date DATETIME,
customer_id INTEGER
references customer,
shipping_method_id INTEGER
references shipping_method,
dest_address_id INTEGER
references address
)
/*
1 example row:
SELECT * FROM cust_order LIMIT 1;
order_id || order_date ||customer_id ||shipping_method_id ||dest_address_id
1 ||2021-07-14 10:47:19 || 387 || 4 || 1
*/
/* column definitions {
"order_id": "the unique identifier of the customer order",
"order_date": "the date of the order",
"customer_id": "the id of the customer\nMaps to customer(customer_Id)",
"shipping_method_id": "the id of the shipping method\nMaps to shipping_method(method_id)",
"dest_address_id": "the id of the destination address\nMaps to address(address_id)"
}*/
CREATE TABLE "order_history"
(
history_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
status_id INTEGER
references order_status,
status_date DATETIME
)
/*
1 example row:
SELECT * FROM order_history LIMIT 1;
history_id ||order_id ||status_id || status_date
1 || 1 || 1 ||2021-07-14 17:04:28
*/
/* column definitions {
"history_id": "the unique identifier of the order history",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"status_id": "the id of the order\nMaps to order_status(status_id)",
"status_date": "the date of the status updated "
}*/
CREATE TABLE "order_line"
(
line_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
book_id INTEGER
references book,
price REAL
)
/*
1 example row:
SELECT * FROM order_line LIMIT 1;
line_id ||order_id ||book_id ||price
1024 || 2051 || 10720 || 3.19
*/
/* column definitions {
"line_id": "the unique identifier of the order line",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"book_id": "the id of the book\nMaps to book(book_id)",
"price": "the price of the order"
}*/
### Question
How many of the books authored by Al Gore have less than 400 pages?
Clarification: "AI Gore" is the author_name; have less than 400 pages refers to num_pages < 400
| [query_database(**{'query': 'SELECT COUNT(*) FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id WHERE T3.author_name = 'Al Gore' AND T1.num_pages < 400'})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE address_status
(
status_id INTEGER
primary key,
address_status TEXT
)
/*
1 example row:
SELECT * FROM address_status LIMIT 1;
status_id ||address_status
1 || Active
*/
/* column definitions {
"status_id": "the unique identifier of the status",
"address_status": "the status of the address"
}*/
CREATE TABLE author
(
author_id INTEGER
primary key,
author_name TEXT
)
/*
1 example row:
SELECT * FROM author LIMIT 1;
author_id || author_name
1 ||A. Bartlett Giamatti
*/
/* column definitions {
"author_id": "the unique identifier of the author",
"author_name": "the name of the author"
}*/
CREATE TABLE book_language
(
language_id INTEGER
primary key,
language_code TEXT,
language_name TEXT
)
/*
1 example row:
SELECT * FROM book_language LIMIT 1;
language_id ||language_code ||language_name
1 || eng || English
*/
/* column definitions {
"language_id": "the unique identifier of the language ",
"language_code": "the language code",
"language_name": "the language name"
}*/
CREATE TABLE country
(
country_id INTEGER
primary key,
country_name TEXT
)
/*
1 example row:
SELECT * FROM country LIMIT 1;
country_id ||country_name
1 || Afghanistan
*/
/* column definitions {
"country_id": "the unique identifier of the country",
"country_name": "the country name"
}*/
CREATE TABLE address
(
address_id INTEGER
primary key,
street_number TEXT,
street_name TEXT,
city TEXT,
country_id INTEGER,
foreign key (country_id) references country(country_id)
)
/*
1 example row:
SELECT * FROM address LIMIT 1;
address_id ||street_number || street_name || city ||country_id
1 || 57 ||Glacier Hill Avenue ||Torbat-e Jām || 95
*/
/* column definitions {
"address_id": "the unique identifier of the address",
"street_number": "the street number of the address",
"street_name": "the street name",
"city": "the city where the address belongs",
"country_id": "the id of the country where the address belongs "
}*/
CREATE TABLE customer
(
customer_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
email TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
customer_id ||first_name ||last_name || email
1 || Ursola || Purdy ||upurdy0@cdbaby.com
*/
/* column definitions {
"customer_id": "the unique identifier of the customer",
"first_name": "the first name of the customer",
"last_name": "the last name of the customer",
"email": "the email of the customer"
}*/
CREATE TABLE customer_address
(
customer_id INTEGER,
address_id INTEGER,
status_id INTEGER,
primary key (customer_id, address_id),
foreign key (address_id) references address(address_id),
foreign key (customer_id) references customer(customer_id)
)
/*
1 example row:
SELECT * FROM customer_address LIMIT 1;
customer_id ||address_id ||status_id
1 || 606 || 1
*/
/* column definitions {
"customer_id": "the id of the customer\nMaps to customer(customer_id)",
"address_id": "the id of the address\nMaps to address(address_id)",
"status_id": "the id of the address status"
}*/
CREATE TABLE order_status
(
status_id INTEGER
primary key,
status_value TEXT
)
/*
1 example row:
SELECT * FROM order_status LIMIT 1;
status_id || status_value
1 ||Order Received
*/
/* column definitions {
"status_id": "the unique identifier of the order status",
"status_value": "the status value"
}*/
CREATE TABLE publisher
(
publisher_id INTEGER
primary key,
publisher_name TEXT
)
/*
1 example row:
SELECT * FROM publisher LIMIT 1;
publisher_id ||publisher_name
1 || 10/18
*/
/* column definitions {
"publisher_id": "the unique identifier of the publisher",
"publisher_name": "the name of the publisher"
}*/
CREATE TABLE book
(
book_id INTEGER
primary key,
title TEXT,
isbn13 TEXT,
language_id INTEGER,
num_pages INTEGER,
publication_date DATE,
publisher_id INTEGER,
foreign key (language_id) references book_language(language_id),
foreign key (publisher_id) references publisher(publisher_id)
)
/*
1 example row:
SELECT * FROM book LIMIT 1;
book_id || title || isbn13 ||language_id ||num_pages ||publication_date ||publisher_id
1 ||The World's First Love: Mary Mother of God ||8987059752 || 2 || 276 || 1996-09-01 || 1010
*/
/* column definitions {
"book_id": "the unique identifier of the book",
"title": "the title of the book ",
"isbn13": "the International Standard Book Number of the book",
"language_id": "the id of the book language\nMaps to book_language (language_id)",
"num_pages": "the number of the pages",
"publication_date": "the publication date of the book",
"publisher_id": "the id of the publisher\nMaps to publisher (publisher_id)"
}*/
CREATE TABLE book_author
(
book_id INTEGER,
author_id INTEGER,
primary key (book_id, author_id),
foreign key (author_id) references author(author_id),
foreign key (book_id) references book(book_id)
)
/*
1 example row:
SELECT * FROM book_author LIMIT 1;
book_id ||author_id
10539 || 1
*/
/* column definitions {
"book_id": "the id of the book\nMaps to book(book_id)",
"author_id": "the id of the author\nMaps to author(author_id)"
}*/
CREATE TABLE shipping_method
(
method_id INTEGER
primary key,
method_name TEXT,
cost REAL
)
/*
1 example row:
SELECT * FROM shipping_method LIMIT 1;
method_id ||method_name ||cost
1 || Standard || 5.9
*/
/* column definitions {
"method_id": "the unique identifier of the method",
"method_name": "the method name",
"cost": "the cost of the shipping method"
}*/
CREATE TABLE "cust_order"
(
order_id INTEGER
primary key autoincrement,
order_date DATETIME,
customer_id INTEGER
references customer,
shipping_method_id INTEGER
references shipping_method,
dest_address_id INTEGER
references address
)
/*
1 example row:
SELECT * FROM cust_order LIMIT 1;
order_id || order_date ||customer_id ||shipping_method_id ||dest_address_id
1 ||2021-07-14 10:47:19 || 387 || 4 || 1
*/
/* column definitions {
"order_id": "the unique identifier of the customer order",
"order_date": "the date of the order",
"customer_id": "the id of the customer\nMaps to customer(customer_Id)",
"shipping_method_id": "the id of the shipping method\nMaps to shipping_method(method_id)",
"dest_address_id": "the id of the destination address\nMaps to address(address_id)"
}*/
CREATE TABLE "order_history"
(
history_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
status_id INTEGER
references order_status,
status_date DATETIME
)
/*
1 example row:
SELECT * FROM order_history LIMIT 1;
history_id ||order_id ||status_id || status_date
1 || 1 || 1 ||2021-07-14 17:04:28
*/
/* column definitions {
"history_id": "the unique identifier of the order history",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"status_id": "the id of the order\nMaps to order_status(status_id)",
"status_date": "the date of the status updated "
}*/
CREATE TABLE "order_line"
(
line_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
book_id INTEGER
references book,
price REAL
)
/*
1 example row:
SELECT * FROM order_line LIMIT 1;
line_id ||order_id ||book_id ||price
1024 || 2051 || 10720 || 3.19
*/
/* column definitions {
"line_id": "the unique identifier of the order line",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"book_id": "the id of the book\nMaps to book(book_id)",
"price": "the price of the order"
}*/
|
5,966 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE address_status
(
status_id INTEGER
primary key,
address_status TEXT
)
/*
1 example row:
SELECT * FROM address_status LIMIT 1;
status_id ||address_status
1 || Active
*/
/* column definitions {
"status_id": "the unique identifier of the status",
"address_status": "the status of the address"
}*/
CREATE TABLE author
(
author_id INTEGER
primary key,
author_name TEXT
)
/*
1 example row:
SELECT * FROM author LIMIT 1;
author_id || author_name
1 ||A. Bartlett Giamatti
*/
/* column definitions {
"author_id": "the unique identifier of the author",
"author_name": "the name of the author"
}*/
CREATE TABLE book_language
(
language_id INTEGER
primary key,
language_code TEXT,
language_name TEXT
)
/*
1 example row:
SELECT * FROM book_language LIMIT 1;
language_id ||language_code ||language_name
1 || eng || English
*/
/* column definitions {
"language_id": "the unique identifier of the language ",
"language_code": "the language code",
"language_name": "the language name"
}*/
CREATE TABLE country
(
country_id INTEGER
primary key,
country_name TEXT
)
/*
1 example row:
SELECT * FROM country LIMIT 1;
country_id ||country_name
1 || Afghanistan
*/
/* column definitions {
"country_id": "the unique identifier of the country",
"country_name": "the country name"
}*/
CREATE TABLE address
(
address_id INTEGER
primary key,
street_number TEXT,
street_name TEXT,
city TEXT,
country_id INTEGER,
foreign key (country_id) references country(country_id)
)
/*
1 example row:
SELECT * FROM address LIMIT 1;
address_id ||street_number || street_name || city ||country_id
1 || 57 ||Glacier Hill Avenue ||Torbat-e Jām || 95
*/
/* column definitions {
"address_id": "the unique identifier of the address",
"street_number": "the street number of the address",
"street_name": "the street name",
"city": "the city where the address belongs",
"country_id": "the id of the country where the address belongs "
}*/
CREATE TABLE customer
(
customer_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
email TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
customer_id ||first_name ||last_name || email
1 || Ursola || Purdy ||upurdy0@cdbaby.com
*/
/* column definitions {
"customer_id": "the unique identifier of the customer",
"first_name": "the first name of the customer",
"last_name": "the last name of the customer",
"email": "the email of the customer"
}*/
CREATE TABLE customer_address
(
customer_id INTEGER,
address_id INTEGER,
status_id INTEGER,
primary key (customer_id, address_id),
foreign key (address_id) references address(address_id),
foreign key (customer_id) references customer(customer_id)
)
/*
1 example row:
SELECT * FROM customer_address LIMIT 1;
customer_id ||address_id ||status_id
1 || 606 || 1
*/
/* column definitions {
"customer_id": "the id of the customer\nMaps to customer(customer_id)",
"address_id": "the id of the address\nMaps to address(address_id)",
"status_id": "the id of the address status"
}*/
CREATE TABLE order_status
(
status_id INTEGER
primary key,
status_value TEXT
)
/*
1 example row:
SELECT * FROM order_status LIMIT 1;
status_id || status_value
1 ||Order Received
*/
/* column definitions {
"status_id": "the unique identifier of the order status",
"status_value": "the status value"
}*/
CREATE TABLE publisher
(
publisher_id INTEGER
primary key,
publisher_name TEXT
)
/*
1 example row:
SELECT * FROM publisher LIMIT 1;
publisher_id ||publisher_name
1 || 10/18
*/
/* column definitions {
"publisher_id": "the unique identifier of the publisher",
"publisher_name": "the name of the publisher"
}*/
CREATE TABLE book
(
book_id INTEGER
primary key,
title TEXT,
isbn13 TEXT,
language_id INTEGER,
num_pages INTEGER,
publication_date DATE,
publisher_id INTEGER,
foreign key (language_id) references book_language(language_id),
foreign key (publisher_id) references publisher(publisher_id)
)
/*
1 example row:
SELECT * FROM book LIMIT 1;
book_id || title || isbn13 ||language_id ||num_pages ||publication_date ||publisher_id
1 ||The World's First Love: Mary Mother of God ||8987059752 || 2 || 276 || 1996-09-01 || 1010
*/
/* column definitions {
"book_id": "the unique identifier of the book",
"title": "the title of the book ",
"isbn13": "the International Standard Book Number of the book",
"language_id": "the id of the book language\nMaps to book_language (language_id)",
"num_pages": "the number of the pages",
"publication_date": "the publication date of the book",
"publisher_id": "the id of the publisher\nMaps to publisher (publisher_id)"
}*/
CREATE TABLE book_author
(
book_id INTEGER,
author_id INTEGER,
primary key (book_id, author_id),
foreign key (author_id) references author(author_id),
foreign key (book_id) references book(book_id)
)
/*
1 example row:
SELECT * FROM book_author LIMIT 1;
book_id ||author_id
10539 || 1
*/
/* column definitions {
"book_id": "the id of the book\nMaps to book(book_id)",
"author_id": "the id of the author\nMaps to author(author_id)"
}*/
CREATE TABLE shipping_method
(
method_id INTEGER
primary key,
method_name TEXT,
cost REAL
)
/*
1 example row:
SELECT * FROM shipping_method LIMIT 1;
method_id ||method_name ||cost
1 || Standard || 5.9
*/
/* column definitions {
"method_id": "the unique identifier of the method",
"method_name": "the method name",
"cost": "the cost of the shipping method"
}*/
CREATE TABLE "cust_order"
(
order_id INTEGER
primary key autoincrement,
order_date DATETIME,
customer_id INTEGER
references customer,
shipping_method_id INTEGER
references shipping_method,
dest_address_id INTEGER
references address
)
/*
1 example row:
SELECT * FROM cust_order LIMIT 1;
order_id || order_date ||customer_id ||shipping_method_id ||dest_address_id
1 ||2021-07-14 10:47:19 || 387 || 4 || 1
*/
/* column definitions {
"order_id": "the unique identifier of the customer order",
"order_date": "the date of the order",
"customer_id": "the id of the customer\nMaps to customer(customer_Id)",
"shipping_method_id": "the id of the shipping method\nMaps to shipping_method(method_id)",
"dest_address_id": "the id of the destination address\nMaps to address(address_id)"
}*/
CREATE TABLE "order_history"
(
history_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
status_id INTEGER
references order_status,
status_date DATETIME
)
/*
1 example row:
SELECT * FROM order_history LIMIT 1;
history_id ||order_id ||status_id || status_date
1 || 1 || 1 ||2021-07-14 17:04:28
*/
/* column definitions {
"history_id": "the unique identifier of the order history",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"status_id": "the id of the order\nMaps to order_status(status_id)",
"status_date": "the date of the status updated "
}*/
CREATE TABLE "order_line"
(
line_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
book_id INTEGER
references book,
price REAL
)
/*
1 example row:
SELECT * FROM order_line LIMIT 1;
line_id ||order_id ||book_id ||price
1024 || 2051 || 10720 || 3.19
*/
/* column definitions {
"line_id": "the unique identifier of the order line",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"book_id": "the id of the book\nMaps to book(book_id)",
"price": "the price of the order"
}*/
### Question
Among the books that cost less than 1 dollar, how many were published by Berkley Trade?
Clarification: book cost less than 1 dollar refers to price < 1; 'Berkley Trade' is the publisher_name;
| [query_database(**{'query': 'SELECT COUNT(*) FROM publisher AS T1 INNER JOIN book AS T2 ON T1.publisher_id = T2.publisher_id INNER JOIN order_line AS T3 ON T3.book_id = T2.book_id WHERE T1.publisher_name = 'Berkley' AND T3.price < 1'})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE address_status
(
status_id INTEGER
primary key,
address_status TEXT
)
/*
1 example row:
SELECT * FROM address_status LIMIT 1;
status_id ||address_status
1 || Active
*/
/* column definitions {
"status_id": "the unique identifier of the status",
"address_status": "the status of the address"
}*/
CREATE TABLE author
(
author_id INTEGER
primary key,
author_name TEXT
)
/*
1 example row:
SELECT * FROM author LIMIT 1;
author_id || author_name
1 ||A. Bartlett Giamatti
*/
/* column definitions {
"author_id": "the unique identifier of the author",
"author_name": "the name of the author"
}*/
CREATE TABLE book_language
(
language_id INTEGER
primary key,
language_code TEXT,
language_name TEXT
)
/*
1 example row:
SELECT * FROM book_language LIMIT 1;
language_id ||language_code ||language_name
1 || eng || English
*/
/* column definitions {
"language_id": "the unique identifier of the language ",
"language_code": "the language code",
"language_name": "the language name"
}*/
CREATE TABLE country
(
country_id INTEGER
primary key,
country_name TEXT
)
/*
1 example row:
SELECT * FROM country LIMIT 1;
country_id ||country_name
1 || Afghanistan
*/
/* column definitions {
"country_id": "the unique identifier of the country",
"country_name": "the country name"
}*/
CREATE TABLE address
(
address_id INTEGER
primary key,
street_number TEXT,
street_name TEXT,
city TEXT,
country_id INTEGER,
foreign key (country_id) references country(country_id)
)
/*
1 example row:
SELECT * FROM address LIMIT 1;
address_id ||street_number || street_name || city ||country_id
1 || 57 ||Glacier Hill Avenue ||Torbat-e Jām || 95
*/
/* column definitions {
"address_id": "the unique identifier of the address",
"street_number": "the street number of the address",
"street_name": "the street name",
"city": "the city where the address belongs",
"country_id": "the id of the country where the address belongs "
}*/
CREATE TABLE customer
(
customer_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
email TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
customer_id ||first_name ||last_name || email
1 || Ursola || Purdy ||upurdy0@cdbaby.com
*/
/* column definitions {
"customer_id": "the unique identifier of the customer",
"first_name": "the first name of the customer",
"last_name": "the last name of the customer",
"email": "the email of the customer"
}*/
CREATE TABLE customer_address
(
customer_id INTEGER,
address_id INTEGER,
status_id INTEGER,
primary key (customer_id, address_id),
foreign key (address_id) references address(address_id),
foreign key (customer_id) references customer(customer_id)
)
/*
1 example row:
SELECT * FROM customer_address LIMIT 1;
customer_id ||address_id ||status_id
1 || 606 || 1
*/
/* column definitions {
"customer_id": "the id of the customer\nMaps to customer(customer_id)",
"address_id": "the id of the address\nMaps to address(address_id)",
"status_id": "the id of the address status"
}*/
CREATE TABLE order_status
(
status_id INTEGER
primary key,
status_value TEXT
)
/*
1 example row:
SELECT * FROM order_status LIMIT 1;
status_id || status_value
1 ||Order Received
*/
/* column definitions {
"status_id": "the unique identifier of the order status",
"status_value": "the status value"
}*/
CREATE TABLE publisher
(
publisher_id INTEGER
primary key,
publisher_name TEXT
)
/*
1 example row:
SELECT * FROM publisher LIMIT 1;
publisher_id ||publisher_name
1 || 10/18
*/
/* column definitions {
"publisher_id": "the unique identifier of the publisher",
"publisher_name": "the name of the publisher"
}*/
CREATE TABLE book
(
book_id INTEGER
primary key,
title TEXT,
isbn13 TEXT,
language_id INTEGER,
num_pages INTEGER,
publication_date DATE,
publisher_id INTEGER,
foreign key (language_id) references book_language(language_id),
foreign key (publisher_id) references publisher(publisher_id)
)
/*
1 example row:
SELECT * FROM book LIMIT 1;
book_id || title || isbn13 ||language_id ||num_pages ||publication_date ||publisher_id
1 ||The World's First Love: Mary Mother of God ||8987059752 || 2 || 276 || 1996-09-01 || 1010
*/
/* column definitions {
"book_id": "the unique identifier of the book",
"title": "the title of the book ",
"isbn13": "the International Standard Book Number of the book",
"language_id": "the id of the book language\nMaps to book_language (language_id)",
"num_pages": "the number of the pages",
"publication_date": "the publication date of the book",
"publisher_id": "the id of the publisher\nMaps to publisher (publisher_id)"
}*/
CREATE TABLE book_author
(
book_id INTEGER,
author_id INTEGER,
primary key (book_id, author_id),
foreign key (author_id) references author(author_id),
foreign key (book_id) references book(book_id)
)
/*
1 example row:
SELECT * FROM book_author LIMIT 1;
book_id ||author_id
10539 || 1
*/
/* column definitions {
"book_id": "the id of the book\nMaps to book(book_id)",
"author_id": "the id of the author\nMaps to author(author_id)"
}*/
CREATE TABLE shipping_method
(
method_id INTEGER
primary key,
method_name TEXT,
cost REAL
)
/*
1 example row:
SELECT * FROM shipping_method LIMIT 1;
method_id ||method_name ||cost
1 || Standard || 5.9
*/
/* column definitions {
"method_id": "the unique identifier of the method",
"method_name": "the method name",
"cost": "the cost of the shipping method"
}*/
CREATE TABLE "cust_order"
(
order_id INTEGER
primary key autoincrement,
order_date DATETIME,
customer_id INTEGER
references customer,
shipping_method_id INTEGER
references shipping_method,
dest_address_id INTEGER
references address
)
/*
1 example row:
SELECT * FROM cust_order LIMIT 1;
order_id || order_date ||customer_id ||shipping_method_id ||dest_address_id
1 ||2021-07-14 10:47:19 || 387 || 4 || 1
*/
/* column definitions {
"order_id": "the unique identifier of the customer order",
"order_date": "the date of the order",
"customer_id": "the id of the customer\nMaps to customer(customer_Id)",
"shipping_method_id": "the id of the shipping method\nMaps to shipping_method(method_id)",
"dest_address_id": "the id of the destination address\nMaps to address(address_id)"
}*/
CREATE TABLE "order_history"
(
history_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
status_id INTEGER
references order_status,
status_date DATETIME
)
/*
1 example row:
SELECT * FROM order_history LIMIT 1;
history_id ||order_id ||status_id || status_date
1 || 1 || 1 ||2021-07-14 17:04:28
*/
/* column definitions {
"history_id": "the unique identifier of the order history",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"status_id": "the id of the order\nMaps to order_status(status_id)",
"status_date": "the date of the status updated "
}*/
CREATE TABLE "order_line"
(
line_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
book_id INTEGER
references book,
price REAL
)
/*
1 example row:
SELECT * FROM order_line LIMIT 1;
line_id ||order_id ||book_id ||price
1024 || 2051 || 10720 || 3.19
*/
/* column definitions {
"line_id": "the unique identifier of the order line",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"book_id": "the id of the book\nMaps to book(book_id)",
"price": "the price of the order"
}*/
|
5,970 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE address_status
(
status_id INTEGER
primary key,
address_status TEXT
)
/*
1 example row:
SELECT * FROM address_status LIMIT 1;
status_id ||address_status
1 || Active
*/
/* column definitions {
"status_id": "the unique identifier of the status",
"address_status": "the status of the address"
}*/
CREATE TABLE author
(
author_id INTEGER
primary key,
author_name TEXT
)
/*
1 example row:
SELECT * FROM author LIMIT 1;
author_id || author_name
1 ||A. Bartlett Giamatti
*/
/* column definitions {
"author_id": "the unique identifier of the author",
"author_name": "the name of the author"
}*/
CREATE TABLE book_language
(
language_id INTEGER
primary key,
language_code TEXT,
language_name TEXT
)
/*
1 example row:
SELECT * FROM book_language LIMIT 1;
language_id ||language_code ||language_name
1 || eng || English
*/
/* column definitions {
"language_id": "the unique identifier of the language ",
"language_code": "the language code",
"language_name": "the language name"
}*/
CREATE TABLE country
(
country_id INTEGER
primary key,
country_name TEXT
)
/*
1 example row:
SELECT * FROM country LIMIT 1;
country_id ||country_name
1 || Afghanistan
*/
/* column definitions {
"country_id": "the unique identifier of the country",
"country_name": "the country name"
}*/
CREATE TABLE address
(
address_id INTEGER
primary key,
street_number TEXT,
street_name TEXT,
city TEXT,
country_id INTEGER,
foreign key (country_id) references country(country_id)
)
/*
1 example row:
SELECT * FROM address LIMIT 1;
address_id ||street_number || street_name || city ||country_id
1 || 57 ||Glacier Hill Avenue ||Torbat-e Jām || 95
*/
/* column definitions {
"address_id": "the unique identifier of the address",
"street_number": "the street number of the address",
"street_name": "the street name",
"city": "the city where the address belongs",
"country_id": "the id of the country where the address belongs "
}*/
CREATE TABLE customer
(
customer_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
email TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
customer_id ||first_name ||last_name || email
1 || Ursola || Purdy ||upurdy0@cdbaby.com
*/
/* column definitions {
"customer_id": "the unique identifier of the customer",
"first_name": "the first name of the customer",
"last_name": "the last name of the customer",
"email": "the email of the customer"
}*/
CREATE TABLE customer_address
(
customer_id INTEGER,
address_id INTEGER,
status_id INTEGER,
primary key (customer_id, address_id),
foreign key (address_id) references address(address_id),
foreign key (customer_id) references customer(customer_id)
)
/*
1 example row:
SELECT * FROM customer_address LIMIT 1;
customer_id ||address_id ||status_id
1 || 606 || 1
*/
/* column definitions {
"customer_id": "the id of the customer\nMaps to customer(customer_id)",
"address_id": "the id of the address\nMaps to address(address_id)",
"status_id": "the id of the address status"
}*/
CREATE TABLE order_status
(
status_id INTEGER
primary key,
status_value TEXT
)
/*
1 example row:
SELECT * FROM order_status LIMIT 1;
status_id || status_value
1 ||Order Received
*/
/* column definitions {
"status_id": "the unique identifier of the order status",
"status_value": "the status value"
}*/
CREATE TABLE publisher
(
publisher_id INTEGER
primary key,
publisher_name TEXT
)
/*
1 example row:
SELECT * FROM publisher LIMIT 1;
publisher_id ||publisher_name
1 || 10/18
*/
/* column definitions {
"publisher_id": "the unique identifier of the publisher",
"publisher_name": "the name of the publisher"
}*/
CREATE TABLE book
(
book_id INTEGER
primary key,
title TEXT,
isbn13 TEXT,
language_id INTEGER,
num_pages INTEGER,
publication_date DATE,
publisher_id INTEGER,
foreign key (language_id) references book_language(language_id),
foreign key (publisher_id) references publisher(publisher_id)
)
/*
1 example row:
SELECT * FROM book LIMIT 1;
book_id || title || isbn13 ||language_id ||num_pages ||publication_date ||publisher_id
1 ||The World's First Love: Mary Mother of God ||8987059752 || 2 || 276 || 1996-09-01 || 1010
*/
/* column definitions {
"book_id": "the unique identifier of the book",
"title": "the title of the book ",
"isbn13": "the International Standard Book Number of the book",
"language_id": "the id of the book language\nMaps to book_language (language_id)",
"num_pages": "the number of the pages",
"publication_date": "the publication date of the book",
"publisher_id": "the id of the publisher\nMaps to publisher (publisher_id)"
}*/
CREATE TABLE book_author
(
book_id INTEGER,
author_id INTEGER,
primary key (book_id, author_id),
foreign key (author_id) references author(author_id),
foreign key (book_id) references book(book_id)
)
/*
1 example row:
SELECT * FROM book_author LIMIT 1;
book_id ||author_id
10539 || 1
*/
/* column definitions {
"book_id": "the id of the book\nMaps to book(book_id)",
"author_id": "the id of the author\nMaps to author(author_id)"
}*/
CREATE TABLE shipping_method
(
method_id INTEGER
primary key,
method_name TEXT,
cost REAL
)
/*
1 example row:
SELECT * FROM shipping_method LIMIT 1;
method_id ||method_name ||cost
1 || Standard || 5.9
*/
/* column definitions {
"method_id": "the unique identifier of the method",
"method_name": "the method name",
"cost": "the cost of the shipping method"
}*/
CREATE TABLE "cust_order"
(
order_id INTEGER
primary key autoincrement,
order_date DATETIME,
customer_id INTEGER
references customer,
shipping_method_id INTEGER
references shipping_method,
dest_address_id INTEGER
references address
)
/*
1 example row:
SELECT * FROM cust_order LIMIT 1;
order_id || order_date ||customer_id ||shipping_method_id ||dest_address_id
1 ||2021-07-14 10:47:19 || 387 || 4 || 1
*/
/* column definitions {
"order_id": "the unique identifier of the customer order",
"order_date": "the date of the order",
"customer_id": "the id of the customer\nMaps to customer(customer_Id)",
"shipping_method_id": "the id of the shipping method\nMaps to shipping_method(method_id)",
"dest_address_id": "the id of the destination address\nMaps to address(address_id)"
}*/
CREATE TABLE "order_history"
(
history_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
status_id INTEGER
references order_status,
status_date DATETIME
)
/*
1 example row:
SELECT * FROM order_history LIMIT 1;
history_id ||order_id ||status_id || status_date
1 || 1 || 1 ||2021-07-14 17:04:28
*/
/* column definitions {
"history_id": "the unique identifier of the order history",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"status_id": "the id of the order\nMaps to order_status(status_id)",
"status_date": "the date of the status updated "
}*/
CREATE TABLE "order_line"
(
line_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
book_id INTEGER
references book,
price REAL
)
/*
1 example row:
SELECT * FROM order_line LIMIT 1;
line_id ||order_id ||book_id ||price
1024 || 2051 || 10720 || 3.19
*/
/* column definitions {
"line_id": "the unique identifier of the order line",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"book_id": "the id of the book\nMaps to book(book_id)",
"price": "the price of the order"
}*/
### Question
List the author's name of the books published by Abrams.
Clarification: "Abrams" is the publisher_name; author's name refers to author_name
| [query_database(**{'query': 'SELECT T3.author_name FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id INNER JOIN publisher AS T4 ON T4.publisher_id = T1.publisher_id WHERE T4.publisher_name = 'Abrams''})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE address_status
(
status_id INTEGER
primary key,
address_status TEXT
)
/*
1 example row:
SELECT * FROM address_status LIMIT 1;
status_id ||address_status
1 || Active
*/
/* column definitions {
"status_id": "the unique identifier of the status",
"address_status": "the status of the address"
}*/
CREATE TABLE author
(
author_id INTEGER
primary key,
author_name TEXT
)
/*
1 example row:
SELECT * FROM author LIMIT 1;
author_id || author_name
1 ||A. Bartlett Giamatti
*/
/* column definitions {
"author_id": "the unique identifier of the author",
"author_name": "the name of the author"
}*/
CREATE TABLE book_language
(
language_id INTEGER
primary key,
language_code TEXT,
language_name TEXT
)
/*
1 example row:
SELECT * FROM book_language LIMIT 1;
language_id ||language_code ||language_name
1 || eng || English
*/
/* column definitions {
"language_id": "the unique identifier of the language ",
"language_code": "the language code",
"language_name": "the language name"
}*/
CREATE TABLE country
(
country_id INTEGER
primary key,
country_name TEXT
)
/*
1 example row:
SELECT * FROM country LIMIT 1;
country_id ||country_name
1 || Afghanistan
*/
/* column definitions {
"country_id": "the unique identifier of the country",
"country_name": "the country name"
}*/
CREATE TABLE address
(
address_id INTEGER
primary key,
street_number TEXT,
street_name TEXT,
city TEXT,
country_id INTEGER,
foreign key (country_id) references country(country_id)
)
/*
1 example row:
SELECT * FROM address LIMIT 1;
address_id ||street_number || street_name || city ||country_id
1 || 57 ||Glacier Hill Avenue ||Torbat-e Jām || 95
*/
/* column definitions {
"address_id": "the unique identifier of the address",
"street_number": "the street number of the address",
"street_name": "the street name",
"city": "the city where the address belongs",
"country_id": "the id of the country where the address belongs "
}*/
CREATE TABLE customer
(
customer_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
email TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
customer_id ||first_name ||last_name || email
1 || Ursola || Purdy ||upurdy0@cdbaby.com
*/
/* column definitions {
"customer_id": "the unique identifier of the customer",
"first_name": "the first name of the customer",
"last_name": "the last name of the customer",
"email": "the email of the customer"
}*/
CREATE TABLE customer_address
(
customer_id INTEGER,
address_id INTEGER,
status_id INTEGER,
primary key (customer_id, address_id),
foreign key (address_id) references address(address_id),
foreign key (customer_id) references customer(customer_id)
)
/*
1 example row:
SELECT * FROM customer_address LIMIT 1;
customer_id ||address_id ||status_id
1 || 606 || 1
*/
/* column definitions {
"customer_id": "the id of the customer\nMaps to customer(customer_id)",
"address_id": "the id of the address\nMaps to address(address_id)",
"status_id": "the id of the address status"
}*/
CREATE TABLE order_status
(
status_id INTEGER
primary key,
status_value TEXT
)
/*
1 example row:
SELECT * FROM order_status LIMIT 1;
status_id || status_value
1 ||Order Received
*/
/* column definitions {
"status_id": "the unique identifier of the order status",
"status_value": "the status value"
}*/
CREATE TABLE publisher
(
publisher_id INTEGER
primary key,
publisher_name TEXT
)
/*
1 example row:
SELECT * FROM publisher LIMIT 1;
publisher_id ||publisher_name
1 || 10/18
*/
/* column definitions {
"publisher_id": "the unique identifier of the publisher",
"publisher_name": "the name of the publisher"
}*/
CREATE TABLE book
(
book_id INTEGER
primary key,
title TEXT,
isbn13 TEXT,
language_id INTEGER,
num_pages INTEGER,
publication_date DATE,
publisher_id INTEGER,
foreign key (language_id) references book_language(language_id),
foreign key (publisher_id) references publisher(publisher_id)
)
/*
1 example row:
SELECT * FROM book LIMIT 1;
book_id || title || isbn13 ||language_id ||num_pages ||publication_date ||publisher_id
1 ||The World's First Love: Mary Mother of God ||8987059752 || 2 || 276 || 1996-09-01 || 1010
*/
/* column definitions {
"book_id": "the unique identifier of the book",
"title": "the title of the book ",
"isbn13": "the International Standard Book Number of the book",
"language_id": "the id of the book language\nMaps to book_language (language_id)",
"num_pages": "the number of the pages",
"publication_date": "the publication date of the book",
"publisher_id": "the id of the publisher\nMaps to publisher (publisher_id)"
}*/
CREATE TABLE book_author
(
book_id INTEGER,
author_id INTEGER,
primary key (book_id, author_id),
foreign key (author_id) references author(author_id),
foreign key (book_id) references book(book_id)
)
/*
1 example row:
SELECT * FROM book_author LIMIT 1;
book_id ||author_id
10539 || 1
*/
/* column definitions {
"book_id": "the id of the book\nMaps to book(book_id)",
"author_id": "the id of the author\nMaps to author(author_id)"
}*/
CREATE TABLE shipping_method
(
method_id INTEGER
primary key,
method_name TEXT,
cost REAL
)
/*
1 example row:
SELECT * FROM shipping_method LIMIT 1;
method_id ||method_name ||cost
1 || Standard || 5.9
*/
/* column definitions {
"method_id": "the unique identifier of the method",
"method_name": "the method name",
"cost": "the cost of the shipping method"
}*/
CREATE TABLE "cust_order"
(
order_id INTEGER
primary key autoincrement,
order_date DATETIME,
customer_id INTEGER
references customer,
shipping_method_id INTEGER
references shipping_method,
dest_address_id INTEGER
references address
)
/*
1 example row:
SELECT * FROM cust_order LIMIT 1;
order_id || order_date ||customer_id ||shipping_method_id ||dest_address_id
1 ||2021-07-14 10:47:19 || 387 || 4 || 1
*/
/* column definitions {
"order_id": "the unique identifier of the customer order",
"order_date": "the date of the order",
"customer_id": "the id of the customer\nMaps to customer(customer_Id)",
"shipping_method_id": "the id of the shipping method\nMaps to shipping_method(method_id)",
"dest_address_id": "the id of the destination address\nMaps to address(address_id)"
}*/
CREATE TABLE "order_history"
(
history_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
status_id INTEGER
references order_status,
status_date DATETIME
)
/*
1 example row:
SELECT * FROM order_history LIMIT 1;
history_id ||order_id ||status_id || status_date
1 || 1 || 1 ||2021-07-14 17:04:28
*/
/* column definitions {
"history_id": "the unique identifier of the order history",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"status_id": "the id of the order\nMaps to order_status(status_id)",
"status_date": "the date of the status updated "
}*/
CREATE TABLE "order_line"
(
line_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
book_id INTEGER
references book,
price REAL
)
/*
1 example row:
SELECT * FROM order_line LIMIT 1;
line_id ||order_id ||book_id ||price
1024 || 2051 || 10720 || 3.19
*/
/* column definitions {
"line_id": "the unique identifier of the order line",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"book_id": "the id of the book\nMaps to book(book_id)",
"price": "the price of the order"
}*/
|
5,974 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE address_status
(
status_id INTEGER
primary key,
address_status TEXT
)
/*
1 example row:
SELECT * FROM address_status LIMIT 1;
status_id ||address_status
1 || Active
*/
/* column definitions {
"status_id": "the unique identifier of the status",
"address_status": "the status of the address"
}*/
CREATE TABLE author
(
author_id INTEGER
primary key,
author_name TEXT
)
/*
1 example row:
SELECT * FROM author LIMIT 1;
author_id || author_name
1 ||A. Bartlett Giamatti
*/
/* column definitions {
"author_id": "the unique identifier of the author",
"author_name": "the name of the author"
}*/
CREATE TABLE book_language
(
language_id INTEGER
primary key,
language_code TEXT,
language_name TEXT
)
/*
1 example row:
SELECT * FROM book_language LIMIT 1;
language_id ||language_code ||language_name
1 || eng || English
*/
/* column definitions {
"language_id": "the unique identifier of the language ",
"language_code": "the language code",
"language_name": "the language name"
}*/
CREATE TABLE country
(
country_id INTEGER
primary key,
country_name TEXT
)
/*
1 example row:
SELECT * FROM country LIMIT 1;
country_id ||country_name
1 || Afghanistan
*/
/* column definitions {
"country_id": "the unique identifier of the country",
"country_name": "the country name"
}*/
CREATE TABLE address
(
address_id INTEGER
primary key,
street_number TEXT,
street_name TEXT,
city TEXT,
country_id INTEGER,
foreign key (country_id) references country(country_id)
)
/*
1 example row:
SELECT * FROM address LIMIT 1;
address_id ||street_number || street_name || city ||country_id
1 || 57 ||Glacier Hill Avenue ||Torbat-e Jām || 95
*/
/* column definitions {
"address_id": "the unique identifier of the address",
"street_number": "the street number of the address",
"street_name": "the street name",
"city": "the city where the address belongs",
"country_id": "the id of the country where the address belongs "
}*/
CREATE TABLE customer
(
customer_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
email TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
customer_id ||first_name ||last_name || email
1 || Ursola || Purdy ||upurdy0@cdbaby.com
*/
/* column definitions {
"customer_id": "the unique identifier of the customer",
"first_name": "the first name of the customer",
"last_name": "the last name of the customer",
"email": "the email of the customer"
}*/
CREATE TABLE customer_address
(
customer_id INTEGER,
address_id INTEGER,
status_id INTEGER,
primary key (customer_id, address_id),
foreign key (address_id) references address(address_id),
foreign key (customer_id) references customer(customer_id)
)
/*
1 example row:
SELECT * FROM customer_address LIMIT 1;
customer_id ||address_id ||status_id
1 || 606 || 1
*/
/* column definitions {
"customer_id": "the id of the customer\nMaps to customer(customer_id)",
"address_id": "the id of the address\nMaps to address(address_id)",
"status_id": "the id of the address status"
}*/
CREATE TABLE order_status
(
status_id INTEGER
primary key,
status_value TEXT
)
/*
1 example row:
SELECT * FROM order_status LIMIT 1;
status_id || status_value
1 ||Order Received
*/
/* column definitions {
"status_id": "the unique identifier of the order status",
"status_value": "the status value"
}*/
CREATE TABLE publisher
(
publisher_id INTEGER
primary key,
publisher_name TEXT
)
/*
1 example row:
SELECT * FROM publisher LIMIT 1;
publisher_id ||publisher_name
1 || 10/18
*/
/* column definitions {
"publisher_id": "the unique identifier of the publisher",
"publisher_name": "the name of the publisher"
}*/
CREATE TABLE book
(
book_id INTEGER
primary key,
title TEXT,
isbn13 TEXT,
language_id INTEGER,
num_pages INTEGER,
publication_date DATE,
publisher_id INTEGER,
foreign key (language_id) references book_language(language_id),
foreign key (publisher_id) references publisher(publisher_id)
)
/*
1 example row:
SELECT * FROM book LIMIT 1;
book_id || title || isbn13 ||language_id ||num_pages ||publication_date ||publisher_id
1 ||The World's First Love: Mary Mother of God ||8987059752 || 2 || 276 || 1996-09-01 || 1010
*/
/* column definitions {
"book_id": "the unique identifier of the book",
"title": "the title of the book ",
"isbn13": "the International Standard Book Number of the book",
"language_id": "the id of the book language\nMaps to book_language (language_id)",
"num_pages": "the number of the pages",
"publication_date": "the publication date of the book",
"publisher_id": "the id of the publisher\nMaps to publisher (publisher_id)"
}*/
CREATE TABLE book_author
(
book_id INTEGER,
author_id INTEGER,
primary key (book_id, author_id),
foreign key (author_id) references author(author_id),
foreign key (book_id) references book(book_id)
)
/*
1 example row:
SELECT * FROM book_author LIMIT 1;
book_id ||author_id
10539 || 1
*/
/* column definitions {
"book_id": "the id of the book\nMaps to book(book_id)",
"author_id": "the id of the author\nMaps to author(author_id)"
}*/
CREATE TABLE shipping_method
(
method_id INTEGER
primary key,
method_name TEXT,
cost REAL
)
/*
1 example row:
SELECT * FROM shipping_method LIMIT 1;
method_id ||method_name ||cost
1 || Standard || 5.9
*/
/* column definitions {
"method_id": "the unique identifier of the method",
"method_name": "the method name",
"cost": "the cost of the shipping method"
}*/
CREATE TABLE "cust_order"
(
order_id INTEGER
primary key autoincrement,
order_date DATETIME,
customer_id INTEGER
references customer,
shipping_method_id INTEGER
references shipping_method,
dest_address_id INTEGER
references address
)
/*
1 example row:
SELECT * FROM cust_order LIMIT 1;
order_id || order_date ||customer_id ||shipping_method_id ||dest_address_id
1 ||2021-07-14 10:47:19 || 387 || 4 || 1
*/
/* column definitions {
"order_id": "the unique identifier of the customer order",
"order_date": "the date of the order",
"customer_id": "the id of the customer\nMaps to customer(customer_Id)",
"shipping_method_id": "the id of the shipping method\nMaps to shipping_method(method_id)",
"dest_address_id": "the id of the destination address\nMaps to address(address_id)"
}*/
CREATE TABLE "order_history"
(
history_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
status_id INTEGER
references order_status,
status_date DATETIME
)
/*
1 example row:
SELECT * FROM order_history LIMIT 1;
history_id ||order_id ||status_id || status_date
1 || 1 || 1 ||2021-07-14 17:04:28
*/
/* column definitions {
"history_id": "the unique identifier of the order history",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"status_id": "the id of the order\nMaps to order_status(status_id)",
"status_date": "the date of the status updated "
}*/
CREATE TABLE "order_line"
(
line_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
book_id INTEGER
references book,
price REAL
)
/*
1 example row:
SELECT * FROM order_line LIMIT 1;
line_id ||order_id ||book_id ||price
1024 || 2051 || 10720 || 3.19
*/
/* column definitions {
"line_id": "the unique identifier of the order line",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"book_id": "the id of the book\nMaps to book(book_id)",
"price": "the price of the order"
}*/
### Question
Provide the contact email of Moss Zarb.
Clarification:
| [query_database(**{'query': 'SELECT email FROM customer WHERE first_name = 'Moss' AND last_name = 'Zarb''})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE address_status
(
status_id INTEGER
primary key,
address_status TEXT
)
/*
1 example row:
SELECT * FROM address_status LIMIT 1;
status_id ||address_status
1 || Active
*/
/* column definitions {
"status_id": "the unique identifier of the status",
"address_status": "the status of the address"
}*/
CREATE TABLE author
(
author_id INTEGER
primary key,
author_name TEXT
)
/*
1 example row:
SELECT * FROM author LIMIT 1;
author_id || author_name
1 ||A. Bartlett Giamatti
*/
/* column definitions {
"author_id": "the unique identifier of the author",
"author_name": "the name of the author"
}*/
CREATE TABLE book_language
(
language_id INTEGER
primary key,
language_code TEXT,
language_name TEXT
)
/*
1 example row:
SELECT * FROM book_language LIMIT 1;
language_id ||language_code ||language_name
1 || eng || English
*/
/* column definitions {
"language_id": "the unique identifier of the language ",
"language_code": "the language code",
"language_name": "the language name"
}*/
CREATE TABLE country
(
country_id INTEGER
primary key,
country_name TEXT
)
/*
1 example row:
SELECT * FROM country LIMIT 1;
country_id ||country_name
1 || Afghanistan
*/
/* column definitions {
"country_id": "the unique identifier of the country",
"country_name": "the country name"
}*/
CREATE TABLE address
(
address_id INTEGER
primary key,
street_number TEXT,
street_name TEXT,
city TEXT,
country_id INTEGER,
foreign key (country_id) references country(country_id)
)
/*
1 example row:
SELECT * FROM address LIMIT 1;
address_id ||street_number || street_name || city ||country_id
1 || 57 ||Glacier Hill Avenue ||Torbat-e Jām || 95
*/
/* column definitions {
"address_id": "the unique identifier of the address",
"street_number": "the street number of the address",
"street_name": "the street name",
"city": "the city where the address belongs",
"country_id": "the id of the country where the address belongs "
}*/
CREATE TABLE customer
(
customer_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
email TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
customer_id ||first_name ||last_name || email
1 || Ursola || Purdy ||upurdy0@cdbaby.com
*/
/* column definitions {
"customer_id": "the unique identifier of the customer",
"first_name": "the first name of the customer",
"last_name": "the last name of the customer",
"email": "the email of the customer"
}*/
CREATE TABLE customer_address
(
customer_id INTEGER,
address_id INTEGER,
status_id INTEGER,
primary key (customer_id, address_id),
foreign key (address_id) references address(address_id),
foreign key (customer_id) references customer(customer_id)
)
/*
1 example row:
SELECT * FROM customer_address LIMIT 1;
customer_id ||address_id ||status_id
1 || 606 || 1
*/
/* column definitions {
"customer_id": "the id of the customer\nMaps to customer(customer_id)",
"address_id": "the id of the address\nMaps to address(address_id)",
"status_id": "the id of the address status"
}*/
CREATE TABLE order_status
(
status_id INTEGER
primary key,
status_value TEXT
)
/*
1 example row:
SELECT * FROM order_status LIMIT 1;
status_id || status_value
1 ||Order Received
*/
/* column definitions {
"status_id": "the unique identifier of the order status",
"status_value": "the status value"
}*/
CREATE TABLE publisher
(
publisher_id INTEGER
primary key,
publisher_name TEXT
)
/*
1 example row:
SELECT * FROM publisher LIMIT 1;
publisher_id ||publisher_name
1 || 10/18
*/
/* column definitions {
"publisher_id": "the unique identifier of the publisher",
"publisher_name": "the name of the publisher"
}*/
CREATE TABLE book
(
book_id INTEGER
primary key,
title TEXT,
isbn13 TEXT,
language_id INTEGER,
num_pages INTEGER,
publication_date DATE,
publisher_id INTEGER,
foreign key (language_id) references book_language(language_id),
foreign key (publisher_id) references publisher(publisher_id)
)
/*
1 example row:
SELECT * FROM book LIMIT 1;
book_id || title || isbn13 ||language_id ||num_pages ||publication_date ||publisher_id
1 ||The World's First Love: Mary Mother of God ||8987059752 || 2 || 276 || 1996-09-01 || 1010
*/
/* column definitions {
"book_id": "the unique identifier of the book",
"title": "the title of the book ",
"isbn13": "the International Standard Book Number of the book",
"language_id": "the id of the book language\nMaps to book_language (language_id)",
"num_pages": "the number of the pages",
"publication_date": "the publication date of the book",
"publisher_id": "the id of the publisher\nMaps to publisher (publisher_id)"
}*/
CREATE TABLE book_author
(
book_id INTEGER,
author_id INTEGER,
primary key (book_id, author_id),
foreign key (author_id) references author(author_id),
foreign key (book_id) references book(book_id)
)
/*
1 example row:
SELECT * FROM book_author LIMIT 1;
book_id ||author_id
10539 || 1
*/
/* column definitions {
"book_id": "the id of the book\nMaps to book(book_id)",
"author_id": "the id of the author\nMaps to author(author_id)"
}*/
CREATE TABLE shipping_method
(
method_id INTEGER
primary key,
method_name TEXT,
cost REAL
)
/*
1 example row:
SELECT * FROM shipping_method LIMIT 1;
method_id ||method_name ||cost
1 || Standard || 5.9
*/
/* column definitions {
"method_id": "the unique identifier of the method",
"method_name": "the method name",
"cost": "the cost of the shipping method"
}*/
CREATE TABLE "cust_order"
(
order_id INTEGER
primary key autoincrement,
order_date DATETIME,
customer_id INTEGER
references customer,
shipping_method_id INTEGER
references shipping_method,
dest_address_id INTEGER
references address
)
/*
1 example row:
SELECT * FROM cust_order LIMIT 1;
order_id || order_date ||customer_id ||shipping_method_id ||dest_address_id
1 ||2021-07-14 10:47:19 || 387 || 4 || 1
*/
/* column definitions {
"order_id": "the unique identifier of the customer order",
"order_date": "the date of the order",
"customer_id": "the id of the customer\nMaps to customer(customer_Id)",
"shipping_method_id": "the id of the shipping method\nMaps to shipping_method(method_id)",
"dest_address_id": "the id of the destination address\nMaps to address(address_id)"
}*/
CREATE TABLE "order_history"
(
history_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
status_id INTEGER
references order_status,
status_date DATETIME
)
/*
1 example row:
SELECT * FROM order_history LIMIT 1;
history_id ||order_id ||status_id || status_date
1 || 1 || 1 ||2021-07-14 17:04:28
*/
/* column definitions {
"history_id": "the unique identifier of the order history",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"status_id": "the id of the order\nMaps to order_status(status_id)",
"status_date": "the date of the status updated "
}*/
CREATE TABLE "order_line"
(
line_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
book_id INTEGER
references book,
price REAL
)
/*
1 example row:
SELECT * FROM order_line LIMIT 1;
line_id ||order_id ||book_id ||price
1024 || 2051 || 10720 || 3.19
*/
/* column definitions {
"line_id": "the unique identifier of the order line",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"book_id": "the id of the book\nMaps to book(book_id)",
"price": "the price of the order"
}*/
|
5,978 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE address_status
(
status_id INTEGER
primary key,
address_status TEXT
)
/*
1 example row:
SELECT * FROM address_status LIMIT 1;
status_id ||address_status
1 || Active
*/
/* column definitions {
"status_id": "the unique identifier of the status",
"address_status": "the status of the address"
}*/
CREATE TABLE author
(
author_id INTEGER
primary key,
author_name TEXT
)
/*
1 example row:
SELECT * FROM author LIMIT 1;
author_id || author_name
1 ||A. Bartlett Giamatti
*/
/* column definitions {
"author_id": "the unique identifier of the author",
"author_name": "the name of the author"
}*/
CREATE TABLE book_language
(
language_id INTEGER
primary key,
language_code TEXT,
language_name TEXT
)
/*
1 example row:
SELECT * FROM book_language LIMIT 1;
language_id ||language_code ||language_name
1 || eng || English
*/
/* column definitions {
"language_id": "the unique identifier of the language ",
"language_code": "the language code",
"language_name": "the language name"
}*/
CREATE TABLE country
(
country_id INTEGER
primary key,
country_name TEXT
)
/*
1 example row:
SELECT * FROM country LIMIT 1;
country_id ||country_name
1 || Afghanistan
*/
/* column definitions {
"country_id": "the unique identifier of the country",
"country_name": "the country name"
}*/
CREATE TABLE address
(
address_id INTEGER
primary key,
street_number TEXT,
street_name TEXT,
city TEXT,
country_id INTEGER,
foreign key (country_id) references country(country_id)
)
/*
1 example row:
SELECT * FROM address LIMIT 1;
address_id ||street_number || street_name || city ||country_id
1 || 57 ||Glacier Hill Avenue ||Torbat-e Jām || 95
*/
/* column definitions {
"address_id": "the unique identifier of the address",
"street_number": "the street number of the address",
"street_name": "the street name",
"city": "the city where the address belongs",
"country_id": "the id of the country where the address belongs "
}*/
CREATE TABLE customer
(
customer_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
email TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
customer_id ||first_name ||last_name || email
1 || Ursola || Purdy ||upurdy0@cdbaby.com
*/
/* column definitions {
"customer_id": "the unique identifier of the customer",
"first_name": "the first name of the customer",
"last_name": "the last name of the customer",
"email": "the email of the customer"
}*/
CREATE TABLE customer_address
(
customer_id INTEGER,
address_id INTEGER,
status_id INTEGER,
primary key (customer_id, address_id),
foreign key (address_id) references address(address_id),
foreign key (customer_id) references customer(customer_id)
)
/*
1 example row:
SELECT * FROM customer_address LIMIT 1;
customer_id ||address_id ||status_id
1 || 606 || 1
*/
/* column definitions {
"customer_id": "the id of the customer\nMaps to customer(customer_id)",
"address_id": "the id of the address\nMaps to address(address_id)",
"status_id": "the id of the address status"
}*/
CREATE TABLE order_status
(
status_id INTEGER
primary key,
status_value TEXT
)
/*
1 example row:
SELECT * FROM order_status LIMIT 1;
status_id || status_value
1 ||Order Received
*/
/* column definitions {
"status_id": "the unique identifier of the order status",
"status_value": "the status value"
}*/
CREATE TABLE publisher
(
publisher_id INTEGER
primary key,
publisher_name TEXT
)
/*
1 example row:
SELECT * FROM publisher LIMIT 1;
publisher_id ||publisher_name
1 || 10/18
*/
/* column definitions {
"publisher_id": "the unique identifier of the publisher",
"publisher_name": "the name of the publisher"
}*/
CREATE TABLE book
(
book_id INTEGER
primary key,
title TEXT,
isbn13 TEXT,
language_id INTEGER,
num_pages INTEGER,
publication_date DATE,
publisher_id INTEGER,
foreign key (language_id) references book_language(language_id),
foreign key (publisher_id) references publisher(publisher_id)
)
/*
1 example row:
SELECT * FROM book LIMIT 1;
book_id || title || isbn13 ||language_id ||num_pages ||publication_date ||publisher_id
1 ||The World's First Love: Mary Mother of God ||8987059752 || 2 || 276 || 1996-09-01 || 1010
*/
/* column definitions {
"book_id": "the unique identifier of the book",
"title": "the title of the book ",
"isbn13": "the International Standard Book Number of the book",
"language_id": "the id of the book language\nMaps to book_language (language_id)",
"num_pages": "the number of the pages",
"publication_date": "the publication date of the book",
"publisher_id": "the id of the publisher\nMaps to publisher (publisher_id)"
}*/
CREATE TABLE book_author
(
book_id INTEGER,
author_id INTEGER,
primary key (book_id, author_id),
foreign key (author_id) references author(author_id),
foreign key (book_id) references book(book_id)
)
/*
1 example row:
SELECT * FROM book_author LIMIT 1;
book_id ||author_id
10539 || 1
*/
/* column definitions {
"book_id": "the id of the book\nMaps to book(book_id)",
"author_id": "the id of the author\nMaps to author(author_id)"
}*/
CREATE TABLE shipping_method
(
method_id INTEGER
primary key,
method_name TEXT,
cost REAL
)
/*
1 example row:
SELECT * FROM shipping_method LIMIT 1;
method_id ||method_name ||cost
1 || Standard || 5.9
*/
/* column definitions {
"method_id": "the unique identifier of the method",
"method_name": "the method name",
"cost": "the cost of the shipping method"
}*/
CREATE TABLE "cust_order"
(
order_id INTEGER
primary key autoincrement,
order_date DATETIME,
customer_id INTEGER
references customer,
shipping_method_id INTEGER
references shipping_method,
dest_address_id INTEGER
references address
)
/*
1 example row:
SELECT * FROM cust_order LIMIT 1;
order_id || order_date ||customer_id ||shipping_method_id ||dest_address_id
1 ||2021-07-14 10:47:19 || 387 || 4 || 1
*/
/* column definitions {
"order_id": "the unique identifier of the customer order",
"order_date": "the date of the order",
"customer_id": "the id of the customer\nMaps to customer(customer_Id)",
"shipping_method_id": "the id of the shipping method\nMaps to shipping_method(method_id)",
"dest_address_id": "the id of the destination address\nMaps to address(address_id)"
}*/
CREATE TABLE "order_history"
(
history_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
status_id INTEGER
references order_status,
status_date DATETIME
)
/*
1 example row:
SELECT * FROM order_history LIMIT 1;
history_id ||order_id ||status_id || status_date
1 || 1 || 1 ||2021-07-14 17:04:28
*/
/* column definitions {
"history_id": "the unique identifier of the order history",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"status_id": "the id of the order\nMaps to order_status(status_id)",
"status_date": "the date of the status updated "
}*/
CREATE TABLE "order_line"
(
line_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
book_id INTEGER
references book,
price REAL
)
/*
1 example row:
SELECT * FROM order_line LIMIT 1;
line_id ||order_id ||book_id ||price
1024 || 2051 || 10720 || 3.19
*/
/* column definitions {
"line_id": "the unique identifier of the order line",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"book_id": "the id of the book\nMaps to book(book_id)",
"price": "the price of the order"
}*/
### Question
Provide the authors and titles of the books which have more than 3000 pages.
Clarification: authors refers to author_name; more than 3000 pages refers to num_pages > 3000
| [query_database(**{'query': 'SELECT T3.author_name, T1.title FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id WHERE T1.num_pages > 3000'})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE address_status
(
status_id INTEGER
primary key,
address_status TEXT
)
/*
1 example row:
SELECT * FROM address_status LIMIT 1;
status_id ||address_status
1 || Active
*/
/* column definitions {
"status_id": "the unique identifier of the status",
"address_status": "the status of the address"
}*/
CREATE TABLE author
(
author_id INTEGER
primary key,
author_name TEXT
)
/*
1 example row:
SELECT * FROM author LIMIT 1;
author_id || author_name
1 ||A. Bartlett Giamatti
*/
/* column definitions {
"author_id": "the unique identifier of the author",
"author_name": "the name of the author"
}*/
CREATE TABLE book_language
(
language_id INTEGER
primary key,
language_code TEXT,
language_name TEXT
)
/*
1 example row:
SELECT * FROM book_language LIMIT 1;
language_id ||language_code ||language_name
1 || eng || English
*/
/* column definitions {
"language_id": "the unique identifier of the language ",
"language_code": "the language code",
"language_name": "the language name"
}*/
CREATE TABLE country
(
country_id INTEGER
primary key,
country_name TEXT
)
/*
1 example row:
SELECT * FROM country LIMIT 1;
country_id ||country_name
1 || Afghanistan
*/
/* column definitions {
"country_id": "the unique identifier of the country",
"country_name": "the country name"
}*/
CREATE TABLE address
(
address_id INTEGER
primary key,
street_number TEXT,
street_name TEXT,
city TEXT,
country_id INTEGER,
foreign key (country_id) references country(country_id)
)
/*
1 example row:
SELECT * FROM address LIMIT 1;
address_id ||street_number || street_name || city ||country_id
1 || 57 ||Glacier Hill Avenue ||Torbat-e Jām || 95
*/
/* column definitions {
"address_id": "the unique identifier of the address",
"street_number": "the street number of the address",
"street_name": "the street name",
"city": "the city where the address belongs",
"country_id": "the id of the country where the address belongs "
}*/
CREATE TABLE customer
(
customer_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
email TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
customer_id ||first_name ||last_name || email
1 || Ursola || Purdy ||upurdy0@cdbaby.com
*/
/* column definitions {
"customer_id": "the unique identifier of the customer",
"first_name": "the first name of the customer",
"last_name": "the last name of the customer",
"email": "the email of the customer"
}*/
CREATE TABLE customer_address
(
customer_id INTEGER,
address_id INTEGER,
status_id INTEGER,
primary key (customer_id, address_id),
foreign key (address_id) references address(address_id),
foreign key (customer_id) references customer(customer_id)
)
/*
1 example row:
SELECT * FROM customer_address LIMIT 1;
customer_id ||address_id ||status_id
1 || 606 || 1
*/
/* column definitions {
"customer_id": "the id of the customer\nMaps to customer(customer_id)",
"address_id": "the id of the address\nMaps to address(address_id)",
"status_id": "the id of the address status"
}*/
CREATE TABLE order_status
(
status_id INTEGER
primary key,
status_value TEXT
)
/*
1 example row:
SELECT * FROM order_status LIMIT 1;
status_id || status_value
1 ||Order Received
*/
/* column definitions {
"status_id": "the unique identifier of the order status",
"status_value": "the status value"
}*/
CREATE TABLE publisher
(
publisher_id INTEGER
primary key,
publisher_name TEXT
)
/*
1 example row:
SELECT * FROM publisher LIMIT 1;
publisher_id ||publisher_name
1 || 10/18
*/
/* column definitions {
"publisher_id": "the unique identifier of the publisher",
"publisher_name": "the name of the publisher"
}*/
CREATE TABLE book
(
book_id INTEGER
primary key,
title TEXT,
isbn13 TEXT,
language_id INTEGER,
num_pages INTEGER,
publication_date DATE,
publisher_id INTEGER,
foreign key (language_id) references book_language(language_id),
foreign key (publisher_id) references publisher(publisher_id)
)
/*
1 example row:
SELECT * FROM book LIMIT 1;
book_id || title || isbn13 ||language_id ||num_pages ||publication_date ||publisher_id
1 ||The World's First Love: Mary Mother of God ||8987059752 || 2 || 276 || 1996-09-01 || 1010
*/
/* column definitions {
"book_id": "the unique identifier of the book",
"title": "the title of the book ",
"isbn13": "the International Standard Book Number of the book",
"language_id": "the id of the book language\nMaps to book_language (language_id)",
"num_pages": "the number of the pages",
"publication_date": "the publication date of the book",
"publisher_id": "the id of the publisher\nMaps to publisher (publisher_id)"
}*/
CREATE TABLE book_author
(
book_id INTEGER,
author_id INTEGER,
primary key (book_id, author_id),
foreign key (author_id) references author(author_id),
foreign key (book_id) references book(book_id)
)
/*
1 example row:
SELECT * FROM book_author LIMIT 1;
book_id ||author_id
10539 || 1
*/
/* column definitions {
"book_id": "the id of the book\nMaps to book(book_id)",
"author_id": "the id of the author\nMaps to author(author_id)"
}*/
CREATE TABLE shipping_method
(
method_id INTEGER
primary key,
method_name TEXT,
cost REAL
)
/*
1 example row:
SELECT * FROM shipping_method LIMIT 1;
method_id ||method_name ||cost
1 || Standard || 5.9
*/
/* column definitions {
"method_id": "the unique identifier of the method",
"method_name": "the method name",
"cost": "the cost of the shipping method"
}*/
CREATE TABLE "cust_order"
(
order_id INTEGER
primary key autoincrement,
order_date DATETIME,
customer_id INTEGER
references customer,
shipping_method_id INTEGER
references shipping_method,
dest_address_id INTEGER
references address
)
/*
1 example row:
SELECT * FROM cust_order LIMIT 1;
order_id || order_date ||customer_id ||shipping_method_id ||dest_address_id
1 ||2021-07-14 10:47:19 || 387 || 4 || 1
*/
/* column definitions {
"order_id": "the unique identifier of the customer order",
"order_date": "the date of the order",
"customer_id": "the id of the customer\nMaps to customer(customer_Id)",
"shipping_method_id": "the id of the shipping method\nMaps to shipping_method(method_id)",
"dest_address_id": "the id of the destination address\nMaps to address(address_id)"
}*/
CREATE TABLE "order_history"
(
history_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
status_id INTEGER
references order_status,
status_date DATETIME
)
/*
1 example row:
SELECT * FROM order_history LIMIT 1;
history_id ||order_id ||status_id || status_date
1 || 1 || 1 ||2021-07-14 17:04:28
*/
/* column definitions {
"history_id": "the unique identifier of the order history",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"status_id": "the id of the order\nMaps to order_status(status_id)",
"status_date": "the date of the status updated "
}*/
CREATE TABLE "order_line"
(
line_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
book_id INTEGER
references book,
price REAL
)
/*
1 example row:
SELECT * FROM order_line LIMIT 1;
line_id ||order_id ||book_id ||price
1024 || 2051 || 10720 || 3.19
*/
/* column definitions {
"line_id": "the unique identifier of the order line",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"book_id": "the id of the book\nMaps to book(book_id)",
"price": "the price of the order"
}*/
|
5,982 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE address_status
(
status_id INTEGER
primary key,
address_status TEXT
)
/*
1 example row:
SELECT * FROM address_status LIMIT 1;
status_id ||address_status
1 || Active
*/
/* column definitions {
"status_id": "the unique identifier of the status",
"address_status": "the status of the address"
}*/
CREATE TABLE author
(
author_id INTEGER
primary key,
author_name TEXT
)
/*
1 example row:
SELECT * FROM author LIMIT 1;
author_id || author_name
1 ||A. Bartlett Giamatti
*/
/* column definitions {
"author_id": "the unique identifier of the author",
"author_name": "the name of the author"
}*/
CREATE TABLE book_language
(
language_id INTEGER
primary key,
language_code TEXT,
language_name TEXT
)
/*
1 example row:
SELECT * FROM book_language LIMIT 1;
language_id ||language_code ||language_name
1 || eng || English
*/
/* column definitions {
"language_id": "the unique identifier of the language ",
"language_code": "the language code",
"language_name": "the language name"
}*/
CREATE TABLE country
(
country_id INTEGER
primary key,
country_name TEXT
)
/*
1 example row:
SELECT * FROM country LIMIT 1;
country_id ||country_name
1 || Afghanistan
*/
/* column definitions {
"country_id": "the unique identifier of the country",
"country_name": "the country name"
}*/
CREATE TABLE address
(
address_id INTEGER
primary key,
street_number TEXT,
street_name TEXT,
city TEXT,
country_id INTEGER,
foreign key (country_id) references country(country_id)
)
/*
1 example row:
SELECT * FROM address LIMIT 1;
address_id ||street_number || street_name || city ||country_id
1 || 57 ||Glacier Hill Avenue ||Torbat-e Jām || 95
*/
/* column definitions {
"address_id": "the unique identifier of the address",
"street_number": "the street number of the address",
"street_name": "the street name",
"city": "the city where the address belongs",
"country_id": "the id of the country where the address belongs "
}*/
CREATE TABLE customer
(
customer_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
email TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
customer_id ||first_name ||last_name || email
1 || Ursola || Purdy ||upurdy0@cdbaby.com
*/
/* column definitions {
"customer_id": "the unique identifier of the customer",
"first_name": "the first name of the customer",
"last_name": "the last name of the customer",
"email": "the email of the customer"
}*/
CREATE TABLE customer_address
(
customer_id INTEGER,
address_id INTEGER,
status_id INTEGER,
primary key (customer_id, address_id),
foreign key (address_id) references address(address_id),
foreign key (customer_id) references customer(customer_id)
)
/*
1 example row:
SELECT * FROM customer_address LIMIT 1;
customer_id ||address_id ||status_id
1 || 606 || 1
*/
/* column definitions {
"customer_id": "the id of the customer\nMaps to customer(customer_id)",
"address_id": "the id of the address\nMaps to address(address_id)",
"status_id": "the id of the address status"
}*/
CREATE TABLE order_status
(
status_id INTEGER
primary key,
status_value TEXT
)
/*
1 example row:
SELECT * FROM order_status LIMIT 1;
status_id || status_value
1 ||Order Received
*/
/* column definitions {
"status_id": "the unique identifier of the order status",
"status_value": "the status value"
}*/
CREATE TABLE publisher
(
publisher_id INTEGER
primary key,
publisher_name TEXT
)
/*
1 example row:
SELECT * FROM publisher LIMIT 1;
publisher_id ||publisher_name
1 || 10/18
*/
/* column definitions {
"publisher_id": "the unique identifier of the publisher",
"publisher_name": "the name of the publisher"
}*/
CREATE TABLE book
(
book_id INTEGER
primary key,
title TEXT,
isbn13 TEXT,
language_id INTEGER,
num_pages INTEGER,
publication_date DATE,
publisher_id INTEGER,
foreign key (language_id) references book_language(language_id),
foreign key (publisher_id) references publisher(publisher_id)
)
/*
1 example row:
SELECT * FROM book LIMIT 1;
book_id || title || isbn13 ||language_id ||num_pages ||publication_date ||publisher_id
1 ||The World's First Love: Mary Mother of God ||8987059752 || 2 || 276 || 1996-09-01 || 1010
*/
/* column definitions {
"book_id": "the unique identifier of the book",
"title": "the title of the book ",
"isbn13": "the International Standard Book Number of the book",
"language_id": "the id of the book language\nMaps to book_language (language_id)",
"num_pages": "the number of the pages",
"publication_date": "the publication date of the book",
"publisher_id": "the id of the publisher\nMaps to publisher (publisher_id)"
}*/
CREATE TABLE book_author
(
book_id INTEGER,
author_id INTEGER,
primary key (book_id, author_id),
foreign key (author_id) references author(author_id),
foreign key (book_id) references book(book_id)
)
/*
1 example row:
SELECT * FROM book_author LIMIT 1;
book_id ||author_id
10539 || 1
*/
/* column definitions {
"book_id": "the id of the book\nMaps to book(book_id)",
"author_id": "the id of the author\nMaps to author(author_id)"
}*/
CREATE TABLE shipping_method
(
method_id INTEGER
primary key,
method_name TEXT,
cost REAL
)
/*
1 example row:
SELECT * FROM shipping_method LIMIT 1;
method_id ||method_name ||cost
1 || Standard || 5.9
*/
/* column definitions {
"method_id": "the unique identifier of the method",
"method_name": "the method name",
"cost": "the cost of the shipping method"
}*/
CREATE TABLE "cust_order"
(
order_id INTEGER
primary key autoincrement,
order_date DATETIME,
customer_id INTEGER
references customer,
shipping_method_id INTEGER
references shipping_method,
dest_address_id INTEGER
references address
)
/*
1 example row:
SELECT * FROM cust_order LIMIT 1;
order_id || order_date ||customer_id ||shipping_method_id ||dest_address_id
1 ||2021-07-14 10:47:19 || 387 || 4 || 1
*/
/* column definitions {
"order_id": "the unique identifier of the customer order",
"order_date": "the date of the order",
"customer_id": "the id of the customer\nMaps to customer(customer_Id)",
"shipping_method_id": "the id of the shipping method\nMaps to shipping_method(method_id)",
"dest_address_id": "the id of the destination address\nMaps to address(address_id)"
}*/
CREATE TABLE "order_history"
(
history_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
status_id INTEGER
references order_status,
status_date DATETIME
)
/*
1 example row:
SELECT * FROM order_history LIMIT 1;
history_id ||order_id ||status_id || status_date
1 || 1 || 1 ||2021-07-14 17:04:28
*/
/* column definitions {
"history_id": "the unique identifier of the order history",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"status_id": "the id of the order\nMaps to order_status(status_id)",
"status_date": "the date of the status updated "
}*/
CREATE TABLE "order_line"
(
line_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
book_id INTEGER
references book,
price REAL
)
/*
1 example row:
SELECT * FROM order_line LIMIT 1;
line_id ||order_id ||book_id ||price
1024 || 2051 || 10720 || 3.19
*/
/* column definitions {
"line_id": "the unique identifier of the order line",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"book_id": "the id of the book\nMaps to book(book_id)",
"price": "the price of the order"
}*/
### Question
How many books were published in Japanese?
Clarification: published in Japanese refers to language_name = 'Japanese'
| [query_database(**{'query': 'SELECT COUNT(T2.book_id) FROM book_language AS T1 INNER JOIN book AS T2 ON T1.language_id = T2.language_id WHERE T1.language_name = 'Japanese''})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE address_status
(
status_id INTEGER
primary key,
address_status TEXT
)
/*
1 example row:
SELECT * FROM address_status LIMIT 1;
status_id ||address_status
1 || Active
*/
/* column definitions {
"status_id": "the unique identifier of the status",
"address_status": "the status of the address"
}*/
CREATE TABLE author
(
author_id INTEGER
primary key,
author_name TEXT
)
/*
1 example row:
SELECT * FROM author LIMIT 1;
author_id || author_name
1 ||A. Bartlett Giamatti
*/
/* column definitions {
"author_id": "the unique identifier of the author",
"author_name": "the name of the author"
}*/
CREATE TABLE book_language
(
language_id INTEGER
primary key,
language_code TEXT,
language_name TEXT
)
/*
1 example row:
SELECT * FROM book_language LIMIT 1;
language_id ||language_code ||language_name
1 || eng || English
*/
/* column definitions {
"language_id": "the unique identifier of the language ",
"language_code": "the language code",
"language_name": "the language name"
}*/
CREATE TABLE country
(
country_id INTEGER
primary key,
country_name TEXT
)
/*
1 example row:
SELECT * FROM country LIMIT 1;
country_id ||country_name
1 || Afghanistan
*/
/* column definitions {
"country_id": "the unique identifier of the country",
"country_name": "the country name"
}*/
CREATE TABLE address
(
address_id INTEGER
primary key,
street_number TEXT,
street_name TEXT,
city TEXT,
country_id INTEGER,
foreign key (country_id) references country(country_id)
)
/*
1 example row:
SELECT * FROM address LIMIT 1;
address_id ||street_number || street_name || city ||country_id
1 || 57 ||Glacier Hill Avenue ||Torbat-e Jām || 95
*/
/* column definitions {
"address_id": "the unique identifier of the address",
"street_number": "the street number of the address",
"street_name": "the street name",
"city": "the city where the address belongs",
"country_id": "the id of the country where the address belongs "
}*/
CREATE TABLE customer
(
customer_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
email TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
customer_id ||first_name ||last_name || email
1 || Ursola || Purdy ||upurdy0@cdbaby.com
*/
/* column definitions {
"customer_id": "the unique identifier of the customer",
"first_name": "the first name of the customer",
"last_name": "the last name of the customer",
"email": "the email of the customer"
}*/
CREATE TABLE customer_address
(
customer_id INTEGER,
address_id INTEGER,
status_id INTEGER,
primary key (customer_id, address_id),
foreign key (address_id) references address(address_id),
foreign key (customer_id) references customer(customer_id)
)
/*
1 example row:
SELECT * FROM customer_address LIMIT 1;
customer_id ||address_id ||status_id
1 || 606 || 1
*/
/* column definitions {
"customer_id": "the id of the customer\nMaps to customer(customer_id)",
"address_id": "the id of the address\nMaps to address(address_id)",
"status_id": "the id of the address status"
}*/
CREATE TABLE order_status
(
status_id INTEGER
primary key,
status_value TEXT
)
/*
1 example row:
SELECT * FROM order_status LIMIT 1;
status_id || status_value
1 ||Order Received
*/
/* column definitions {
"status_id": "the unique identifier of the order status",
"status_value": "the status value"
}*/
CREATE TABLE publisher
(
publisher_id INTEGER
primary key,
publisher_name TEXT
)
/*
1 example row:
SELECT * FROM publisher LIMIT 1;
publisher_id ||publisher_name
1 || 10/18
*/
/* column definitions {
"publisher_id": "the unique identifier of the publisher",
"publisher_name": "the name of the publisher"
}*/
CREATE TABLE book
(
book_id INTEGER
primary key,
title TEXT,
isbn13 TEXT,
language_id INTEGER,
num_pages INTEGER,
publication_date DATE,
publisher_id INTEGER,
foreign key (language_id) references book_language(language_id),
foreign key (publisher_id) references publisher(publisher_id)
)
/*
1 example row:
SELECT * FROM book LIMIT 1;
book_id || title || isbn13 ||language_id ||num_pages ||publication_date ||publisher_id
1 ||The World's First Love: Mary Mother of God ||8987059752 || 2 || 276 || 1996-09-01 || 1010
*/
/* column definitions {
"book_id": "the unique identifier of the book",
"title": "the title of the book ",
"isbn13": "the International Standard Book Number of the book",
"language_id": "the id of the book language\nMaps to book_language (language_id)",
"num_pages": "the number of the pages",
"publication_date": "the publication date of the book",
"publisher_id": "the id of the publisher\nMaps to publisher (publisher_id)"
}*/
CREATE TABLE book_author
(
book_id INTEGER,
author_id INTEGER,
primary key (book_id, author_id),
foreign key (author_id) references author(author_id),
foreign key (book_id) references book(book_id)
)
/*
1 example row:
SELECT * FROM book_author LIMIT 1;
book_id ||author_id
10539 || 1
*/
/* column definitions {
"book_id": "the id of the book\nMaps to book(book_id)",
"author_id": "the id of the author\nMaps to author(author_id)"
}*/
CREATE TABLE shipping_method
(
method_id INTEGER
primary key,
method_name TEXT,
cost REAL
)
/*
1 example row:
SELECT * FROM shipping_method LIMIT 1;
method_id ||method_name ||cost
1 || Standard || 5.9
*/
/* column definitions {
"method_id": "the unique identifier of the method",
"method_name": "the method name",
"cost": "the cost of the shipping method"
}*/
CREATE TABLE "cust_order"
(
order_id INTEGER
primary key autoincrement,
order_date DATETIME,
customer_id INTEGER
references customer,
shipping_method_id INTEGER
references shipping_method,
dest_address_id INTEGER
references address
)
/*
1 example row:
SELECT * FROM cust_order LIMIT 1;
order_id || order_date ||customer_id ||shipping_method_id ||dest_address_id
1 ||2021-07-14 10:47:19 || 387 || 4 || 1
*/
/* column definitions {
"order_id": "the unique identifier of the customer order",
"order_date": "the date of the order",
"customer_id": "the id of the customer\nMaps to customer(customer_Id)",
"shipping_method_id": "the id of the shipping method\nMaps to shipping_method(method_id)",
"dest_address_id": "the id of the destination address\nMaps to address(address_id)"
}*/
CREATE TABLE "order_history"
(
history_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
status_id INTEGER
references order_status,
status_date DATETIME
)
/*
1 example row:
SELECT * FROM order_history LIMIT 1;
history_id ||order_id ||status_id || status_date
1 || 1 || 1 ||2021-07-14 17:04:28
*/
/* column definitions {
"history_id": "the unique identifier of the order history",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"status_id": "the id of the order\nMaps to order_status(status_id)",
"status_date": "the date of the status updated "
}*/
CREATE TABLE "order_line"
(
line_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
book_id INTEGER
references book,
price REAL
)
/*
1 example row:
SELECT * FROM order_line LIMIT 1;
line_id ||order_id ||book_id ||price
1024 || 2051 || 10720 || 3.19
*/
/* column definitions {
"line_id": "the unique identifier of the order line",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"book_id": "the id of the book\nMaps to book(book_id)",
"price": "the price of the order"
}*/
|
5,986 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE address_status
(
status_id INTEGER
primary key,
address_status TEXT
)
/*
1 example row:
SELECT * FROM address_status LIMIT 1;
status_id ||address_status
1 || Active
*/
/* column definitions {
"status_id": "the unique identifier of the status",
"address_status": "the status of the address"
}*/
CREATE TABLE author
(
author_id INTEGER
primary key,
author_name TEXT
)
/*
1 example row:
SELECT * FROM author LIMIT 1;
author_id || author_name
1 ||A. Bartlett Giamatti
*/
/* column definitions {
"author_id": "the unique identifier of the author",
"author_name": "the name of the author"
}*/
CREATE TABLE book_language
(
language_id INTEGER
primary key,
language_code TEXT,
language_name TEXT
)
/*
1 example row:
SELECT * FROM book_language LIMIT 1;
language_id ||language_code ||language_name
1 || eng || English
*/
/* column definitions {
"language_id": "the unique identifier of the language ",
"language_code": "the language code",
"language_name": "the language name"
}*/
CREATE TABLE country
(
country_id INTEGER
primary key,
country_name TEXT
)
/*
1 example row:
SELECT * FROM country LIMIT 1;
country_id ||country_name
1 || Afghanistan
*/
/* column definitions {
"country_id": "the unique identifier of the country",
"country_name": "the country name"
}*/
CREATE TABLE address
(
address_id INTEGER
primary key,
street_number TEXT,
street_name TEXT,
city TEXT,
country_id INTEGER,
foreign key (country_id) references country(country_id)
)
/*
1 example row:
SELECT * FROM address LIMIT 1;
address_id ||street_number || street_name || city ||country_id
1 || 57 ||Glacier Hill Avenue ||Torbat-e Jām || 95
*/
/* column definitions {
"address_id": "the unique identifier of the address",
"street_number": "the street number of the address",
"street_name": "the street name",
"city": "the city where the address belongs",
"country_id": "the id of the country where the address belongs "
}*/
CREATE TABLE customer
(
customer_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
email TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
customer_id ||first_name ||last_name || email
1 || Ursola || Purdy ||upurdy0@cdbaby.com
*/
/* column definitions {
"customer_id": "the unique identifier of the customer",
"first_name": "the first name of the customer",
"last_name": "the last name of the customer",
"email": "the email of the customer"
}*/
CREATE TABLE customer_address
(
customer_id INTEGER,
address_id INTEGER,
status_id INTEGER,
primary key (customer_id, address_id),
foreign key (address_id) references address(address_id),
foreign key (customer_id) references customer(customer_id)
)
/*
1 example row:
SELECT * FROM customer_address LIMIT 1;
customer_id ||address_id ||status_id
1 || 606 || 1
*/
/* column definitions {
"customer_id": "the id of the customer\nMaps to customer(customer_id)",
"address_id": "the id of the address\nMaps to address(address_id)",
"status_id": "the id of the address status"
}*/
CREATE TABLE order_status
(
status_id INTEGER
primary key,
status_value TEXT
)
/*
1 example row:
SELECT * FROM order_status LIMIT 1;
status_id || status_value
1 ||Order Received
*/
/* column definitions {
"status_id": "the unique identifier of the order status",
"status_value": "the status value"
}*/
CREATE TABLE publisher
(
publisher_id INTEGER
primary key,
publisher_name TEXT
)
/*
1 example row:
SELECT * FROM publisher LIMIT 1;
publisher_id ||publisher_name
1 || 10/18
*/
/* column definitions {
"publisher_id": "the unique identifier of the publisher",
"publisher_name": "the name of the publisher"
}*/
CREATE TABLE book
(
book_id INTEGER
primary key,
title TEXT,
isbn13 TEXT,
language_id INTEGER,
num_pages INTEGER,
publication_date DATE,
publisher_id INTEGER,
foreign key (language_id) references book_language(language_id),
foreign key (publisher_id) references publisher(publisher_id)
)
/*
1 example row:
SELECT * FROM book LIMIT 1;
book_id || title || isbn13 ||language_id ||num_pages ||publication_date ||publisher_id
1 ||The World's First Love: Mary Mother of God ||8987059752 || 2 || 276 || 1996-09-01 || 1010
*/
/* column definitions {
"book_id": "the unique identifier of the book",
"title": "the title of the book ",
"isbn13": "the International Standard Book Number of the book",
"language_id": "the id of the book language\nMaps to book_language (language_id)",
"num_pages": "the number of the pages",
"publication_date": "the publication date of the book",
"publisher_id": "the id of the publisher\nMaps to publisher (publisher_id)"
}*/
CREATE TABLE book_author
(
book_id INTEGER,
author_id INTEGER,
primary key (book_id, author_id),
foreign key (author_id) references author(author_id),
foreign key (book_id) references book(book_id)
)
/*
1 example row:
SELECT * FROM book_author LIMIT 1;
book_id ||author_id
10539 || 1
*/
/* column definitions {
"book_id": "the id of the book\nMaps to book(book_id)",
"author_id": "the id of the author\nMaps to author(author_id)"
}*/
CREATE TABLE shipping_method
(
method_id INTEGER
primary key,
method_name TEXT,
cost REAL
)
/*
1 example row:
SELECT * FROM shipping_method LIMIT 1;
method_id ||method_name ||cost
1 || Standard || 5.9
*/
/* column definitions {
"method_id": "the unique identifier of the method",
"method_name": "the method name",
"cost": "the cost of the shipping method"
}*/
CREATE TABLE "cust_order"
(
order_id INTEGER
primary key autoincrement,
order_date DATETIME,
customer_id INTEGER
references customer,
shipping_method_id INTEGER
references shipping_method,
dest_address_id INTEGER
references address
)
/*
1 example row:
SELECT * FROM cust_order LIMIT 1;
order_id || order_date ||customer_id ||shipping_method_id ||dest_address_id
1 ||2021-07-14 10:47:19 || 387 || 4 || 1
*/
/* column definitions {
"order_id": "the unique identifier of the customer order",
"order_date": "the date of the order",
"customer_id": "the id of the customer\nMaps to customer(customer_Id)",
"shipping_method_id": "the id of the shipping method\nMaps to shipping_method(method_id)",
"dest_address_id": "the id of the destination address\nMaps to address(address_id)"
}*/
CREATE TABLE "order_history"
(
history_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
status_id INTEGER
references order_status,
status_date DATETIME
)
/*
1 example row:
SELECT * FROM order_history LIMIT 1;
history_id ||order_id ||status_id || status_date
1 || 1 || 1 ||2021-07-14 17:04:28
*/
/* column definitions {
"history_id": "the unique identifier of the order history",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"status_id": "the id of the order\nMaps to order_status(status_id)",
"status_date": "the date of the status updated "
}*/
CREATE TABLE "order_line"
(
line_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
book_id INTEGER
references book,
price REAL
)
/*
1 example row:
SELECT * FROM order_line LIMIT 1;
line_id ||order_id ||book_id ||price
1024 || 2051 || 10720 || 3.19
*/
/* column definitions {
"line_id": "the unique identifier of the order line",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"book_id": "the id of the book\nMaps to book(book_id)",
"price": "the price of the order"
}*/
### Question
How many orders were delivered in December 2019?
Clarification: delivered refers to status_value = 'Delivered'; in December 2019 refers to status_date LIKE '2019-12%'
| [query_database(**{'query': 'SELECT COUNT(*) FROM order_status AS T1 INNER JOIN order_history AS T2 ON T1.status_id = T2.status_id WHERE T1.status_value = 'Delivered' AND STRFTIME('%Y', T2.status_date) = '2019''})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE address_status
(
status_id INTEGER
primary key,
address_status TEXT
)
/*
1 example row:
SELECT * FROM address_status LIMIT 1;
status_id ||address_status
1 || Active
*/
/* column definitions {
"status_id": "the unique identifier of the status",
"address_status": "the status of the address"
}*/
CREATE TABLE author
(
author_id INTEGER
primary key,
author_name TEXT
)
/*
1 example row:
SELECT * FROM author LIMIT 1;
author_id || author_name
1 ||A. Bartlett Giamatti
*/
/* column definitions {
"author_id": "the unique identifier of the author",
"author_name": "the name of the author"
}*/
CREATE TABLE book_language
(
language_id INTEGER
primary key,
language_code TEXT,
language_name TEXT
)
/*
1 example row:
SELECT * FROM book_language LIMIT 1;
language_id ||language_code ||language_name
1 || eng || English
*/
/* column definitions {
"language_id": "the unique identifier of the language ",
"language_code": "the language code",
"language_name": "the language name"
}*/
CREATE TABLE country
(
country_id INTEGER
primary key,
country_name TEXT
)
/*
1 example row:
SELECT * FROM country LIMIT 1;
country_id ||country_name
1 || Afghanistan
*/
/* column definitions {
"country_id": "the unique identifier of the country",
"country_name": "the country name"
}*/
CREATE TABLE address
(
address_id INTEGER
primary key,
street_number TEXT,
street_name TEXT,
city TEXT,
country_id INTEGER,
foreign key (country_id) references country(country_id)
)
/*
1 example row:
SELECT * FROM address LIMIT 1;
address_id ||street_number || street_name || city ||country_id
1 || 57 ||Glacier Hill Avenue ||Torbat-e Jām || 95
*/
/* column definitions {
"address_id": "the unique identifier of the address",
"street_number": "the street number of the address",
"street_name": "the street name",
"city": "the city where the address belongs",
"country_id": "the id of the country where the address belongs "
}*/
CREATE TABLE customer
(
customer_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
email TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
customer_id ||first_name ||last_name || email
1 || Ursola || Purdy ||upurdy0@cdbaby.com
*/
/* column definitions {
"customer_id": "the unique identifier of the customer",
"first_name": "the first name of the customer",
"last_name": "the last name of the customer",
"email": "the email of the customer"
}*/
CREATE TABLE customer_address
(
customer_id INTEGER,
address_id INTEGER,
status_id INTEGER,
primary key (customer_id, address_id),
foreign key (address_id) references address(address_id),
foreign key (customer_id) references customer(customer_id)
)
/*
1 example row:
SELECT * FROM customer_address LIMIT 1;
customer_id ||address_id ||status_id
1 || 606 || 1
*/
/* column definitions {
"customer_id": "the id of the customer\nMaps to customer(customer_id)",
"address_id": "the id of the address\nMaps to address(address_id)",
"status_id": "the id of the address status"
}*/
CREATE TABLE order_status
(
status_id INTEGER
primary key,
status_value TEXT
)
/*
1 example row:
SELECT * FROM order_status LIMIT 1;
status_id || status_value
1 ||Order Received
*/
/* column definitions {
"status_id": "the unique identifier of the order status",
"status_value": "the status value"
}*/
CREATE TABLE publisher
(
publisher_id INTEGER
primary key,
publisher_name TEXT
)
/*
1 example row:
SELECT * FROM publisher LIMIT 1;
publisher_id ||publisher_name
1 || 10/18
*/
/* column definitions {
"publisher_id": "the unique identifier of the publisher",
"publisher_name": "the name of the publisher"
}*/
CREATE TABLE book
(
book_id INTEGER
primary key,
title TEXT,
isbn13 TEXT,
language_id INTEGER,
num_pages INTEGER,
publication_date DATE,
publisher_id INTEGER,
foreign key (language_id) references book_language(language_id),
foreign key (publisher_id) references publisher(publisher_id)
)
/*
1 example row:
SELECT * FROM book LIMIT 1;
book_id || title || isbn13 ||language_id ||num_pages ||publication_date ||publisher_id
1 ||The World's First Love: Mary Mother of God ||8987059752 || 2 || 276 || 1996-09-01 || 1010
*/
/* column definitions {
"book_id": "the unique identifier of the book",
"title": "the title of the book ",
"isbn13": "the International Standard Book Number of the book",
"language_id": "the id of the book language\nMaps to book_language (language_id)",
"num_pages": "the number of the pages",
"publication_date": "the publication date of the book",
"publisher_id": "the id of the publisher\nMaps to publisher (publisher_id)"
}*/
CREATE TABLE book_author
(
book_id INTEGER,
author_id INTEGER,
primary key (book_id, author_id),
foreign key (author_id) references author(author_id),
foreign key (book_id) references book(book_id)
)
/*
1 example row:
SELECT * FROM book_author LIMIT 1;
book_id ||author_id
10539 || 1
*/
/* column definitions {
"book_id": "the id of the book\nMaps to book(book_id)",
"author_id": "the id of the author\nMaps to author(author_id)"
}*/
CREATE TABLE shipping_method
(
method_id INTEGER
primary key,
method_name TEXT,
cost REAL
)
/*
1 example row:
SELECT * FROM shipping_method LIMIT 1;
method_id ||method_name ||cost
1 || Standard || 5.9
*/
/* column definitions {
"method_id": "the unique identifier of the method",
"method_name": "the method name",
"cost": "the cost of the shipping method"
}*/
CREATE TABLE "cust_order"
(
order_id INTEGER
primary key autoincrement,
order_date DATETIME,
customer_id INTEGER
references customer,
shipping_method_id INTEGER
references shipping_method,
dest_address_id INTEGER
references address
)
/*
1 example row:
SELECT * FROM cust_order LIMIT 1;
order_id || order_date ||customer_id ||shipping_method_id ||dest_address_id
1 ||2021-07-14 10:47:19 || 387 || 4 || 1
*/
/* column definitions {
"order_id": "the unique identifier of the customer order",
"order_date": "the date of the order",
"customer_id": "the id of the customer\nMaps to customer(customer_Id)",
"shipping_method_id": "the id of the shipping method\nMaps to shipping_method(method_id)",
"dest_address_id": "the id of the destination address\nMaps to address(address_id)"
}*/
CREATE TABLE "order_history"
(
history_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
status_id INTEGER
references order_status,
status_date DATETIME
)
/*
1 example row:
SELECT * FROM order_history LIMIT 1;
history_id ||order_id ||status_id || status_date
1 || 1 || 1 ||2021-07-14 17:04:28
*/
/* column definitions {
"history_id": "the unique identifier of the order history",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"status_id": "the id of the order\nMaps to order_status(status_id)",
"status_date": "the date of the status updated "
}*/
CREATE TABLE "order_line"
(
line_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
book_id INTEGER
references book,
price REAL
)
/*
1 example row:
SELECT * FROM order_line LIMIT 1;
line_id ||order_id ||book_id ||price
1024 || 2051 || 10720 || 3.19
*/
/* column definitions {
"line_id": "the unique identifier of the order line",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"book_id": "the id of the book\nMaps to book(book_id)",
"price": "the price of the order"
}*/
|
5,990 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE address_status
(
status_id INTEGER
primary key,
address_status TEXT
)
/*
1 example row:
SELECT * FROM address_status LIMIT 1;
status_id ||address_status
1 || Active
*/
/* column definitions {
"status_id": "the unique identifier of the status",
"address_status": "the status of the address"
}*/
CREATE TABLE author
(
author_id INTEGER
primary key,
author_name TEXT
)
/*
1 example row:
SELECT * FROM author LIMIT 1;
author_id || author_name
1 ||A. Bartlett Giamatti
*/
/* column definitions {
"author_id": "the unique identifier of the author",
"author_name": "the name of the author"
}*/
CREATE TABLE book_language
(
language_id INTEGER
primary key,
language_code TEXT,
language_name TEXT
)
/*
1 example row:
SELECT * FROM book_language LIMIT 1;
language_id ||language_code ||language_name
1 || eng || English
*/
/* column definitions {
"language_id": "the unique identifier of the language ",
"language_code": "the language code",
"language_name": "the language name"
}*/
CREATE TABLE country
(
country_id INTEGER
primary key,
country_name TEXT
)
/*
1 example row:
SELECT * FROM country LIMIT 1;
country_id ||country_name
1 || Afghanistan
*/
/* column definitions {
"country_id": "the unique identifier of the country",
"country_name": "the country name"
}*/
CREATE TABLE address
(
address_id INTEGER
primary key,
street_number TEXT,
street_name TEXT,
city TEXT,
country_id INTEGER,
foreign key (country_id) references country(country_id)
)
/*
1 example row:
SELECT * FROM address LIMIT 1;
address_id ||street_number || street_name || city ||country_id
1 || 57 ||Glacier Hill Avenue ||Torbat-e Jām || 95
*/
/* column definitions {
"address_id": "the unique identifier of the address",
"street_number": "the street number of the address",
"street_name": "the street name",
"city": "the city where the address belongs",
"country_id": "the id of the country where the address belongs "
}*/
CREATE TABLE customer
(
customer_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
email TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
customer_id ||first_name ||last_name || email
1 || Ursola || Purdy ||upurdy0@cdbaby.com
*/
/* column definitions {
"customer_id": "the unique identifier of the customer",
"first_name": "the first name of the customer",
"last_name": "the last name of the customer",
"email": "the email of the customer"
}*/
CREATE TABLE customer_address
(
customer_id INTEGER,
address_id INTEGER,
status_id INTEGER,
primary key (customer_id, address_id),
foreign key (address_id) references address(address_id),
foreign key (customer_id) references customer(customer_id)
)
/*
1 example row:
SELECT * FROM customer_address LIMIT 1;
customer_id ||address_id ||status_id
1 || 606 || 1
*/
/* column definitions {
"customer_id": "the id of the customer\nMaps to customer(customer_id)",
"address_id": "the id of the address\nMaps to address(address_id)",
"status_id": "the id of the address status"
}*/
CREATE TABLE order_status
(
status_id INTEGER
primary key,
status_value TEXT
)
/*
1 example row:
SELECT * FROM order_status LIMIT 1;
status_id || status_value
1 ||Order Received
*/
/* column definitions {
"status_id": "the unique identifier of the order status",
"status_value": "the status value"
}*/
CREATE TABLE publisher
(
publisher_id INTEGER
primary key,
publisher_name TEXT
)
/*
1 example row:
SELECT * FROM publisher LIMIT 1;
publisher_id ||publisher_name
1 || 10/18
*/
/* column definitions {
"publisher_id": "the unique identifier of the publisher",
"publisher_name": "the name of the publisher"
}*/
CREATE TABLE book
(
book_id INTEGER
primary key,
title TEXT,
isbn13 TEXT,
language_id INTEGER,
num_pages INTEGER,
publication_date DATE,
publisher_id INTEGER,
foreign key (language_id) references book_language(language_id),
foreign key (publisher_id) references publisher(publisher_id)
)
/*
1 example row:
SELECT * FROM book LIMIT 1;
book_id || title || isbn13 ||language_id ||num_pages ||publication_date ||publisher_id
1 ||The World's First Love: Mary Mother of God ||8987059752 || 2 || 276 || 1996-09-01 || 1010
*/
/* column definitions {
"book_id": "the unique identifier of the book",
"title": "the title of the book ",
"isbn13": "the International Standard Book Number of the book",
"language_id": "the id of the book language\nMaps to book_language (language_id)",
"num_pages": "the number of the pages",
"publication_date": "the publication date of the book",
"publisher_id": "the id of the publisher\nMaps to publisher (publisher_id)"
}*/
CREATE TABLE book_author
(
book_id INTEGER,
author_id INTEGER,
primary key (book_id, author_id),
foreign key (author_id) references author(author_id),
foreign key (book_id) references book(book_id)
)
/*
1 example row:
SELECT * FROM book_author LIMIT 1;
book_id ||author_id
10539 || 1
*/
/* column definitions {
"book_id": "the id of the book\nMaps to book(book_id)",
"author_id": "the id of the author\nMaps to author(author_id)"
}*/
CREATE TABLE shipping_method
(
method_id INTEGER
primary key,
method_name TEXT,
cost REAL
)
/*
1 example row:
SELECT * FROM shipping_method LIMIT 1;
method_id ||method_name ||cost
1 || Standard || 5.9
*/
/* column definitions {
"method_id": "the unique identifier of the method",
"method_name": "the method name",
"cost": "the cost of the shipping method"
}*/
CREATE TABLE "cust_order"
(
order_id INTEGER
primary key autoincrement,
order_date DATETIME,
customer_id INTEGER
references customer,
shipping_method_id INTEGER
references shipping_method,
dest_address_id INTEGER
references address
)
/*
1 example row:
SELECT * FROM cust_order LIMIT 1;
order_id || order_date ||customer_id ||shipping_method_id ||dest_address_id
1 ||2021-07-14 10:47:19 || 387 || 4 || 1
*/
/* column definitions {
"order_id": "the unique identifier of the customer order",
"order_date": "the date of the order",
"customer_id": "the id of the customer\nMaps to customer(customer_Id)",
"shipping_method_id": "the id of the shipping method\nMaps to shipping_method(method_id)",
"dest_address_id": "the id of the destination address\nMaps to address(address_id)"
}*/
CREATE TABLE "order_history"
(
history_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
status_id INTEGER
references order_status,
status_date DATETIME
)
/*
1 example row:
SELECT * FROM order_history LIMIT 1;
history_id ||order_id ||status_id || status_date
1 || 1 || 1 ||2021-07-14 17:04:28
*/
/* column definitions {
"history_id": "the unique identifier of the order history",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"status_id": "the id of the order\nMaps to order_status(status_id)",
"status_date": "the date of the status updated "
}*/
CREATE TABLE "order_line"
(
line_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
book_id INTEGER
references book,
price REAL
)
/*
1 example row:
SELECT * FROM order_line LIMIT 1;
line_id ||order_id ||book_id ||price
1024 || 2051 || 10720 || 3.19
*/
/* column definitions {
"line_id": "the unique identifier of the order line",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"book_id": "the id of the book\nMaps to book(book_id)",
"price": "the price of the order"
}*/
### Question
Which year has the most customer orders?
Clarification: year with the most customer orders refers to Max(count(order_id))
| [query_database(**{'query': 'SELECT strftime('%Y', order_date) FROM cust_order GROUP BY strftime('%Y', order_date) ORDER BY COUNT(strftime('%Y', order_date)) DESC LIMIT 1'})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE address_status
(
status_id INTEGER
primary key,
address_status TEXT
)
/*
1 example row:
SELECT * FROM address_status LIMIT 1;
status_id ||address_status
1 || Active
*/
/* column definitions {
"status_id": "the unique identifier of the status",
"address_status": "the status of the address"
}*/
CREATE TABLE author
(
author_id INTEGER
primary key,
author_name TEXT
)
/*
1 example row:
SELECT * FROM author LIMIT 1;
author_id || author_name
1 ||A. Bartlett Giamatti
*/
/* column definitions {
"author_id": "the unique identifier of the author",
"author_name": "the name of the author"
}*/
CREATE TABLE book_language
(
language_id INTEGER
primary key,
language_code TEXT,
language_name TEXT
)
/*
1 example row:
SELECT * FROM book_language LIMIT 1;
language_id ||language_code ||language_name
1 || eng || English
*/
/* column definitions {
"language_id": "the unique identifier of the language ",
"language_code": "the language code",
"language_name": "the language name"
}*/
CREATE TABLE country
(
country_id INTEGER
primary key,
country_name TEXT
)
/*
1 example row:
SELECT * FROM country LIMIT 1;
country_id ||country_name
1 || Afghanistan
*/
/* column definitions {
"country_id": "the unique identifier of the country",
"country_name": "the country name"
}*/
CREATE TABLE address
(
address_id INTEGER
primary key,
street_number TEXT,
street_name TEXT,
city TEXT,
country_id INTEGER,
foreign key (country_id) references country(country_id)
)
/*
1 example row:
SELECT * FROM address LIMIT 1;
address_id ||street_number || street_name || city ||country_id
1 || 57 ||Glacier Hill Avenue ||Torbat-e Jām || 95
*/
/* column definitions {
"address_id": "the unique identifier of the address",
"street_number": "the street number of the address",
"street_name": "the street name",
"city": "the city where the address belongs",
"country_id": "the id of the country where the address belongs "
}*/
CREATE TABLE customer
(
customer_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
email TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
customer_id ||first_name ||last_name || email
1 || Ursola || Purdy ||upurdy0@cdbaby.com
*/
/* column definitions {
"customer_id": "the unique identifier of the customer",
"first_name": "the first name of the customer",
"last_name": "the last name of the customer",
"email": "the email of the customer"
}*/
CREATE TABLE customer_address
(
customer_id INTEGER,
address_id INTEGER,
status_id INTEGER,
primary key (customer_id, address_id),
foreign key (address_id) references address(address_id),
foreign key (customer_id) references customer(customer_id)
)
/*
1 example row:
SELECT * FROM customer_address LIMIT 1;
customer_id ||address_id ||status_id
1 || 606 || 1
*/
/* column definitions {
"customer_id": "the id of the customer\nMaps to customer(customer_id)",
"address_id": "the id of the address\nMaps to address(address_id)",
"status_id": "the id of the address status"
}*/
CREATE TABLE order_status
(
status_id INTEGER
primary key,
status_value TEXT
)
/*
1 example row:
SELECT * FROM order_status LIMIT 1;
status_id || status_value
1 ||Order Received
*/
/* column definitions {
"status_id": "the unique identifier of the order status",
"status_value": "the status value"
}*/
CREATE TABLE publisher
(
publisher_id INTEGER
primary key,
publisher_name TEXT
)
/*
1 example row:
SELECT * FROM publisher LIMIT 1;
publisher_id ||publisher_name
1 || 10/18
*/
/* column definitions {
"publisher_id": "the unique identifier of the publisher",
"publisher_name": "the name of the publisher"
}*/
CREATE TABLE book
(
book_id INTEGER
primary key,
title TEXT,
isbn13 TEXT,
language_id INTEGER,
num_pages INTEGER,
publication_date DATE,
publisher_id INTEGER,
foreign key (language_id) references book_language(language_id),
foreign key (publisher_id) references publisher(publisher_id)
)
/*
1 example row:
SELECT * FROM book LIMIT 1;
book_id || title || isbn13 ||language_id ||num_pages ||publication_date ||publisher_id
1 ||The World's First Love: Mary Mother of God ||8987059752 || 2 || 276 || 1996-09-01 || 1010
*/
/* column definitions {
"book_id": "the unique identifier of the book",
"title": "the title of the book ",
"isbn13": "the International Standard Book Number of the book",
"language_id": "the id of the book language\nMaps to book_language (language_id)",
"num_pages": "the number of the pages",
"publication_date": "the publication date of the book",
"publisher_id": "the id of the publisher\nMaps to publisher (publisher_id)"
}*/
CREATE TABLE book_author
(
book_id INTEGER,
author_id INTEGER,
primary key (book_id, author_id),
foreign key (author_id) references author(author_id),
foreign key (book_id) references book(book_id)
)
/*
1 example row:
SELECT * FROM book_author LIMIT 1;
book_id ||author_id
10539 || 1
*/
/* column definitions {
"book_id": "the id of the book\nMaps to book(book_id)",
"author_id": "the id of the author\nMaps to author(author_id)"
}*/
CREATE TABLE shipping_method
(
method_id INTEGER
primary key,
method_name TEXT,
cost REAL
)
/*
1 example row:
SELECT * FROM shipping_method LIMIT 1;
method_id ||method_name ||cost
1 || Standard || 5.9
*/
/* column definitions {
"method_id": "the unique identifier of the method",
"method_name": "the method name",
"cost": "the cost of the shipping method"
}*/
CREATE TABLE "cust_order"
(
order_id INTEGER
primary key autoincrement,
order_date DATETIME,
customer_id INTEGER
references customer,
shipping_method_id INTEGER
references shipping_method,
dest_address_id INTEGER
references address
)
/*
1 example row:
SELECT * FROM cust_order LIMIT 1;
order_id || order_date ||customer_id ||shipping_method_id ||dest_address_id
1 ||2021-07-14 10:47:19 || 387 || 4 || 1
*/
/* column definitions {
"order_id": "the unique identifier of the customer order",
"order_date": "the date of the order",
"customer_id": "the id of the customer\nMaps to customer(customer_Id)",
"shipping_method_id": "the id of the shipping method\nMaps to shipping_method(method_id)",
"dest_address_id": "the id of the destination address\nMaps to address(address_id)"
}*/
CREATE TABLE "order_history"
(
history_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
status_id INTEGER
references order_status,
status_date DATETIME
)
/*
1 example row:
SELECT * FROM order_history LIMIT 1;
history_id ||order_id ||status_id || status_date
1 || 1 || 1 ||2021-07-14 17:04:28
*/
/* column definitions {
"history_id": "the unique identifier of the order history",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"status_id": "the id of the order\nMaps to order_status(status_id)",
"status_date": "the date of the status updated "
}*/
CREATE TABLE "order_line"
(
line_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
book_id INTEGER
references book,
price REAL
)
/*
1 example row:
SELECT * FROM order_line LIMIT 1;
line_id ||order_id ||book_id ||price
1024 || 2051 || 10720 || 3.19
*/
/* column definitions {
"line_id": "the unique identifier of the order line",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"book_id": "the id of the book\nMaps to book(book_id)",
"price": "the price of the order"
}*/
|
5,994 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE address_status
(
status_id INTEGER
primary key,
address_status TEXT
)
/*
1 example row:
SELECT * FROM address_status LIMIT 1;
status_id ||address_status
1 || Active
*/
/* column definitions {
"status_id": "the unique identifier of the status",
"address_status": "the status of the address"
}*/
CREATE TABLE author
(
author_id INTEGER
primary key,
author_name TEXT
)
/*
1 example row:
SELECT * FROM author LIMIT 1;
author_id || author_name
1 ||A. Bartlett Giamatti
*/
/* column definitions {
"author_id": "the unique identifier of the author",
"author_name": "the name of the author"
}*/
CREATE TABLE book_language
(
language_id INTEGER
primary key,
language_code TEXT,
language_name TEXT
)
/*
1 example row:
SELECT * FROM book_language LIMIT 1;
language_id ||language_code ||language_name
1 || eng || English
*/
/* column definitions {
"language_id": "the unique identifier of the language ",
"language_code": "the language code",
"language_name": "the language name"
}*/
CREATE TABLE country
(
country_id INTEGER
primary key,
country_name TEXT
)
/*
1 example row:
SELECT * FROM country LIMIT 1;
country_id ||country_name
1 || Afghanistan
*/
/* column definitions {
"country_id": "the unique identifier of the country",
"country_name": "the country name"
}*/
CREATE TABLE address
(
address_id INTEGER
primary key,
street_number TEXT,
street_name TEXT,
city TEXT,
country_id INTEGER,
foreign key (country_id) references country(country_id)
)
/*
1 example row:
SELECT * FROM address LIMIT 1;
address_id ||street_number || street_name || city ||country_id
1 || 57 ||Glacier Hill Avenue ||Torbat-e Jām || 95
*/
/* column definitions {
"address_id": "the unique identifier of the address",
"street_number": "the street number of the address",
"street_name": "the street name",
"city": "the city where the address belongs",
"country_id": "the id of the country where the address belongs "
}*/
CREATE TABLE customer
(
customer_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
email TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
customer_id ||first_name ||last_name || email
1 || Ursola || Purdy ||upurdy0@cdbaby.com
*/
/* column definitions {
"customer_id": "the unique identifier of the customer",
"first_name": "the first name of the customer",
"last_name": "the last name of the customer",
"email": "the email of the customer"
}*/
CREATE TABLE customer_address
(
customer_id INTEGER,
address_id INTEGER,
status_id INTEGER,
primary key (customer_id, address_id),
foreign key (address_id) references address(address_id),
foreign key (customer_id) references customer(customer_id)
)
/*
1 example row:
SELECT * FROM customer_address LIMIT 1;
customer_id ||address_id ||status_id
1 || 606 || 1
*/
/* column definitions {
"customer_id": "the id of the customer\nMaps to customer(customer_id)",
"address_id": "the id of the address\nMaps to address(address_id)",
"status_id": "the id of the address status"
}*/
CREATE TABLE order_status
(
status_id INTEGER
primary key,
status_value TEXT
)
/*
1 example row:
SELECT * FROM order_status LIMIT 1;
status_id || status_value
1 ||Order Received
*/
/* column definitions {
"status_id": "the unique identifier of the order status",
"status_value": "the status value"
}*/
CREATE TABLE publisher
(
publisher_id INTEGER
primary key,
publisher_name TEXT
)
/*
1 example row:
SELECT * FROM publisher LIMIT 1;
publisher_id ||publisher_name
1 || 10/18
*/
/* column definitions {
"publisher_id": "the unique identifier of the publisher",
"publisher_name": "the name of the publisher"
}*/
CREATE TABLE book
(
book_id INTEGER
primary key,
title TEXT,
isbn13 TEXT,
language_id INTEGER,
num_pages INTEGER,
publication_date DATE,
publisher_id INTEGER,
foreign key (language_id) references book_language(language_id),
foreign key (publisher_id) references publisher(publisher_id)
)
/*
1 example row:
SELECT * FROM book LIMIT 1;
book_id || title || isbn13 ||language_id ||num_pages ||publication_date ||publisher_id
1 ||The World's First Love: Mary Mother of God ||8987059752 || 2 || 276 || 1996-09-01 || 1010
*/
/* column definitions {
"book_id": "the unique identifier of the book",
"title": "the title of the book ",
"isbn13": "the International Standard Book Number of the book",
"language_id": "the id of the book language\nMaps to book_language (language_id)",
"num_pages": "the number of the pages",
"publication_date": "the publication date of the book",
"publisher_id": "the id of the publisher\nMaps to publisher (publisher_id)"
}*/
CREATE TABLE book_author
(
book_id INTEGER,
author_id INTEGER,
primary key (book_id, author_id),
foreign key (author_id) references author(author_id),
foreign key (book_id) references book(book_id)
)
/*
1 example row:
SELECT * FROM book_author LIMIT 1;
book_id ||author_id
10539 || 1
*/
/* column definitions {
"book_id": "the id of the book\nMaps to book(book_id)",
"author_id": "the id of the author\nMaps to author(author_id)"
}*/
CREATE TABLE shipping_method
(
method_id INTEGER
primary key,
method_name TEXT,
cost REAL
)
/*
1 example row:
SELECT * FROM shipping_method LIMIT 1;
method_id ||method_name ||cost
1 || Standard || 5.9
*/
/* column definitions {
"method_id": "the unique identifier of the method",
"method_name": "the method name",
"cost": "the cost of the shipping method"
}*/
CREATE TABLE "cust_order"
(
order_id INTEGER
primary key autoincrement,
order_date DATETIME,
customer_id INTEGER
references customer,
shipping_method_id INTEGER
references shipping_method,
dest_address_id INTEGER
references address
)
/*
1 example row:
SELECT * FROM cust_order LIMIT 1;
order_id || order_date ||customer_id ||shipping_method_id ||dest_address_id
1 ||2021-07-14 10:47:19 || 387 || 4 || 1
*/
/* column definitions {
"order_id": "the unique identifier of the customer order",
"order_date": "the date of the order",
"customer_id": "the id of the customer\nMaps to customer(customer_Id)",
"shipping_method_id": "the id of the shipping method\nMaps to shipping_method(method_id)",
"dest_address_id": "the id of the destination address\nMaps to address(address_id)"
}*/
CREATE TABLE "order_history"
(
history_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
status_id INTEGER
references order_status,
status_date DATETIME
)
/*
1 example row:
SELECT * FROM order_history LIMIT 1;
history_id ||order_id ||status_id || status_date
1 || 1 || 1 ||2021-07-14 17:04:28
*/
/* column definitions {
"history_id": "the unique identifier of the order history",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"status_id": "the id of the order\nMaps to order_status(status_id)",
"status_date": "the date of the status updated "
}*/
CREATE TABLE "order_line"
(
line_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
book_id INTEGER
references book,
price REAL
)
/*
1 example row:
SELECT * FROM order_line LIMIT 1;
line_id ||order_id ||book_id ||price
1024 || 2051 || 10720 || 3.19
*/
/* column definitions {
"line_id": "the unique identifier of the order line",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"book_id": "the id of the book\nMaps to book(book_id)",
"price": "the price of the order"
}*/
### Question
How many publishers have the word "book" in their name?
Clarification: publisher have the word 'book' refers to publisher_name LIKE '%book%'
| [query_database(**{'query': 'SELECT COUNT(*) FROM publisher WHERE publisher_name LIKE '%book%''})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE address_status
(
status_id INTEGER
primary key,
address_status TEXT
)
/*
1 example row:
SELECT * FROM address_status LIMIT 1;
status_id ||address_status
1 || Active
*/
/* column definitions {
"status_id": "the unique identifier of the status",
"address_status": "the status of the address"
}*/
CREATE TABLE author
(
author_id INTEGER
primary key,
author_name TEXT
)
/*
1 example row:
SELECT * FROM author LIMIT 1;
author_id || author_name
1 ||A. Bartlett Giamatti
*/
/* column definitions {
"author_id": "the unique identifier of the author",
"author_name": "the name of the author"
}*/
CREATE TABLE book_language
(
language_id INTEGER
primary key,
language_code TEXT,
language_name TEXT
)
/*
1 example row:
SELECT * FROM book_language LIMIT 1;
language_id ||language_code ||language_name
1 || eng || English
*/
/* column definitions {
"language_id": "the unique identifier of the language ",
"language_code": "the language code",
"language_name": "the language name"
}*/
CREATE TABLE country
(
country_id INTEGER
primary key,
country_name TEXT
)
/*
1 example row:
SELECT * FROM country LIMIT 1;
country_id ||country_name
1 || Afghanistan
*/
/* column definitions {
"country_id": "the unique identifier of the country",
"country_name": "the country name"
}*/
CREATE TABLE address
(
address_id INTEGER
primary key,
street_number TEXT,
street_name TEXT,
city TEXT,
country_id INTEGER,
foreign key (country_id) references country(country_id)
)
/*
1 example row:
SELECT * FROM address LIMIT 1;
address_id ||street_number || street_name || city ||country_id
1 || 57 ||Glacier Hill Avenue ||Torbat-e Jām || 95
*/
/* column definitions {
"address_id": "the unique identifier of the address",
"street_number": "the street number of the address",
"street_name": "the street name",
"city": "the city where the address belongs",
"country_id": "the id of the country where the address belongs "
}*/
CREATE TABLE customer
(
customer_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
email TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
customer_id ||first_name ||last_name || email
1 || Ursola || Purdy ||upurdy0@cdbaby.com
*/
/* column definitions {
"customer_id": "the unique identifier of the customer",
"first_name": "the first name of the customer",
"last_name": "the last name of the customer",
"email": "the email of the customer"
}*/
CREATE TABLE customer_address
(
customer_id INTEGER,
address_id INTEGER,
status_id INTEGER,
primary key (customer_id, address_id),
foreign key (address_id) references address(address_id),
foreign key (customer_id) references customer(customer_id)
)
/*
1 example row:
SELECT * FROM customer_address LIMIT 1;
customer_id ||address_id ||status_id
1 || 606 || 1
*/
/* column definitions {
"customer_id": "the id of the customer\nMaps to customer(customer_id)",
"address_id": "the id of the address\nMaps to address(address_id)",
"status_id": "the id of the address status"
}*/
CREATE TABLE order_status
(
status_id INTEGER
primary key,
status_value TEXT
)
/*
1 example row:
SELECT * FROM order_status LIMIT 1;
status_id || status_value
1 ||Order Received
*/
/* column definitions {
"status_id": "the unique identifier of the order status",
"status_value": "the status value"
}*/
CREATE TABLE publisher
(
publisher_id INTEGER
primary key,
publisher_name TEXT
)
/*
1 example row:
SELECT * FROM publisher LIMIT 1;
publisher_id ||publisher_name
1 || 10/18
*/
/* column definitions {
"publisher_id": "the unique identifier of the publisher",
"publisher_name": "the name of the publisher"
}*/
CREATE TABLE book
(
book_id INTEGER
primary key,
title TEXT,
isbn13 TEXT,
language_id INTEGER,
num_pages INTEGER,
publication_date DATE,
publisher_id INTEGER,
foreign key (language_id) references book_language(language_id),
foreign key (publisher_id) references publisher(publisher_id)
)
/*
1 example row:
SELECT * FROM book LIMIT 1;
book_id || title || isbn13 ||language_id ||num_pages ||publication_date ||publisher_id
1 ||The World's First Love: Mary Mother of God ||8987059752 || 2 || 276 || 1996-09-01 || 1010
*/
/* column definitions {
"book_id": "the unique identifier of the book",
"title": "the title of the book ",
"isbn13": "the International Standard Book Number of the book",
"language_id": "the id of the book language\nMaps to book_language (language_id)",
"num_pages": "the number of the pages",
"publication_date": "the publication date of the book",
"publisher_id": "the id of the publisher\nMaps to publisher (publisher_id)"
}*/
CREATE TABLE book_author
(
book_id INTEGER,
author_id INTEGER,
primary key (book_id, author_id),
foreign key (author_id) references author(author_id),
foreign key (book_id) references book(book_id)
)
/*
1 example row:
SELECT * FROM book_author LIMIT 1;
book_id ||author_id
10539 || 1
*/
/* column definitions {
"book_id": "the id of the book\nMaps to book(book_id)",
"author_id": "the id of the author\nMaps to author(author_id)"
}*/
CREATE TABLE shipping_method
(
method_id INTEGER
primary key,
method_name TEXT,
cost REAL
)
/*
1 example row:
SELECT * FROM shipping_method LIMIT 1;
method_id ||method_name ||cost
1 || Standard || 5.9
*/
/* column definitions {
"method_id": "the unique identifier of the method",
"method_name": "the method name",
"cost": "the cost of the shipping method"
}*/
CREATE TABLE "cust_order"
(
order_id INTEGER
primary key autoincrement,
order_date DATETIME,
customer_id INTEGER
references customer,
shipping_method_id INTEGER
references shipping_method,
dest_address_id INTEGER
references address
)
/*
1 example row:
SELECT * FROM cust_order LIMIT 1;
order_id || order_date ||customer_id ||shipping_method_id ||dest_address_id
1 ||2021-07-14 10:47:19 || 387 || 4 || 1
*/
/* column definitions {
"order_id": "the unique identifier of the customer order",
"order_date": "the date of the order",
"customer_id": "the id of the customer\nMaps to customer(customer_Id)",
"shipping_method_id": "the id of the shipping method\nMaps to shipping_method(method_id)",
"dest_address_id": "the id of the destination address\nMaps to address(address_id)"
}*/
CREATE TABLE "order_history"
(
history_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
status_id INTEGER
references order_status,
status_date DATETIME
)
/*
1 example row:
SELECT * FROM order_history LIMIT 1;
history_id ||order_id ||status_id || status_date
1 || 1 || 1 ||2021-07-14 17:04:28
*/
/* column definitions {
"history_id": "the unique identifier of the order history",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"status_id": "the id of the order\nMaps to order_status(status_id)",
"status_date": "the date of the status updated "
}*/
CREATE TABLE "order_line"
(
line_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
book_id INTEGER
references book,
price REAL
)
/*
1 example row:
SELECT * FROM order_line LIMIT 1;
line_id ||order_id ||book_id ||price
1024 || 2051 || 10720 || 3.19
*/
/* column definitions {
"line_id": "the unique identifier of the order line",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"book_id": "the id of the book\nMaps to book(book_id)",
"price": "the price of the order"
}*/
|
5,998 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE address_status
(
status_id INTEGER
primary key,
address_status TEXT
)
/*
1 example row:
SELECT * FROM address_status LIMIT 1;
status_id ||address_status
1 || Active
*/
/* column definitions {
"status_id": "the unique identifier of the status",
"address_status": "the status of the address"
}*/
CREATE TABLE author
(
author_id INTEGER
primary key,
author_name TEXT
)
/*
1 example row:
SELECT * FROM author LIMIT 1;
author_id || author_name
1 ||A. Bartlett Giamatti
*/
/* column definitions {
"author_id": "the unique identifier of the author",
"author_name": "the name of the author"
}*/
CREATE TABLE book_language
(
language_id INTEGER
primary key,
language_code TEXT,
language_name TEXT
)
/*
1 example row:
SELECT * FROM book_language LIMIT 1;
language_id ||language_code ||language_name
1 || eng || English
*/
/* column definitions {
"language_id": "the unique identifier of the language ",
"language_code": "the language code",
"language_name": "the language name"
}*/
CREATE TABLE country
(
country_id INTEGER
primary key,
country_name TEXT
)
/*
1 example row:
SELECT * FROM country LIMIT 1;
country_id ||country_name
1 || Afghanistan
*/
/* column definitions {
"country_id": "the unique identifier of the country",
"country_name": "the country name"
}*/
CREATE TABLE address
(
address_id INTEGER
primary key,
street_number TEXT,
street_name TEXT,
city TEXT,
country_id INTEGER,
foreign key (country_id) references country(country_id)
)
/*
1 example row:
SELECT * FROM address LIMIT 1;
address_id ||street_number || street_name || city ||country_id
1 || 57 ||Glacier Hill Avenue ||Torbat-e Jām || 95
*/
/* column definitions {
"address_id": "the unique identifier of the address",
"street_number": "the street number of the address",
"street_name": "the street name",
"city": "the city where the address belongs",
"country_id": "the id of the country where the address belongs "
}*/
CREATE TABLE customer
(
customer_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
email TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
customer_id ||first_name ||last_name || email
1 || Ursola || Purdy ||upurdy0@cdbaby.com
*/
/* column definitions {
"customer_id": "the unique identifier of the customer",
"first_name": "the first name of the customer",
"last_name": "the last name of the customer",
"email": "the email of the customer"
}*/
CREATE TABLE customer_address
(
customer_id INTEGER,
address_id INTEGER,
status_id INTEGER,
primary key (customer_id, address_id),
foreign key (address_id) references address(address_id),
foreign key (customer_id) references customer(customer_id)
)
/*
1 example row:
SELECT * FROM customer_address LIMIT 1;
customer_id ||address_id ||status_id
1 || 606 || 1
*/
/* column definitions {
"customer_id": "the id of the customer\nMaps to customer(customer_id)",
"address_id": "the id of the address\nMaps to address(address_id)",
"status_id": "the id of the address status"
}*/
CREATE TABLE order_status
(
status_id INTEGER
primary key,
status_value TEXT
)
/*
1 example row:
SELECT * FROM order_status LIMIT 1;
status_id || status_value
1 ||Order Received
*/
/* column definitions {
"status_id": "the unique identifier of the order status",
"status_value": "the status value"
}*/
CREATE TABLE publisher
(
publisher_id INTEGER
primary key,
publisher_name TEXT
)
/*
1 example row:
SELECT * FROM publisher LIMIT 1;
publisher_id ||publisher_name
1 || 10/18
*/
/* column definitions {
"publisher_id": "the unique identifier of the publisher",
"publisher_name": "the name of the publisher"
}*/
CREATE TABLE book
(
book_id INTEGER
primary key,
title TEXT,
isbn13 TEXT,
language_id INTEGER,
num_pages INTEGER,
publication_date DATE,
publisher_id INTEGER,
foreign key (language_id) references book_language(language_id),
foreign key (publisher_id) references publisher(publisher_id)
)
/*
1 example row:
SELECT * FROM book LIMIT 1;
book_id || title || isbn13 ||language_id ||num_pages ||publication_date ||publisher_id
1 ||The World's First Love: Mary Mother of God ||8987059752 || 2 || 276 || 1996-09-01 || 1010
*/
/* column definitions {
"book_id": "the unique identifier of the book",
"title": "the title of the book ",
"isbn13": "the International Standard Book Number of the book",
"language_id": "the id of the book language\nMaps to book_language (language_id)",
"num_pages": "the number of the pages",
"publication_date": "the publication date of the book",
"publisher_id": "the id of the publisher\nMaps to publisher (publisher_id)"
}*/
CREATE TABLE book_author
(
book_id INTEGER,
author_id INTEGER,
primary key (book_id, author_id),
foreign key (author_id) references author(author_id),
foreign key (book_id) references book(book_id)
)
/*
1 example row:
SELECT * FROM book_author LIMIT 1;
book_id ||author_id
10539 || 1
*/
/* column definitions {
"book_id": "the id of the book\nMaps to book(book_id)",
"author_id": "the id of the author\nMaps to author(author_id)"
}*/
CREATE TABLE shipping_method
(
method_id INTEGER
primary key,
method_name TEXT,
cost REAL
)
/*
1 example row:
SELECT * FROM shipping_method LIMIT 1;
method_id ||method_name ||cost
1 || Standard || 5.9
*/
/* column definitions {
"method_id": "the unique identifier of the method",
"method_name": "the method name",
"cost": "the cost of the shipping method"
}*/
CREATE TABLE "cust_order"
(
order_id INTEGER
primary key autoincrement,
order_date DATETIME,
customer_id INTEGER
references customer,
shipping_method_id INTEGER
references shipping_method,
dest_address_id INTEGER
references address
)
/*
1 example row:
SELECT * FROM cust_order LIMIT 1;
order_id || order_date ||customer_id ||shipping_method_id ||dest_address_id
1 ||2021-07-14 10:47:19 || 387 || 4 || 1
*/
/* column definitions {
"order_id": "the unique identifier of the customer order",
"order_date": "the date of the order",
"customer_id": "the id of the customer\nMaps to customer(customer_Id)",
"shipping_method_id": "the id of the shipping method\nMaps to shipping_method(method_id)",
"dest_address_id": "the id of the destination address\nMaps to address(address_id)"
}*/
CREATE TABLE "order_history"
(
history_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
status_id INTEGER
references order_status,
status_date DATETIME
)
/*
1 example row:
SELECT * FROM order_history LIMIT 1;
history_id ||order_id ||status_id || status_date
1 || 1 || 1 ||2021-07-14 17:04:28
*/
/* column definitions {
"history_id": "the unique identifier of the order history",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"status_id": "the id of the order\nMaps to order_status(status_id)",
"status_date": "the date of the status updated "
}*/
CREATE TABLE "order_line"
(
line_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
book_id INTEGER
references book,
price REAL
)
/*
1 example row:
SELECT * FROM order_line LIMIT 1;
line_id ||order_id ||book_id ||price
1024 || 2051 || 10720 || 3.19
*/
/* column definitions {
"line_id": "the unique identifier of the order line",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"book_id": "the id of the book\nMaps to book(book_id)",
"price": "the price of the order"
}*/
### Question
Who is the author who wrote the most books?
Clarification: author refers to author_name; who wrote the most book refers to Max(Count(author_id))
| [query_database(**{'query': 'SELECT T1.author_name FROM author AS T1 INNER JOIN book_author AS T2 ON T1.author_id = T2.author_id GROUP BY T1.author_name ORDER BY COUNT(T2.author_id) DESC LIMIT 1'})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE address_status
(
status_id INTEGER
primary key,
address_status TEXT
)
/*
1 example row:
SELECT * FROM address_status LIMIT 1;
status_id ||address_status
1 || Active
*/
/* column definitions {
"status_id": "the unique identifier of the status",
"address_status": "the status of the address"
}*/
CREATE TABLE author
(
author_id INTEGER
primary key,
author_name TEXT
)
/*
1 example row:
SELECT * FROM author LIMIT 1;
author_id || author_name
1 ||A. Bartlett Giamatti
*/
/* column definitions {
"author_id": "the unique identifier of the author",
"author_name": "the name of the author"
}*/
CREATE TABLE book_language
(
language_id INTEGER
primary key,
language_code TEXT,
language_name TEXT
)
/*
1 example row:
SELECT * FROM book_language LIMIT 1;
language_id ||language_code ||language_name
1 || eng || English
*/
/* column definitions {
"language_id": "the unique identifier of the language ",
"language_code": "the language code",
"language_name": "the language name"
}*/
CREATE TABLE country
(
country_id INTEGER
primary key,
country_name TEXT
)
/*
1 example row:
SELECT * FROM country LIMIT 1;
country_id ||country_name
1 || Afghanistan
*/
/* column definitions {
"country_id": "the unique identifier of the country",
"country_name": "the country name"
}*/
CREATE TABLE address
(
address_id INTEGER
primary key,
street_number TEXT,
street_name TEXT,
city TEXT,
country_id INTEGER,
foreign key (country_id) references country(country_id)
)
/*
1 example row:
SELECT * FROM address LIMIT 1;
address_id ||street_number || street_name || city ||country_id
1 || 57 ||Glacier Hill Avenue ||Torbat-e Jām || 95
*/
/* column definitions {
"address_id": "the unique identifier of the address",
"street_number": "the street number of the address",
"street_name": "the street name",
"city": "the city where the address belongs",
"country_id": "the id of the country where the address belongs "
}*/
CREATE TABLE customer
(
customer_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
email TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
customer_id ||first_name ||last_name || email
1 || Ursola || Purdy ||upurdy0@cdbaby.com
*/
/* column definitions {
"customer_id": "the unique identifier of the customer",
"first_name": "the first name of the customer",
"last_name": "the last name of the customer",
"email": "the email of the customer"
}*/
CREATE TABLE customer_address
(
customer_id INTEGER,
address_id INTEGER,
status_id INTEGER,
primary key (customer_id, address_id),
foreign key (address_id) references address(address_id),
foreign key (customer_id) references customer(customer_id)
)
/*
1 example row:
SELECT * FROM customer_address LIMIT 1;
customer_id ||address_id ||status_id
1 || 606 || 1
*/
/* column definitions {
"customer_id": "the id of the customer\nMaps to customer(customer_id)",
"address_id": "the id of the address\nMaps to address(address_id)",
"status_id": "the id of the address status"
}*/
CREATE TABLE order_status
(
status_id INTEGER
primary key,
status_value TEXT
)
/*
1 example row:
SELECT * FROM order_status LIMIT 1;
status_id || status_value
1 ||Order Received
*/
/* column definitions {
"status_id": "the unique identifier of the order status",
"status_value": "the status value"
}*/
CREATE TABLE publisher
(
publisher_id INTEGER
primary key,
publisher_name TEXT
)
/*
1 example row:
SELECT * FROM publisher LIMIT 1;
publisher_id ||publisher_name
1 || 10/18
*/
/* column definitions {
"publisher_id": "the unique identifier of the publisher",
"publisher_name": "the name of the publisher"
}*/
CREATE TABLE book
(
book_id INTEGER
primary key,
title TEXT,
isbn13 TEXT,
language_id INTEGER,
num_pages INTEGER,
publication_date DATE,
publisher_id INTEGER,
foreign key (language_id) references book_language(language_id),
foreign key (publisher_id) references publisher(publisher_id)
)
/*
1 example row:
SELECT * FROM book LIMIT 1;
book_id || title || isbn13 ||language_id ||num_pages ||publication_date ||publisher_id
1 ||The World's First Love: Mary Mother of God ||8987059752 || 2 || 276 || 1996-09-01 || 1010
*/
/* column definitions {
"book_id": "the unique identifier of the book",
"title": "the title of the book ",
"isbn13": "the International Standard Book Number of the book",
"language_id": "the id of the book language\nMaps to book_language (language_id)",
"num_pages": "the number of the pages",
"publication_date": "the publication date of the book",
"publisher_id": "the id of the publisher\nMaps to publisher (publisher_id)"
}*/
CREATE TABLE book_author
(
book_id INTEGER,
author_id INTEGER,
primary key (book_id, author_id),
foreign key (author_id) references author(author_id),
foreign key (book_id) references book(book_id)
)
/*
1 example row:
SELECT * FROM book_author LIMIT 1;
book_id ||author_id
10539 || 1
*/
/* column definitions {
"book_id": "the id of the book\nMaps to book(book_id)",
"author_id": "the id of the author\nMaps to author(author_id)"
}*/
CREATE TABLE shipping_method
(
method_id INTEGER
primary key,
method_name TEXT,
cost REAL
)
/*
1 example row:
SELECT * FROM shipping_method LIMIT 1;
method_id ||method_name ||cost
1 || Standard || 5.9
*/
/* column definitions {
"method_id": "the unique identifier of the method",
"method_name": "the method name",
"cost": "the cost of the shipping method"
}*/
CREATE TABLE "cust_order"
(
order_id INTEGER
primary key autoincrement,
order_date DATETIME,
customer_id INTEGER
references customer,
shipping_method_id INTEGER
references shipping_method,
dest_address_id INTEGER
references address
)
/*
1 example row:
SELECT * FROM cust_order LIMIT 1;
order_id || order_date ||customer_id ||shipping_method_id ||dest_address_id
1 ||2021-07-14 10:47:19 || 387 || 4 || 1
*/
/* column definitions {
"order_id": "the unique identifier of the customer order",
"order_date": "the date of the order",
"customer_id": "the id of the customer\nMaps to customer(customer_Id)",
"shipping_method_id": "the id of the shipping method\nMaps to shipping_method(method_id)",
"dest_address_id": "the id of the destination address\nMaps to address(address_id)"
}*/
CREATE TABLE "order_history"
(
history_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
status_id INTEGER
references order_status,
status_date DATETIME
)
/*
1 example row:
SELECT * FROM order_history LIMIT 1;
history_id ||order_id ||status_id || status_date
1 || 1 || 1 ||2021-07-14 17:04:28
*/
/* column definitions {
"history_id": "the unique identifier of the order history",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"status_id": "the id of the order\nMaps to order_status(status_id)",
"status_date": "the date of the status updated "
}*/
CREATE TABLE "order_line"
(
line_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
book_id INTEGER
references book,
price REAL
)
/*
1 example row:
SELECT * FROM order_line LIMIT 1;
line_id ||order_id ||book_id ||price
1024 || 2051 || 10720 || 3.19
*/
/* column definitions {
"line_id": "the unique identifier of the order line",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"book_id": "the id of the book\nMaps to book(book_id)",
"price": "the price of the order"
}*/
|
6,002 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE address_status
(
status_id INTEGER
primary key,
address_status TEXT
)
/*
1 example row:
SELECT * FROM address_status LIMIT 1;
status_id ||address_status
1 || Active
*/
/* column definitions {
"status_id": "the unique identifier of the status",
"address_status": "the status of the address"
}*/
CREATE TABLE author
(
author_id INTEGER
primary key,
author_name TEXT
)
/*
1 example row:
SELECT * FROM author LIMIT 1;
author_id || author_name
1 ||A. Bartlett Giamatti
*/
/* column definitions {
"author_id": "the unique identifier of the author",
"author_name": "the name of the author"
}*/
CREATE TABLE book_language
(
language_id INTEGER
primary key,
language_code TEXT,
language_name TEXT
)
/*
1 example row:
SELECT * FROM book_language LIMIT 1;
language_id ||language_code ||language_name
1 || eng || English
*/
/* column definitions {
"language_id": "the unique identifier of the language ",
"language_code": "the language code",
"language_name": "the language name"
}*/
CREATE TABLE country
(
country_id INTEGER
primary key,
country_name TEXT
)
/*
1 example row:
SELECT * FROM country LIMIT 1;
country_id ||country_name
1 || Afghanistan
*/
/* column definitions {
"country_id": "the unique identifier of the country",
"country_name": "the country name"
}*/
CREATE TABLE address
(
address_id INTEGER
primary key,
street_number TEXT,
street_name TEXT,
city TEXT,
country_id INTEGER,
foreign key (country_id) references country(country_id)
)
/*
1 example row:
SELECT * FROM address LIMIT 1;
address_id ||street_number || street_name || city ||country_id
1 || 57 ||Glacier Hill Avenue ||Torbat-e Jām || 95
*/
/* column definitions {
"address_id": "the unique identifier of the address",
"street_number": "the street number of the address",
"street_name": "the street name",
"city": "the city where the address belongs",
"country_id": "the id of the country where the address belongs "
}*/
CREATE TABLE customer
(
customer_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
email TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
customer_id ||first_name ||last_name || email
1 || Ursola || Purdy ||upurdy0@cdbaby.com
*/
/* column definitions {
"customer_id": "the unique identifier of the customer",
"first_name": "the first name of the customer",
"last_name": "the last name of the customer",
"email": "the email of the customer"
}*/
CREATE TABLE customer_address
(
customer_id INTEGER,
address_id INTEGER,
status_id INTEGER,
primary key (customer_id, address_id),
foreign key (address_id) references address(address_id),
foreign key (customer_id) references customer(customer_id)
)
/*
1 example row:
SELECT * FROM customer_address LIMIT 1;
customer_id ||address_id ||status_id
1 || 606 || 1
*/
/* column definitions {
"customer_id": "the id of the customer\nMaps to customer(customer_id)",
"address_id": "the id of the address\nMaps to address(address_id)",
"status_id": "the id of the address status"
}*/
CREATE TABLE order_status
(
status_id INTEGER
primary key,
status_value TEXT
)
/*
1 example row:
SELECT * FROM order_status LIMIT 1;
status_id || status_value
1 ||Order Received
*/
/* column definitions {
"status_id": "the unique identifier of the order status",
"status_value": "the status value"
}*/
CREATE TABLE publisher
(
publisher_id INTEGER
primary key,
publisher_name TEXT
)
/*
1 example row:
SELECT * FROM publisher LIMIT 1;
publisher_id ||publisher_name
1 || 10/18
*/
/* column definitions {
"publisher_id": "the unique identifier of the publisher",
"publisher_name": "the name of the publisher"
}*/
CREATE TABLE book
(
book_id INTEGER
primary key,
title TEXT,
isbn13 TEXT,
language_id INTEGER,
num_pages INTEGER,
publication_date DATE,
publisher_id INTEGER,
foreign key (language_id) references book_language(language_id),
foreign key (publisher_id) references publisher(publisher_id)
)
/*
1 example row:
SELECT * FROM book LIMIT 1;
book_id || title || isbn13 ||language_id ||num_pages ||publication_date ||publisher_id
1 ||The World's First Love: Mary Mother of God ||8987059752 || 2 || 276 || 1996-09-01 || 1010
*/
/* column definitions {
"book_id": "the unique identifier of the book",
"title": "the title of the book ",
"isbn13": "the International Standard Book Number of the book",
"language_id": "the id of the book language\nMaps to book_language (language_id)",
"num_pages": "the number of the pages",
"publication_date": "the publication date of the book",
"publisher_id": "the id of the publisher\nMaps to publisher (publisher_id)"
}*/
CREATE TABLE book_author
(
book_id INTEGER,
author_id INTEGER,
primary key (book_id, author_id),
foreign key (author_id) references author(author_id),
foreign key (book_id) references book(book_id)
)
/*
1 example row:
SELECT * FROM book_author LIMIT 1;
book_id ||author_id
10539 || 1
*/
/* column definitions {
"book_id": "the id of the book\nMaps to book(book_id)",
"author_id": "the id of the author\nMaps to author(author_id)"
}*/
CREATE TABLE shipping_method
(
method_id INTEGER
primary key,
method_name TEXT,
cost REAL
)
/*
1 example row:
SELECT * FROM shipping_method LIMIT 1;
method_id ||method_name ||cost
1 || Standard || 5.9
*/
/* column definitions {
"method_id": "the unique identifier of the method",
"method_name": "the method name",
"cost": "the cost of the shipping method"
}*/
CREATE TABLE "cust_order"
(
order_id INTEGER
primary key autoincrement,
order_date DATETIME,
customer_id INTEGER
references customer,
shipping_method_id INTEGER
references shipping_method,
dest_address_id INTEGER
references address
)
/*
1 example row:
SELECT * FROM cust_order LIMIT 1;
order_id || order_date ||customer_id ||shipping_method_id ||dest_address_id
1 ||2021-07-14 10:47:19 || 387 || 4 || 1
*/
/* column definitions {
"order_id": "the unique identifier of the customer order",
"order_date": "the date of the order",
"customer_id": "the id of the customer\nMaps to customer(customer_Id)",
"shipping_method_id": "the id of the shipping method\nMaps to shipping_method(method_id)",
"dest_address_id": "the id of the destination address\nMaps to address(address_id)"
}*/
CREATE TABLE "order_history"
(
history_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
status_id INTEGER
references order_status,
status_date DATETIME
)
/*
1 example row:
SELECT * FROM order_history LIMIT 1;
history_id ||order_id ||status_id || status_date
1 || 1 || 1 ||2021-07-14 17:04:28
*/
/* column definitions {
"history_id": "the unique identifier of the order history",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"status_id": "the id of the order\nMaps to order_status(status_id)",
"status_date": "the date of the status updated "
}*/
CREATE TABLE "order_line"
(
line_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
book_id INTEGER
references book,
price REAL
)
/*
1 example row:
SELECT * FROM order_line LIMIT 1;
line_id ||order_id ||book_id ||price
1024 || 2051 || 10720 || 3.19
*/
/* column definitions {
"line_id": "the unique identifier of the order line",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"book_id": "the id of the book\nMaps to book(book_id)",
"price": "the price of the order"
}*/
### Question
How many of the customer addresses are inactive?
Clarification: addresses are inactive refers to address_status = 'Inactive'
| [query_database(**{'query': 'SELECT COUNT(*) FROM customer_address AS T1 INNER JOIN address_status AS T2 ON T1.status_id = T2.status_id WHERE T2.address_status = 'Inactive''})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE address_status
(
status_id INTEGER
primary key,
address_status TEXT
)
/*
1 example row:
SELECT * FROM address_status LIMIT 1;
status_id ||address_status
1 || Active
*/
/* column definitions {
"status_id": "the unique identifier of the status",
"address_status": "the status of the address"
}*/
CREATE TABLE author
(
author_id INTEGER
primary key,
author_name TEXT
)
/*
1 example row:
SELECT * FROM author LIMIT 1;
author_id || author_name
1 ||A. Bartlett Giamatti
*/
/* column definitions {
"author_id": "the unique identifier of the author",
"author_name": "the name of the author"
}*/
CREATE TABLE book_language
(
language_id INTEGER
primary key,
language_code TEXT,
language_name TEXT
)
/*
1 example row:
SELECT * FROM book_language LIMIT 1;
language_id ||language_code ||language_name
1 || eng || English
*/
/* column definitions {
"language_id": "the unique identifier of the language ",
"language_code": "the language code",
"language_name": "the language name"
}*/
CREATE TABLE country
(
country_id INTEGER
primary key,
country_name TEXT
)
/*
1 example row:
SELECT * FROM country LIMIT 1;
country_id ||country_name
1 || Afghanistan
*/
/* column definitions {
"country_id": "the unique identifier of the country",
"country_name": "the country name"
}*/
CREATE TABLE address
(
address_id INTEGER
primary key,
street_number TEXT,
street_name TEXT,
city TEXT,
country_id INTEGER,
foreign key (country_id) references country(country_id)
)
/*
1 example row:
SELECT * FROM address LIMIT 1;
address_id ||street_number || street_name || city ||country_id
1 || 57 ||Glacier Hill Avenue ||Torbat-e Jām || 95
*/
/* column definitions {
"address_id": "the unique identifier of the address",
"street_number": "the street number of the address",
"street_name": "the street name",
"city": "the city where the address belongs",
"country_id": "the id of the country where the address belongs "
}*/
CREATE TABLE customer
(
customer_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
email TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
customer_id ||first_name ||last_name || email
1 || Ursola || Purdy ||upurdy0@cdbaby.com
*/
/* column definitions {
"customer_id": "the unique identifier of the customer",
"first_name": "the first name of the customer",
"last_name": "the last name of the customer",
"email": "the email of the customer"
}*/
CREATE TABLE customer_address
(
customer_id INTEGER,
address_id INTEGER,
status_id INTEGER,
primary key (customer_id, address_id),
foreign key (address_id) references address(address_id),
foreign key (customer_id) references customer(customer_id)
)
/*
1 example row:
SELECT * FROM customer_address LIMIT 1;
customer_id ||address_id ||status_id
1 || 606 || 1
*/
/* column definitions {
"customer_id": "the id of the customer\nMaps to customer(customer_id)",
"address_id": "the id of the address\nMaps to address(address_id)",
"status_id": "the id of the address status"
}*/
CREATE TABLE order_status
(
status_id INTEGER
primary key,
status_value TEXT
)
/*
1 example row:
SELECT * FROM order_status LIMIT 1;
status_id || status_value
1 ||Order Received
*/
/* column definitions {
"status_id": "the unique identifier of the order status",
"status_value": "the status value"
}*/
CREATE TABLE publisher
(
publisher_id INTEGER
primary key,
publisher_name TEXT
)
/*
1 example row:
SELECT * FROM publisher LIMIT 1;
publisher_id ||publisher_name
1 || 10/18
*/
/* column definitions {
"publisher_id": "the unique identifier of the publisher",
"publisher_name": "the name of the publisher"
}*/
CREATE TABLE book
(
book_id INTEGER
primary key,
title TEXT,
isbn13 TEXT,
language_id INTEGER,
num_pages INTEGER,
publication_date DATE,
publisher_id INTEGER,
foreign key (language_id) references book_language(language_id),
foreign key (publisher_id) references publisher(publisher_id)
)
/*
1 example row:
SELECT * FROM book LIMIT 1;
book_id || title || isbn13 ||language_id ||num_pages ||publication_date ||publisher_id
1 ||The World's First Love: Mary Mother of God ||8987059752 || 2 || 276 || 1996-09-01 || 1010
*/
/* column definitions {
"book_id": "the unique identifier of the book",
"title": "the title of the book ",
"isbn13": "the International Standard Book Number of the book",
"language_id": "the id of the book language\nMaps to book_language (language_id)",
"num_pages": "the number of the pages",
"publication_date": "the publication date of the book",
"publisher_id": "the id of the publisher\nMaps to publisher (publisher_id)"
}*/
CREATE TABLE book_author
(
book_id INTEGER,
author_id INTEGER,
primary key (book_id, author_id),
foreign key (author_id) references author(author_id),
foreign key (book_id) references book(book_id)
)
/*
1 example row:
SELECT * FROM book_author LIMIT 1;
book_id ||author_id
10539 || 1
*/
/* column definitions {
"book_id": "the id of the book\nMaps to book(book_id)",
"author_id": "the id of the author\nMaps to author(author_id)"
}*/
CREATE TABLE shipping_method
(
method_id INTEGER
primary key,
method_name TEXT,
cost REAL
)
/*
1 example row:
SELECT * FROM shipping_method LIMIT 1;
method_id ||method_name ||cost
1 || Standard || 5.9
*/
/* column definitions {
"method_id": "the unique identifier of the method",
"method_name": "the method name",
"cost": "the cost of the shipping method"
}*/
CREATE TABLE "cust_order"
(
order_id INTEGER
primary key autoincrement,
order_date DATETIME,
customer_id INTEGER
references customer,
shipping_method_id INTEGER
references shipping_method,
dest_address_id INTEGER
references address
)
/*
1 example row:
SELECT * FROM cust_order LIMIT 1;
order_id || order_date ||customer_id ||shipping_method_id ||dest_address_id
1 ||2021-07-14 10:47:19 || 387 || 4 || 1
*/
/* column definitions {
"order_id": "the unique identifier of the customer order",
"order_date": "the date of the order",
"customer_id": "the id of the customer\nMaps to customer(customer_Id)",
"shipping_method_id": "the id of the shipping method\nMaps to shipping_method(method_id)",
"dest_address_id": "the id of the destination address\nMaps to address(address_id)"
}*/
CREATE TABLE "order_history"
(
history_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
status_id INTEGER
references order_status,
status_date DATETIME
)
/*
1 example row:
SELECT * FROM order_history LIMIT 1;
history_id ||order_id ||status_id || status_date
1 || 1 || 1 ||2021-07-14 17:04:28
*/
/* column definitions {
"history_id": "the unique identifier of the order history",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"status_id": "the id of the order\nMaps to order_status(status_id)",
"status_date": "the date of the status updated "
}*/
CREATE TABLE "order_line"
(
line_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
book_id INTEGER
references book,
price REAL
)
/*
1 example row:
SELECT * FROM order_line LIMIT 1;
line_id ||order_id ||book_id ||price
1024 || 2051 || 10720 || 3.19
*/
/* column definitions {
"line_id": "the unique identifier of the order line",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"book_id": "the id of the book\nMaps to book(book_id)",
"price": "the price of the order"
}*/
|
6,006 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE address_status
(
status_id INTEGER
primary key,
address_status TEXT
)
/*
1 example row:
SELECT * FROM address_status LIMIT 1;
status_id ||address_status
1 || Active
*/
/* column definitions {
"status_id": "the unique identifier of the status",
"address_status": "the status of the address"
}*/
CREATE TABLE author
(
author_id INTEGER
primary key,
author_name TEXT
)
/*
1 example row:
SELECT * FROM author LIMIT 1;
author_id || author_name
1 ||A. Bartlett Giamatti
*/
/* column definitions {
"author_id": "the unique identifier of the author",
"author_name": "the name of the author"
}*/
CREATE TABLE book_language
(
language_id INTEGER
primary key,
language_code TEXT,
language_name TEXT
)
/*
1 example row:
SELECT * FROM book_language LIMIT 1;
language_id ||language_code ||language_name
1 || eng || English
*/
/* column definitions {
"language_id": "the unique identifier of the language ",
"language_code": "the language code",
"language_name": "the language name"
}*/
CREATE TABLE country
(
country_id INTEGER
primary key,
country_name TEXT
)
/*
1 example row:
SELECT * FROM country LIMIT 1;
country_id ||country_name
1 || Afghanistan
*/
/* column definitions {
"country_id": "the unique identifier of the country",
"country_name": "the country name"
}*/
CREATE TABLE address
(
address_id INTEGER
primary key,
street_number TEXT,
street_name TEXT,
city TEXT,
country_id INTEGER,
foreign key (country_id) references country(country_id)
)
/*
1 example row:
SELECT * FROM address LIMIT 1;
address_id ||street_number || street_name || city ||country_id
1 || 57 ||Glacier Hill Avenue ||Torbat-e Jām || 95
*/
/* column definitions {
"address_id": "the unique identifier of the address",
"street_number": "the street number of the address",
"street_name": "the street name",
"city": "the city where the address belongs",
"country_id": "the id of the country where the address belongs "
}*/
CREATE TABLE customer
(
customer_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
email TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
customer_id ||first_name ||last_name || email
1 || Ursola || Purdy ||upurdy0@cdbaby.com
*/
/* column definitions {
"customer_id": "the unique identifier of the customer",
"first_name": "the first name of the customer",
"last_name": "the last name of the customer",
"email": "the email of the customer"
}*/
CREATE TABLE customer_address
(
customer_id INTEGER,
address_id INTEGER,
status_id INTEGER,
primary key (customer_id, address_id),
foreign key (address_id) references address(address_id),
foreign key (customer_id) references customer(customer_id)
)
/*
1 example row:
SELECT * FROM customer_address LIMIT 1;
customer_id ||address_id ||status_id
1 || 606 || 1
*/
/* column definitions {
"customer_id": "the id of the customer\nMaps to customer(customer_id)",
"address_id": "the id of the address\nMaps to address(address_id)",
"status_id": "the id of the address status"
}*/
CREATE TABLE order_status
(
status_id INTEGER
primary key,
status_value TEXT
)
/*
1 example row:
SELECT * FROM order_status LIMIT 1;
status_id || status_value
1 ||Order Received
*/
/* column definitions {
"status_id": "the unique identifier of the order status",
"status_value": "the status value"
}*/
CREATE TABLE publisher
(
publisher_id INTEGER
primary key,
publisher_name TEXT
)
/*
1 example row:
SELECT * FROM publisher LIMIT 1;
publisher_id ||publisher_name
1 || 10/18
*/
/* column definitions {
"publisher_id": "the unique identifier of the publisher",
"publisher_name": "the name of the publisher"
}*/
CREATE TABLE book
(
book_id INTEGER
primary key,
title TEXT,
isbn13 TEXT,
language_id INTEGER,
num_pages INTEGER,
publication_date DATE,
publisher_id INTEGER,
foreign key (language_id) references book_language(language_id),
foreign key (publisher_id) references publisher(publisher_id)
)
/*
1 example row:
SELECT * FROM book LIMIT 1;
book_id || title || isbn13 ||language_id ||num_pages ||publication_date ||publisher_id
1 ||The World's First Love: Mary Mother of God ||8987059752 || 2 || 276 || 1996-09-01 || 1010
*/
/* column definitions {
"book_id": "the unique identifier of the book",
"title": "the title of the book ",
"isbn13": "the International Standard Book Number of the book",
"language_id": "the id of the book language\nMaps to book_language (language_id)",
"num_pages": "the number of the pages",
"publication_date": "the publication date of the book",
"publisher_id": "the id of the publisher\nMaps to publisher (publisher_id)"
}*/
CREATE TABLE book_author
(
book_id INTEGER,
author_id INTEGER,
primary key (book_id, author_id),
foreign key (author_id) references author(author_id),
foreign key (book_id) references book(book_id)
)
/*
1 example row:
SELECT * FROM book_author LIMIT 1;
book_id ||author_id
10539 || 1
*/
/* column definitions {
"book_id": "the id of the book\nMaps to book(book_id)",
"author_id": "the id of the author\nMaps to author(author_id)"
}*/
CREATE TABLE shipping_method
(
method_id INTEGER
primary key,
method_name TEXT,
cost REAL
)
/*
1 example row:
SELECT * FROM shipping_method LIMIT 1;
method_id ||method_name ||cost
1 || Standard || 5.9
*/
/* column definitions {
"method_id": "the unique identifier of the method",
"method_name": "the method name",
"cost": "the cost of the shipping method"
}*/
CREATE TABLE "cust_order"
(
order_id INTEGER
primary key autoincrement,
order_date DATETIME,
customer_id INTEGER
references customer,
shipping_method_id INTEGER
references shipping_method,
dest_address_id INTEGER
references address
)
/*
1 example row:
SELECT * FROM cust_order LIMIT 1;
order_id || order_date ||customer_id ||shipping_method_id ||dest_address_id
1 ||2021-07-14 10:47:19 || 387 || 4 || 1
*/
/* column definitions {
"order_id": "the unique identifier of the customer order",
"order_date": "the date of the order",
"customer_id": "the id of the customer\nMaps to customer(customer_Id)",
"shipping_method_id": "the id of the shipping method\nMaps to shipping_method(method_id)",
"dest_address_id": "the id of the destination address\nMaps to address(address_id)"
}*/
CREATE TABLE "order_history"
(
history_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
status_id INTEGER
references order_status,
status_date DATETIME
)
/*
1 example row:
SELECT * FROM order_history LIMIT 1;
history_id ||order_id ||status_id || status_date
1 || 1 || 1 ||2021-07-14 17:04:28
*/
/* column definitions {
"history_id": "the unique identifier of the order history",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"status_id": "the id of the order\nMaps to order_status(status_id)",
"status_date": "the date of the status updated "
}*/
CREATE TABLE "order_line"
(
line_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
book_id INTEGER
references book,
price REAL
)
/*
1 example row:
SELECT * FROM order_line LIMIT 1;
line_id ||order_id ||book_id ||price
1024 || 2051 || 10720 || 3.19
*/
/* column definitions {
"line_id": "the unique identifier of the order line",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"book_id": "the id of the book\nMaps to book(book_id)",
"price": "the price of the order"
}*/
### Question
Which customer has the most addresses?
Clarification: customer refers to first_name, last_name; the most address refers to Max(count(address_id))
| [query_database(**{'query': 'SELECT T1.first_name, T1.last_name FROM customer AS T1 INNER JOIN customer_address AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.first_name, T1.last_name ORDER BY COUNT(T2.customer_id) DESC LIMIT 1'})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE address_status
(
status_id INTEGER
primary key,
address_status TEXT
)
/*
1 example row:
SELECT * FROM address_status LIMIT 1;
status_id ||address_status
1 || Active
*/
/* column definitions {
"status_id": "the unique identifier of the status",
"address_status": "the status of the address"
}*/
CREATE TABLE author
(
author_id INTEGER
primary key,
author_name TEXT
)
/*
1 example row:
SELECT * FROM author LIMIT 1;
author_id || author_name
1 ||A. Bartlett Giamatti
*/
/* column definitions {
"author_id": "the unique identifier of the author",
"author_name": "the name of the author"
}*/
CREATE TABLE book_language
(
language_id INTEGER
primary key,
language_code TEXT,
language_name TEXT
)
/*
1 example row:
SELECT * FROM book_language LIMIT 1;
language_id ||language_code ||language_name
1 || eng || English
*/
/* column definitions {
"language_id": "the unique identifier of the language ",
"language_code": "the language code",
"language_name": "the language name"
}*/
CREATE TABLE country
(
country_id INTEGER
primary key,
country_name TEXT
)
/*
1 example row:
SELECT * FROM country LIMIT 1;
country_id ||country_name
1 || Afghanistan
*/
/* column definitions {
"country_id": "the unique identifier of the country",
"country_name": "the country name"
}*/
CREATE TABLE address
(
address_id INTEGER
primary key,
street_number TEXT,
street_name TEXT,
city TEXT,
country_id INTEGER,
foreign key (country_id) references country(country_id)
)
/*
1 example row:
SELECT * FROM address LIMIT 1;
address_id ||street_number || street_name || city ||country_id
1 || 57 ||Glacier Hill Avenue ||Torbat-e Jām || 95
*/
/* column definitions {
"address_id": "the unique identifier of the address",
"street_number": "the street number of the address",
"street_name": "the street name",
"city": "the city where the address belongs",
"country_id": "the id of the country where the address belongs "
}*/
CREATE TABLE customer
(
customer_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
email TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
customer_id ||first_name ||last_name || email
1 || Ursola || Purdy ||upurdy0@cdbaby.com
*/
/* column definitions {
"customer_id": "the unique identifier of the customer",
"first_name": "the first name of the customer",
"last_name": "the last name of the customer",
"email": "the email of the customer"
}*/
CREATE TABLE customer_address
(
customer_id INTEGER,
address_id INTEGER,
status_id INTEGER,
primary key (customer_id, address_id),
foreign key (address_id) references address(address_id),
foreign key (customer_id) references customer(customer_id)
)
/*
1 example row:
SELECT * FROM customer_address LIMIT 1;
customer_id ||address_id ||status_id
1 || 606 || 1
*/
/* column definitions {
"customer_id": "the id of the customer\nMaps to customer(customer_id)",
"address_id": "the id of the address\nMaps to address(address_id)",
"status_id": "the id of the address status"
}*/
CREATE TABLE order_status
(
status_id INTEGER
primary key,
status_value TEXT
)
/*
1 example row:
SELECT * FROM order_status LIMIT 1;
status_id || status_value
1 ||Order Received
*/
/* column definitions {
"status_id": "the unique identifier of the order status",
"status_value": "the status value"
}*/
CREATE TABLE publisher
(
publisher_id INTEGER
primary key,
publisher_name TEXT
)
/*
1 example row:
SELECT * FROM publisher LIMIT 1;
publisher_id ||publisher_name
1 || 10/18
*/
/* column definitions {
"publisher_id": "the unique identifier of the publisher",
"publisher_name": "the name of the publisher"
}*/
CREATE TABLE book
(
book_id INTEGER
primary key,
title TEXT,
isbn13 TEXT,
language_id INTEGER,
num_pages INTEGER,
publication_date DATE,
publisher_id INTEGER,
foreign key (language_id) references book_language(language_id),
foreign key (publisher_id) references publisher(publisher_id)
)
/*
1 example row:
SELECT * FROM book LIMIT 1;
book_id || title || isbn13 ||language_id ||num_pages ||publication_date ||publisher_id
1 ||The World's First Love: Mary Mother of God ||8987059752 || 2 || 276 || 1996-09-01 || 1010
*/
/* column definitions {
"book_id": "the unique identifier of the book",
"title": "the title of the book ",
"isbn13": "the International Standard Book Number of the book",
"language_id": "the id of the book language\nMaps to book_language (language_id)",
"num_pages": "the number of the pages",
"publication_date": "the publication date of the book",
"publisher_id": "the id of the publisher\nMaps to publisher (publisher_id)"
}*/
CREATE TABLE book_author
(
book_id INTEGER,
author_id INTEGER,
primary key (book_id, author_id),
foreign key (author_id) references author(author_id),
foreign key (book_id) references book(book_id)
)
/*
1 example row:
SELECT * FROM book_author LIMIT 1;
book_id ||author_id
10539 || 1
*/
/* column definitions {
"book_id": "the id of the book\nMaps to book(book_id)",
"author_id": "the id of the author\nMaps to author(author_id)"
}*/
CREATE TABLE shipping_method
(
method_id INTEGER
primary key,
method_name TEXT,
cost REAL
)
/*
1 example row:
SELECT * FROM shipping_method LIMIT 1;
method_id ||method_name ||cost
1 || Standard || 5.9
*/
/* column definitions {
"method_id": "the unique identifier of the method",
"method_name": "the method name",
"cost": "the cost of the shipping method"
}*/
CREATE TABLE "cust_order"
(
order_id INTEGER
primary key autoincrement,
order_date DATETIME,
customer_id INTEGER
references customer,
shipping_method_id INTEGER
references shipping_method,
dest_address_id INTEGER
references address
)
/*
1 example row:
SELECT * FROM cust_order LIMIT 1;
order_id || order_date ||customer_id ||shipping_method_id ||dest_address_id
1 ||2021-07-14 10:47:19 || 387 || 4 || 1
*/
/* column definitions {
"order_id": "the unique identifier of the customer order",
"order_date": "the date of the order",
"customer_id": "the id of the customer\nMaps to customer(customer_Id)",
"shipping_method_id": "the id of the shipping method\nMaps to shipping_method(method_id)",
"dest_address_id": "the id of the destination address\nMaps to address(address_id)"
}*/
CREATE TABLE "order_history"
(
history_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
status_id INTEGER
references order_status,
status_date DATETIME
)
/*
1 example row:
SELECT * FROM order_history LIMIT 1;
history_id ||order_id ||status_id || status_date
1 || 1 || 1 ||2021-07-14 17:04:28
*/
/* column definitions {
"history_id": "the unique identifier of the order history",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"status_id": "the id of the order\nMaps to order_status(status_id)",
"status_date": "the date of the status updated "
}*/
CREATE TABLE "order_line"
(
line_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
book_id INTEGER
references book,
price REAL
)
/*
1 example row:
SELECT * FROM order_line LIMIT 1;
line_id ||order_id ||book_id ||price
1024 || 2051 || 10720 || 3.19
*/
/* column definitions {
"line_id": "the unique identifier of the order line",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"book_id": "the id of the book\nMaps to book(book_id)",
"price": "the price of the order"
}*/
|
6,010 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE address_status
(
status_id INTEGER
primary key,
address_status TEXT
)
/*
1 example row:
SELECT * FROM address_status LIMIT 1;
status_id ||address_status
1 || Active
*/
/* column definitions {
"status_id": "the unique identifier of the status",
"address_status": "the status of the address"
}*/
CREATE TABLE author
(
author_id INTEGER
primary key,
author_name TEXT
)
/*
1 example row:
SELECT * FROM author LIMIT 1;
author_id || author_name
1 ||A. Bartlett Giamatti
*/
/* column definitions {
"author_id": "the unique identifier of the author",
"author_name": "the name of the author"
}*/
CREATE TABLE book_language
(
language_id INTEGER
primary key,
language_code TEXT,
language_name TEXT
)
/*
1 example row:
SELECT * FROM book_language LIMIT 1;
language_id ||language_code ||language_name
1 || eng || English
*/
/* column definitions {
"language_id": "the unique identifier of the language ",
"language_code": "the language code",
"language_name": "the language name"
}*/
CREATE TABLE country
(
country_id INTEGER
primary key,
country_name TEXT
)
/*
1 example row:
SELECT * FROM country LIMIT 1;
country_id ||country_name
1 || Afghanistan
*/
/* column definitions {
"country_id": "the unique identifier of the country",
"country_name": "the country name"
}*/
CREATE TABLE address
(
address_id INTEGER
primary key,
street_number TEXT,
street_name TEXT,
city TEXT,
country_id INTEGER,
foreign key (country_id) references country(country_id)
)
/*
1 example row:
SELECT * FROM address LIMIT 1;
address_id ||street_number || street_name || city ||country_id
1 || 57 ||Glacier Hill Avenue ||Torbat-e Jām || 95
*/
/* column definitions {
"address_id": "the unique identifier of the address",
"street_number": "the street number of the address",
"street_name": "the street name",
"city": "the city where the address belongs",
"country_id": "the id of the country where the address belongs "
}*/
CREATE TABLE customer
(
customer_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
email TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
customer_id ||first_name ||last_name || email
1 || Ursola || Purdy ||upurdy0@cdbaby.com
*/
/* column definitions {
"customer_id": "the unique identifier of the customer",
"first_name": "the first name of the customer",
"last_name": "the last name of the customer",
"email": "the email of the customer"
}*/
CREATE TABLE customer_address
(
customer_id INTEGER,
address_id INTEGER,
status_id INTEGER,
primary key (customer_id, address_id),
foreign key (address_id) references address(address_id),
foreign key (customer_id) references customer(customer_id)
)
/*
1 example row:
SELECT * FROM customer_address LIMIT 1;
customer_id ||address_id ||status_id
1 || 606 || 1
*/
/* column definitions {
"customer_id": "the id of the customer\nMaps to customer(customer_id)",
"address_id": "the id of the address\nMaps to address(address_id)",
"status_id": "the id of the address status"
}*/
CREATE TABLE order_status
(
status_id INTEGER
primary key,
status_value TEXT
)
/*
1 example row:
SELECT * FROM order_status LIMIT 1;
status_id || status_value
1 ||Order Received
*/
/* column definitions {
"status_id": "the unique identifier of the order status",
"status_value": "the status value"
}*/
CREATE TABLE publisher
(
publisher_id INTEGER
primary key,
publisher_name TEXT
)
/*
1 example row:
SELECT * FROM publisher LIMIT 1;
publisher_id ||publisher_name
1 || 10/18
*/
/* column definitions {
"publisher_id": "the unique identifier of the publisher",
"publisher_name": "the name of the publisher"
}*/
CREATE TABLE book
(
book_id INTEGER
primary key,
title TEXT,
isbn13 TEXT,
language_id INTEGER,
num_pages INTEGER,
publication_date DATE,
publisher_id INTEGER,
foreign key (language_id) references book_language(language_id),
foreign key (publisher_id) references publisher(publisher_id)
)
/*
1 example row:
SELECT * FROM book LIMIT 1;
book_id || title || isbn13 ||language_id ||num_pages ||publication_date ||publisher_id
1 ||The World's First Love: Mary Mother of God ||8987059752 || 2 || 276 || 1996-09-01 || 1010
*/
/* column definitions {
"book_id": "the unique identifier of the book",
"title": "the title of the book ",
"isbn13": "the International Standard Book Number of the book",
"language_id": "the id of the book language\nMaps to book_language (language_id)",
"num_pages": "the number of the pages",
"publication_date": "the publication date of the book",
"publisher_id": "the id of the publisher\nMaps to publisher (publisher_id)"
}*/
CREATE TABLE book_author
(
book_id INTEGER,
author_id INTEGER,
primary key (book_id, author_id),
foreign key (author_id) references author(author_id),
foreign key (book_id) references book(book_id)
)
/*
1 example row:
SELECT * FROM book_author LIMIT 1;
book_id ||author_id
10539 || 1
*/
/* column definitions {
"book_id": "the id of the book\nMaps to book(book_id)",
"author_id": "the id of the author\nMaps to author(author_id)"
}*/
CREATE TABLE shipping_method
(
method_id INTEGER
primary key,
method_name TEXT,
cost REAL
)
/*
1 example row:
SELECT * FROM shipping_method LIMIT 1;
method_id ||method_name ||cost
1 || Standard || 5.9
*/
/* column definitions {
"method_id": "the unique identifier of the method",
"method_name": "the method name",
"cost": "the cost of the shipping method"
}*/
CREATE TABLE "cust_order"
(
order_id INTEGER
primary key autoincrement,
order_date DATETIME,
customer_id INTEGER
references customer,
shipping_method_id INTEGER
references shipping_method,
dest_address_id INTEGER
references address
)
/*
1 example row:
SELECT * FROM cust_order LIMIT 1;
order_id || order_date ||customer_id ||shipping_method_id ||dest_address_id
1 ||2021-07-14 10:47:19 || 387 || 4 || 1
*/
/* column definitions {
"order_id": "the unique identifier of the customer order",
"order_date": "the date of the order",
"customer_id": "the id of the customer\nMaps to customer(customer_Id)",
"shipping_method_id": "the id of the shipping method\nMaps to shipping_method(method_id)",
"dest_address_id": "the id of the destination address\nMaps to address(address_id)"
}*/
CREATE TABLE "order_history"
(
history_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
status_id INTEGER
references order_status,
status_date DATETIME
)
/*
1 example row:
SELECT * FROM order_history LIMIT 1;
history_id ||order_id ||status_id || status_date
1 || 1 || 1 ||2021-07-14 17:04:28
*/
/* column definitions {
"history_id": "the unique identifier of the order history",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"status_id": "the id of the order\nMaps to order_status(status_id)",
"status_date": "the date of the status updated "
}*/
CREATE TABLE "order_line"
(
line_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
book_id INTEGER
references book,
price REAL
)
/*
1 example row:
SELECT * FROM order_line LIMIT 1;
line_id ||order_id ||book_id ||price
1024 || 2051 || 10720 || 3.19
*/
/* column definitions {
"line_id": "the unique identifier of the order line",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"book_id": "the id of the book\nMaps to book(book_id)",
"price": "the price of the order"
}*/
### Question
How many customers have an address that is located in the city of Villeneuve-la-Garenne?
Clarification: "Villeneuve-la-Garenne" is the city
| [query_database(**{'query': 'SELECT COUNT(address_id) FROM address WHERE city = 'Villeneuve-la-Garenne''})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE address_status
(
status_id INTEGER
primary key,
address_status TEXT
)
/*
1 example row:
SELECT * FROM address_status LIMIT 1;
status_id ||address_status
1 || Active
*/
/* column definitions {
"status_id": "the unique identifier of the status",
"address_status": "the status of the address"
}*/
CREATE TABLE author
(
author_id INTEGER
primary key,
author_name TEXT
)
/*
1 example row:
SELECT * FROM author LIMIT 1;
author_id || author_name
1 ||A. Bartlett Giamatti
*/
/* column definitions {
"author_id": "the unique identifier of the author",
"author_name": "the name of the author"
}*/
CREATE TABLE book_language
(
language_id INTEGER
primary key,
language_code TEXT,
language_name TEXT
)
/*
1 example row:
SELECT * FROM book_language LIMIT 1;
language_id ||language_code ||language_name
1 || eng || English
*/
/* column definitions {
"language_id": "the unique identifier of the language ",
"language_code": "the language code",
"language_name": "the language name"
}*/
CREATE TABLE country
(
country_id INTEGER
primary key,
country_name TEXT
)
/*
1 example row:
SELECT * FROM country LIMIT 1;
country_id ||country_name
1 || Afghanistan
*/
/* column definitions {
"country_id": "the unique identifier of the country",
"country_name": "the country name"
}*/
CREATE TABLE address
(
address_id INTEGER
primary key,
street_number TEXT,
street_name TEXT,
city TEXT,
country_id INTEGER,
foreign key (country_id) references country(country_id)
)
/*
1 example row:
SELECT * FROM address LIMIT 1;
address_id ||street_number || street_name || city ||country_id
1 || 57 ||Glacier Hill Avenue ||Torbat-e Jām || 95
*/
/* column definitions {
"address_id": "the unique identifier of the address",
"street_number": "the street number of the address",
"street_name": "the street name",
"city": "the city where the address belongs",
"country_id": "the id of the country where the address belongs "
}*/
CREATE TABLE customer
(
customer_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
email TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
customer_id ||first_name ||last_name || email
1 || Ursola || Purdy ||upurdy0@cdbaby.com
*/
/* column definitions {
"customer_id": "the unique identifier of the customer",
"first_name": "the first name of the customer",
"last_name": "the last name of the customer",
"email": "the email of the customer"
}*/
CREATE TABLE customer_address
(
customer_id INTEGER,
address_id INTEGER,
status_id INTEGER,
primary key (customer_id, address_id),
foreign key (address_id) references address(address_id),
foreign key (customer_id) references customer(customer_id)
)
/*
1 example row:
SELECT * FROM customer_address LIMIT 1;
customer_id ||address_id ||status_id
1 || 606 || 1
*/
/* column definitions {
"customer_id": "the id of the customer\nMaps to customer(customer_id)",
"address_id": "the id of the address\nMaps to address(address_id)",
"status_id": "the id of the address status"
}*/
CREATE TABLE order_status
(
status_id INTEGER
primary key,
status_value TEXT
)
/*
1 example row:
SELECT * FROM order_status LIMIT 1;
status_id || status_value
1 ||Order Received
*/
/* column definitions {
"status_id": "the unique identifier of the order status",
"status_value": "the status value"
}*/
CREATE TABLE publisher
(
publisher_id INTEGER
primary key,
publisher_name TEXT
)
/*
1 example row:
SELECT * FROM publisher LIMIT 1;
publisher_id ||publisher_name
1 || 10/18
*/
/* column definitions {
"publisher_id": "the unique identifier of the publisher",
"publisher_name": "the name of the publisher"
}*/
CREATE TABLE book
(
book_id INTEGER
primary key,
title TEXT,
isbn13 TEXT,
language_id INTEGER,
num_pages INTEGER,
publication_date DATE,
publisher_id INTEGER,
foreign key (language_id) references book_language(language_id),
foreign key (publisher_id) references publisher(publisher_id)
)
/*
1 example row:
SELECT * FROM book LIMIT 1;
book_id || title || isbn13 ||language_id ||num_pages ||publication_date ||publisher_id
1 ||The World's First Love: Mary Mother of God ||8987059752 || 2 || 276 || 1996-09-01 || 1010
*/
/* column definitions {
"book_id": "the unique identifier of the book",
"title": "the title of the book ",
"isbn13": "the International Standard Book Number of the book",
"language_id": "the id of the book language\nMaps to book_language (language_id)",
"num_pages": "the number of the pages",
"publication_date": "the publication date of the book",
"publisher_id": "the id of the publisher\nMaps to publisher (publisher_id)"
}*/
CREATE TABLE book_author
(
book_id INTEGER,
author_id INTEGER,
primary key (book_id, author_id),
foreign key (author_id) references author(author_id),
foreign key (book_id) references book(book_id)
)
/*
1 example row:
SELECT * FROM book_author LIMIT 1;
book_id ||author_id
10539 || 1
*/
/* column definitions {
"book_id": "the id of the book\nMaps to book(book_id)",
"author_id": "the id of the author\nMaps to author(author_id)"
}*/
CREATE TABLE shipping_method
(
method_id INTEGER
primary key,
method_name TEXT,
cost REAL
)
/*
1 example row:
SELECT * FROM shipping_method LIMIT 1;
method_id ||method_name ||cost
1 || Standard || 5.9
*/
/* column definitions {
"method_id": "the unique identifier of the method",
"method_name": "the method name",
"cost": "the cost of the shipping method"
}*/
CREATE TABLE "cust_order"
(
order_id INTEGER
primary key autoincrement,
order_date DATETIME,
customer_id INTEGER
references customer,
shipping_method_id INTEGER
references shipping_method,
dest_address_id INTEGER
references address
)
/*
1 example row:
SELECT * FROM cust_order LIMIT 1;
order_id || order_date ||customer_id ||shipping_method_id ||dest_address_id
1 ||2021-07-14 10:47:19 || 387 || 4 || 1
*/
/* column definitions {
"order_id": "the unique identifier of the customer order",
"order_date": "the date of the order",
"customer_id": "the id of the customer\nMaps to customer(customer_Id)",
"shipping_method_id": "the id of the shipping method\nMaps to shipping_method(method_id)",
"dest_address_id": "the id of the destination address\nMaps to address(address_id)"
}*/
CREATE TABLE "order_history"
(
history_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
status_id INTEGER
references order_status,
status_date DATETIME
)
/*
1 example row:
SELECT * FROM order_history LIMIT 1;
history_id ||order_id ||status_id || status_date
1 || 1 || 1 ||2021-07-14 17:04:28
*/
/* column definitions {
"history_id": "the unique identifier of the order history",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"status_id": "the id of the order\nMaps to order_status(status_id)",
"status_date": "the date of the status updated "
}*/
CREATE TABLE "order_line"
(
line_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
book_id INTEGER
references book,
price REAL
)
/*
1 example row:
SELECT * FROM order_line LIMIT 1;
line_id ||order_id ||book_id ||price
1024 || 2051 || 10720 || 3.19
*/
/* column definitions {
"line_id": "the unique identifier of the order line",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"book_id": "the id of the book\nMaps to book(book_id)",
"price": "the price of the order"
}*/
|
6,014 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE address_status
(
status_id INTEGER
primary key,
address_status TEXT
)
/*
1 example row:
SELECT * FROM address_status LIMIT 1;
status_id ||address_status
1 || Active
*/
/* column definitions {
"status_id": "the unique identifier of the status",
"address_status": "the status of the address"
}*/
CREATE TABLE author
(
author_id INTEGER
primary key,
author_name TEXT
)
/*
1 example row:
SELECT * FROM author LIMIT 1;
author_id || author_name
1 ||A. Bartlett Giamatti
*/
/* column definitions {
"author_id": "the unique identifier of the author",
"author_name": "the name of the author"
}*/
CREATE TABLE book_language
(
language_id INTEGER
primary key,
language_code TEXT,
language_name TEXT
)
/*
1 example row:
SELECT * FROM book_language LIMIT 1;
language_id ||language_code ||language_name
1 || eng || English
*/
/* column definitions {
"language_id": "the unique identifier of the language ",
"language_code": "the language code",
"language_name": "the language name"
}*/
CREATE TABLE country
(
country_id INTEGER
primary key,
country_name TEXT
)
/*
1 example row:
SELECT * FROM country LIMIT 1;
country_id ||country_name
1 || Afghanistan
*/
/* column definitions {
"country_id": "the unique identifier of the country",
"country_name": "the country name"
}*/
CREATE TABLE address
(
address_id INTEGER
primary key,
street_number TEXT,
street_name TEXT,
city TEXT,
country_id INTEGER,
foreign key (country_id) references country(country_id)
)
/*
1 example row:
SELECT * FROM address LIMIT 1;
address_id ||street_number || street_name || city ||country_id
1 || 57 ||Glacier Hill Avenue ||Torbat-e Jām || 95
*/
/* column definitions {
"address_id": "the unique identifier of the address",
"street_number": "the street number of the address",
"street_name": "the street name",
"city": "the city where the address belongs",
"country_id": "the id of the country where the address belongs "
}*/
CREATE TABLE customer
(
customer_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
email TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
customer_id ||first_name ||last_name || email
1 || Ursola || Purdy ||upurdy0@cdbaby.com
*/
/* column definitions {
"customer_id": "the unique identifier of the customer",
"first_name": "the first name of the customer",
"last_name": "the last name of the customer",
"email": "the email of the customer"
}*/
CREATE TABLE customer_address
(
customer_id INTEGER,
address_id INTEGER,
status_id INTEGER,
primary key (customer_id, address_id),
foreign key (address_id) references address(address_id),
foreign key (customer_id) references customer(customer_id)
)
/*
1 example row:
SELECT * FROM customer_address LIMIT 1;
customer_id ||address_id ||status_id
1 || 606 || 1
*/
/* column definitions {
"customer_id": "the id of the customer\nMaps to customer(customer_id)",
"address_id": "the id of the address\nMaps to address(address_id)",
"status_id": "the id of the address status"
}*/
CREATE TABLE order_status
(
status_id INTEGER
primary key,
status_value TEXT
)
/*
1 example row:
SELECT * FROM order_status LIMIT 1;
status_id || status_value
1 ||Order Received
*/
/* column definitions {
"status_id": "the unique identifier of the order status",
"status_value": "the status value"
}*/
CREATE TABLE publisher
(
publisher_id INTEGER
primary key,
publisher_name TEXT
)
/*
1 example row:
SELECT * FROM publisher LIMIT 1;
publisher_id ||publisher_name
1 || 10/18
*/
/* column definitions {
"publisher_id": "the unique identifier of the publisher",
"publisher_name": "the name of the publisher"
}*/
CREATE TABLE book
(
book_id INTEGER
primary key,
title TEXT,
isbn13 TEXT,
language_id INTEGER,
num_pages INTEGER,
publication_date DATE,
publisher_id INTEGER,
foreign key (language_id) references book_language(language_id),
foreign key (publisher_id) references publisher(publisher_id)
)
/*
1 example row:
SELECT * FROM book LIMIT 1;
book_id || title || isbn13 ||language_id ||num_pages ||publication_date ||publisher_id
1 ||The World's First Love: Mary Mother of God ||8987059752 || 2 || 276 || 1996-09-01 || 1010
*/
/* column definitions {
"book_id": "the unique identifier of the book",
"title": "the title of the book ",
"isbn13": "the International Standard Book Number of the book",
"language_id": "the id of the book language\nMaps to book_language (language_id)",
"num_pages": "the number of the pages",
"publication_date": "the publication date of the book",
"publisher_id": "the id of the publisher\nMaps to publisher (publisher_id)"
}*/
CREATE TABLE book_author
(
book_id INTEGER,
author_id INTEGER,
primary key (book_id, author_id),
foreign key (author_id) references author(author_id),
foreign key (book_id) references book(book_id)
)
/*
1 example row:
SELECT * FROM book_author LIMIT 1;
book_id ||author_id
10539 || 1
*/
/* column definitions {
"book_id": "the id of the book\nMaps to book(book_id)",
"author_id": "the id of the author\nMaps to author(author_id)"
}*/
CREATE TABLE shipping_method
(
method_id INTEGER
primary key,
method_name TEXT,
cost REAL
)
/*
1 example row:
SELECT * FROM shipping_method LIMIT 1;
method_id ||method_name ||cost
1 || Standard || 5.9
*/
/* column definitions {
"method_id": "the unique identifier of the method",
"method_name": "the method name",
"cost": "the cost of the shipping method"
}*/
CREATE TABLE "cust_order"
(
order_id INTEGER
primary key autoincrement,
order_date DATETIME,
customer_id INTEGER
references customer,
shipping_method_id INTEGER
references shipping_method,
dest_address_id INTEGER
references address
)
/*
1 example row:
SELECT * FROM cust_order LIMIT 1;
order_id || order_date ||customer_id ||shipping_method_id ||dest_address_id
1 ||2021-07-14 10:47:19 || 387 || 4 || 1
*/
/* column definitions {
"order_id": "the unique identifier of the customer order",
"order_date": "the date of the order",
"customer_id": "the id of the customer\nMaps to customer(customer_Id)",
"shipping_method_id": "the id of the shipping method\nMaps to shipping_method(method_id)",
"dest_address_id": "the id of the destination address\nMaps to address(address_id)"
}*/
CREATE TABLE "order_history"
(
history_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
status_id INTEGER
references order_status,
status_date DATETIME
)
/*
1 example row:
SELECT * FROM order_history LIMIT 1;
history_id ||order_id ||status_id || status_date
1 || 1 || 1 ||2021-07-14 17:04:28
*/
/* column definitions {
"history_id": "the unique identifier of the order history",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"status_id": "the id of the order\nMaps to order_status(status_id)",
"status_date": "the date of the status updated "
}*/
CREATE TABLE "order_line"
(
line_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
book_id INTEGER
references book,
price REAL
)
/*
1 example row:
SELECT * FROM order_line LIMIT 1;
line_id ||order_id ||book_id ||price
1024 || 2051 || 10720 || 3.19
*/
/* column definitions {
"line_id": "the unique identifier of the order line",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"book_id": "the id of the book\nMaps to book(book_id)",
"price": "the price of the order"
}*/
### Question
How many orders did Marcelia Goering place in 2021 that uses the Priority Shipping method?
Clarification: in 2021 refers to substr(order_date, 1, 4) = '2021'; priority shipping method refers to method_name = 'Priority'
| [query_database(**{'query': 'SELECT COUNT(*) FROM customer AS T1 INNER JOIN cust_order AS T2 ON T1.customer_id = T2.customer_id INNER JOIN shipping_method AS T3 ON T3.method_id = T2.shipping_method_id WHERE T1.first_name = 'Marcelia' AND T1.last_name = 'Goering' AND STRFTIME('%Y', T2.order_date) = '2021' AND T3.method_name = 'Priority''})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE address_status
(
status_id INTEGER
primary key,
address_status TEXT
)
/*
1 example row:
SELECT * FROM address_status LIMIT 1;
status_id ||address_status
1 || Active
*/
/* column definitions {
"status_id": "the unique identifier of the status",
"address_status": "the status of the address"
}*/
CREATE TABLE author
(
author_id INTEGER
primary key,
author_name TEXT
)
/*
1 example row:
SELECT * FROM author LIMIT 1;
author_id || author_name
1 ||A. Bartlett Giamatti
*/
/* column definitions {
"author_id": "the unique identifier of the author",
"author_name": "the name of the author"
}*/
CREATE TABLE book_language
(
language_id INTEGER
primary key,
language_code TEXT,
language_name TEXT
)
/*
1 example row:
SELECT * FROM book_language LIMIT 1;
language_id ||language_code ||language_name
1 || eng || English
*/
/* column definitions {
"language_id": "the unique identifier of the language ",
"language_code": "the language code",
"language_name": "the language name"
}*/
CREATE TABLE country
(
country_id INTEGER
primary key,
country_name TEXT
)
/*
1 example row:
SELECT * FROM country LIMIT 1;
country_id ||country_name
1 || Afghanistan
*/
/* column definitions {
"country_id": "the unique identifier of the country",
"country_name": "the country name"
}*/
CREATE TABLE address
(
address_id INTEGER
primary key,
street_number TEXT,
street_name TEXT,
city TEXT,
country_id INTEGER,
foreign key (country_id) references country(country_id)
)
/*
1 example row:
SELECT * FROM address LIMIT 1;
address_id ||street_number || street_name || city ||country_id
1 || 57 ||Glacier Hill Avenue ||Torbat-e Jām || 95
*/
/* column definitions {
"address_id": "the unique identifier of the address",
"street_number": "the street number of the address",
"street_name": "the street name",
"city": "the city where the address belongs",
"country_id": "the id of the country where the address belongs "
}*/
CREATE TABLE customer
(
customer_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
email TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
customer_id ||first_name ||last_name || email
1 || Ursola || Purdy ||upurdy0@cdbaby.com
*/
/* column definitions {
"customer_id": "the unique identifier of the customer",
"first_name": "the first name of the customer",
"last_name": "the last name of the customer",
"email": "the email of the customer"
}*/
CREATE TABLE customer_address
(
customer_id INTEGER,
address_id INTEGER,
status_id INTEGER,
primary key (customer_id, address_id),
foreign key (address_id) references address(address_id),
foreign key (customer_id) references customer(customer_id)
)
/*
1 example row:
SELECT * FROM customer_address LIMIT 1;
customer_id ||address_id ||status_id
1 || 606 || 1
*/
/* column definitions {
"customer_id": "the id of the customer\nMaps to customer(customer_id)",
"address_id": "the id of the address\nMaps to address(address_id)",
"status_id": "the id of the address status"
}*/
CREATE TABLE order_status
(
status_id INTEGER
primary key,
status_value TEXT
)
/*
1 example row:
SELECT * FROM order_status LIMIT 1;
status_id || status_value
1 ||Order Received
*/
/* column definitions {
"status_id": "the unique identifier of the order status",
"status_value": "the status value"
}*/
CREATE TABLE publisher
(
publisher_id INTEGER
primary key,
publisher_name TEXT
)
/*
1 example row:
SELECT * FROM publisher LIMIT 1;
publisher_id ||publisher_name
1 || 10/18
*/
/* column definitions {
"publisher_id": "the unique identifier of the publisher",
"publisher_name": "the name of the publisher"
}*/
CREATE TABLE book
(
book_id INTEGER
primary key,
title TEXT,
isbn13 TEXT,
language_id INTEGER,
num_pages INTEGER,
publication_date DATE,
publisher_id INTEGER,
foreign key (language_id) references book_language(language_id),
foreign key (publisher_id) references publisher(publisher_id)
)
/*
1 example row:
SELECT * FROM book LIMIT 1;
book_id || title || isbn13 ||language_id ||num_pages ||publication_date ||publisher_id
1 ||The World's First Love: Mary Mother of God ||8987059752 || 2 || 276 || 1996-09-01 || 1010
*/
/* column definitions {
"book_id": "the unique identifier of the book",
"title": "the title of the book ",
"isbn13": "the International Standard Book Number of the book",
"language_id": "the id of the book language\nMaps to book_language (language_id)",
"num_pages": "the number of the pages",
"publication_date": "the publication date of the book",
"publisher_id": "the id of the publisher\nMaps to publisher (publisher_id)"
}*/
CREATE TABLE book_author
(
book_id INTEGER,
author_id INTEGER,
primary key (book_id, author_id),
foreign key (author_id) references author(author_id),
foreign key (book_id) references book(book_id)
)
/*
1 example row:
SELECT * FROM book_author LIMIT 1;
book_id ||author_id
10539 || 1
*/
/* column definitions {
"book_id": "the id of the book\nMaps to book(book_id)",
"author_id": "the id of the author\nMaps to author(author_id)"
}*/
CREATE TABLE shipping_method
(
method_id INTEGER
primary key,
method_name TEXT,
cost REAL
)
/*
1 example row:
SELECT * FROM shipping_method LIMIT 1;
method_id ||method_name ||cost
1 || Standard || 5.9
*/
/* column definitions {
"method_id": "the unique identifier of the method",
"method_name": "the method name",
"cost": "the cost of the shipping method"
}*/
CREATE TABLE "cust_order"
(
order_id INTEGER
primary key autoincrement,
order_date DATETIME,
customer_id INTEGER
references customer,
shipping_method_id INTEGER
references shipping_method,
dest_address_id INTEGER
references address
)
/*
1 example row:
SELECT * FROM cust_order LIMIT 1;
order_id || order_date ||customer_id ||shipping_method_id ||dest_address_id
1 ||2021-07-14 10:47:19 || 387 || 4 || 1
*/
/* column definitions {
"order_id": "the unique identifier of the customer order",
"order_date": "the date of the order",
"customer_id": "the id of the customer\nMaps to customer(customer_Id)",
"shipping_method_id": "the id of the shipping method\nMaps to shipping_method(method_id)",
"dest_address_id": "the id of the destination address\nMaps to address(address_id)"
}*/
CREATE TABLE "order_history"
(
history_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
status_id INTEGER
references order_status,
status_date DATETIME
)
/*
1 example row:
SELECT * FROM order_history LIMIT 1;
history_id ||order_id ||status_id || status_date
1 || 1 || 1 ||2021-07-14 17:04:28
*/
/* column definitions {
"history_id": "the unique identifier of the order history",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"status_id": "the id of the order\nMaps to order_status(status_id)",
"status_date": "the date of the status updated "
}*/
CREATE TABLE "order_line"
(
line_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
book_id INTEGER
references book,
price REAL
)
/*
1 example row:
SELECT * FROM order_line LIMIT 1;
line_id ||order_id ||book_id ||price
1024 || 2051 || 10720 || 3.19
*/
/* column definitions {
"line_id": "the unique identifier of the order line",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"book_id": "the id of the book\nMaps to book(book_id)",
"price": "the price of the order"
}*/
|
6,019 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE address_status
(
status_id INTEGER
primary key,
address_status TEXT
)
/*
1 example row:
SELECT * FROM address_status LIMIT 1;
status_id ||address_status
1 || Active
*/
/* column definitions {
"status_id": "the unique identifier of the status",
"address_status": "the status of the address"
}*/
CREATE TABLE author
(
author_id INTEGER
primary key,
author_name TEXT
)
/*
1 example row:
SELECT * FROM author LIMIT 1;
author_id || author_name
1 ||A. Bartlett Giamatti
*/
/* column definitions {
"author_id": "the unique identifier of the author",
"author_name": "the name of the author"
}*/
CREATE TABLE book_language
(
language_id INTEGER
primary key,
language_code TEXT,
language_name TEXT
)
/*
1 example row:
SELECT * FROM book_language LIMIT 1;
language_id ||language_code ||language_name
1 || eng || English
*/
/* column definitions {
"language_id": "the unique identifier of the language ",
"language_code": "the language code",
"language_name": "the language name"
}*/
CREATE TABLE country
(
country_id INTEGER
primary key,
country_name TEXT
)
/*
1 example row:
SELECT * FROM country LIMIT 1;
country_id ||country_name
1 || Afghanistan
*/
/* column definitions {
"country_id": "the unique identifier of the country",
"country_name": "the country name"
}*/
CREATE TABLE address
(
address_id INTEGER
primary key,
street_number TEXT,
street_name TEXT,
city TEXT,
country_id INTEGER,
foreign key (country_id) references country(country_id)
)
/*
1 example row:
SELECT * FROM address LIMIT 1;
address_id ||street_number || street_name || city ||country_id
1 || 57 ||Glacier Hill Avenue ||Torbat-e Jām || 95
*/
/* column definitions {
"address_id": "the unique identifier of the address",
"street_number": "the street number of the address",
"street_name": "the street name",
"city": "the city where the address belongs",
"country_id": "the id of the country where the address belongs "
}*/
CREATE TABLE customer
(
customer_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
email TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
customer_id ||first_name ||last_name || email
1 || Ursola || Purdy ||upurdy0@cdbaby.com
*/
/* column definitions {
"customer_id": "the unique identifier of the customer",
"first_name": "the first name of the customer",
"last_name": "the last name of the customer",
"email": "the email of the customer"
}*/
CREATE TABLE customer_address
(
customer_id INTEGER,
address_id INTEGER,
status_id INTEGER,
primary key (customer_id, address_id),
foreign key (address_id) references address(address_id),
foreign key (customer_id) references customer(customer_id)
)
/*
1 example row:
SELECT * FROM customer_address LIMIT 1;
customer_id ||address_id ||status_id
1 || 606 || 1
*/
/* column definitions {
"customer_id": "the id of the customer\nMaps to customer(customer_id)",
"address_id": "the id of the address\nMaps to address(address_id)",
"status_id": "the id of the address status"
}*/
CREATE TABLE order_status
(
status_id INTEGER
primary key,
status_value TEXT
)
/*
1 example row:
SELECT * FROM order_status LIMIT 1;
status_id || status_value
1 ||Order Received
*/
/* column definitions {
"status_id": "the unique identifier of the order status",
"status_value": "the status value"
}*/
CREATE TABLE publisher
(
publisher_id INTEGER
primary key,
publisher_name TEXT
)
/*
1 example row:
SELECT * FROM publisher LIMIT 1;
publisher_id ||publisher_name
1 || 10/18
*/
/* column definitions {
"publisher_id": "the unique identifier of the publisher",
"publisher_name": "the name of the publisher"
}*/
CREATE TABLE book
(
book_id INTEGER
primary key,
title TEXT,
isbn13 TEXT,
language_id INTEGER,
num_pages INTEGER,
publication_date DATE,
publisher_id INTEGER,
foreign key (language_id) references book_language(language_id),
foreign key (publisher_id) references publisher(publisher_id)
)
/*
1 example row:
SELECT * FROM book LIMIT 1;
book_id || title || isbn13 ||language_id ||num_pages ||publication_date ||publisher_id
1 ||The World's First Love: Mary Mother of God ||8987059752 || 2 || 276 || 1996-09-01 || 1010
*/
/* column definitions {
"book_id": "the unique identifier of the book",
"title": "the title of the book ",
"isbn13": "the International Standard Book Number of the book",
"language_id": "the id of the book language\nMaps to book_language (language_id)",
"num_pages": "the number of the pages",
"publication_date": "the publication date of the book",
"publisher_id": "the id of the publisher\nMaps to publisher (publisher_id)"
}*/
CREATE TABLE book_author
(
book_id INTEGER,
author_id INTEGER,
primary key (book_id, author_id),
foreign key (author_id) references author(author_id),
foreign key (book_id) references book(book_id)
)
/*
1 example row:
SELECT * FROM book_author LIMIT 1;
book_id ||author_id
10539 || 1
*/
/* column definitions {
"book_id": "the id of the book\nMaps to book(book_id)",
"author_id": "the id of the author\nMaps to author(author_id)"
}*/
CREATE TABLE shipping_method
(
method_id INTEGER
primary key,
method_name TEXT,
cost REAL
)
/*
1 example row:
SELECT * FROM shipping_method LIMIT 1;
method_id ||method_name ||cost
1 || Standard || 5.9
*/
/* column definitions {
"method_id": "the unique identifier of the method",
"method_name": "the method name",
"cost": "the cost of the shipping method"
}*/
CREATE TABLE "cust_order"
(
order_id INTEGER
primary key autoincrement,
order_date DATETIME,
customer_id INTEGER
references customer,
shipping_method_id INTEGER
references shipping_method,
dest_address_id INTEGER
references address
)
/*
1 example row:
SELECT * FROM cust_order LIMIT 1;
order_id || order_date ||customer_id ||shipping_method_id ||dest_address_id
1 ||2021-07-14 10:47:19 || 387 || 4 || 1
*/
/* column definitions {
"order_id": "the unique identifier of the customer order",
"order_date": "the date of the order",
"customer_id": "the id of the customer\nMaps to customer(customer_Id)",
"shipping_method_id": "the id of the shipping method\nMaps to shipping_method(method_id)",
"dest_address_id": "the id of the destination address\nMaps to address(address_id)"
}*/
CREATE TABLE "order_history"
(
history_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
status_id INTEGER
references order_status,
status_date DATETIME
)
/*
1 example row:
SELECT * FROM order_history LIMIT 1;
history_id ||order_id ||status_id || status_date
1 || 1 || 1 ||2021-07-14 17:04:28
*/
/* column definitions {
"history_id": "the unique identifier of the order history",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"status_id": "the id of the order\nMaps to order_status(status_id)",
"status_date": "the date of the status updated "
}*/
CREATE TABLE "order_line"
(
line_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
book_id INTEGER
references book,
price REAL
)
/*
1 example row:
SELECT * FROM order_line LIMIT 1;
line_id ||order_id ||book_id ||price
1024 || 2051 || 10720 || 3.19
*/
/* column definitions {
"line_id": "the unique identifier of the order line",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"book_id": "the id of the book\nMaps to book(book_id)",
"price": "the price of the order"
}*/
### Question
List all the titles of the Spanish books published by Alfaguara.
Clarification: "Spanish" is the language_name; 'Alfaguara' is the publisher_name
| [query_database(**{'query': 'SELECT T2.title FROM book_language AS T1 INNER JOIN book AS T2 ON T2.language_id = T1.language_id INNER JOIN publisher AS T3 ON T3.publisher_id = T2.publisher_id WHERE T1.language_name = 'Spanish' AND T3.publisher_name = 'Alfaguara' GROUP BY T2.title'})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE address_status
(
status_id INTEGER
primary key,
address_status TEXT
)
/*
1 example row:
SELECT * FROM address_status LIMIT 1;
status_id ||address_status
1 || Active
*/
/* column definitions {
"status_id": "the unique identifier of the status",
"address_status": "the status of the address"
}*/
CREATE TABLE author
(
author_id INTEGER
primary key,
author_name TEXT
)
/*
1 example row:
SELECT * FROM author LIMIT 1;
author_id || author_name
1 ||A. Bartlett Giamatti
*/
/* column definitions {
"author_id": "the unique identifier of the author",
"author_name": "the name of the author"
}*/
CREATE TABLE book_language
(
language_id INTEGER
primary key,
language_code TEXT,
language_name TEXT
)
/*
1 example row:
SELECT * FROM book_language LIMIT 1;
language_id ||language_code ||language_name
1 || eng || English
*/
/* column definitions {
"language_id": "the unique identifier of the language ",
"language_code": "the language code",
"language_name": "the language name"
}*/
CREATE TABLE country
(
country_id INTEGER
primary key,
country_name TEXT
)
/*
1 example row:
SELECT * FROM country LIMIT 1;
country_id ||country_name
1 || Afghanistan
*/
/* column definitions {
"country_id": "the unique identifier of the country",
"country_name": "the country name"
}*/
CREATE TABLE address
(
address_id INTEGER
primary key,
street_number TEXT,
street_name TEXT,
city TEXT,
country_id INTEGER,
foreign key (country_id) references country(country_id)
)
/*
1 example row:
SELECT * FROM address LIMIT 1;
address_id ||street_number || street_name || city ||country_id
1 || 57 ||Glacier Hill Avenue ||Torbat-e Jām || 95
*/
/* column definitions {
"address_id": "the unique identifier of the address",
"street_number": "the street number of the address",
"street_name": "the street name",
"city": "the city where the address belongs",
"country_id": "the id of the country where the address belongs "
}*/
CREATE TABLE customer
(
customer_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
email TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
customer_id ||first_name ||last_name || email
1 || Ursola || Purdy ||upurdy0@cdbaby.com
*/
/* column definitions {
"customer_id": "the unique identifier of the customer",
"first_name": "the first name of the customer",
"last_name": "the last name of the customer",
"email": "the email of the customer"
}*/
CREATE TABLE customer_address
(
customer_id INTEGER,
address_id INTEGER,
status_id INTEGER,
primary key (customer_id, address_id),
foreign key (address_id) references address(address_id),
foreign key (customer_id) references customer(customer_id)
)
/*
1 example row:
SELECT * FROM customer_address LIMIT 1;
customer_id ||address_id ||status_id
1 || 606 || 1
*/
/* column definitions {
"customer_id": "the id of the customer\nMaps to customer(customer_id)",
"address_id": "the id of the address\nMaps to address(address_id)",
"status_id": "the id of the address status"
}*/
CREATE TABLE order_status
(
status_id INTEGER
primary key,
status_value TEXT
)
/*
1 example row:
SELECT * FROM order_status LIMIT 1;
status_id || status_value
1 ||Order Received
*/
/* column definitions {
"status_id": "the unique identifier of the order status",
"status_value": "the status value"
}*/
CREATE TABLE publisher
(
publisher_id INTEGER
primary key,
publisher_name TEXT
)
/*
1 example row:
SELECT * FROM publisher LIMIT 1;
publisher_id ||publisher_name
1 || 10/18
*/
/* column definitions {
"publisher_id": "the unique identifier of the publisher",
"publisher_name": "the name of the publisher"
}*/
CREATE TABLE book
(
book_id INTEGER
primary key,
title TEXT,
isbn13 TEXT,
language_id INTEGER,
num_pages INTEGER,
publication_date DATE,
publisher_id INTEGER,
foreign key (language_id) references book_language(language_id),
foreign key (publisher_id) references publisher(publisher_id)
)
/*
1 example row:
SELECT * FROM book LIMIT 1;
book_id || title || isbn13 ||language_id ||num_pages ||publication_date ||publisher_id
1 ||The World's First Love: Mary Mother of God ||8987059752 || 2 || 276 || 1996-09-01 || 1010
*/
/* column definitions {
"book_id": "the unique identifier of the book",
"title": "the title of the book ",
"isbn13": "the International Standard Book Number of the book",
"language_id": "the id of the book language\nMaps to book_language (language_id)",
"num_pages": "the number of the pages",
"publication_date": "the publication date of the book",
"publisher_id": "the id of the publisher\nMaps to publisher (publisher_id)"
}*/
CREATE TABLE book_author
(
book_id INTEGER,
author_id INTEGER,
primary key (book_id, author_id),
foreign key (author_id) references author(author_id),
foreign key (book_id) references book(book_id)
)
/*
1 example row:
SELECT * FROM book_author LIMIT 1;
book_id ||author_id
10539 || 1
*/
/* column definitions {
"book_id": "the id of the book\nMaps to book(book_id)",
"author_id": "the id of the author\nMaps to author(author_id)"
}*/
CREATE TABLE shipping_method
(
method_id INTEGER
primary key,
method_name TEXT,
cost REAL
)
/*
1 example row:
SELECT * FROM shipping_method LIMIT 1;
method_id ||method_name ||cost
1 || Standard || 5.9
*/
/* column definitions {
"method_id": "the unique identifier of the method",
"method_name": "the method name",
"cost": "the cost of the shipping method"
}*/
CREATE TABLE "cust_order"
(
order_id INTEGER
primary key autoincrement,
order_date DATETIME,
customer_id INTEGER
references customer,
shipping_method_id INTEGER
references shipping_method,
dest_address_id INTEGER
references address
)
/*
1 example row:
SELECT * FROM cust_order LIMIT 1;
order_id || order_date ||customer_id ||shipping_method_id ||dest_address_id
1 ||2021-07-14 10:47:19 || 387 || 4 || 1
*/
/* column definitions {
"order_id": "the unique identifier of the customer order",
"order_date": "the date of the order",
"customer_id": "the id of the customer\nMaps to customer(customer_Id)",
"shipping_method_id": "the id of the shipping method\nMaps to shipping_method(method_id)",
"dest_address_id": "the id of the destination address\nMaps to address(address_id)"
}*/
CREATE TABLE "order_history"
(
history_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
status_id INTEGER
references order_status,
status_date DATETIME
)
/*
1 example row:
SELECT * FROM order_history LIMIT 1;
history_id ||order_id ||status_id || status_date
1 || 1 || 1 ||2021-07-14 17:04:28
*/
/* column definitions {
"history_id": "the unique identifier of the order history",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"status_id": "the id of the order\nMaps to order_status(status_id)",
"status_date": "the date of the status updated "
}*/
CREATE TABLE "order_line"
(
line_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
book_id INTEGER
references book,
price REAL
)
/*
1 example row:
SELECT * FROM order_line LIMIT 1;
line_id ||order_id ||book_id ||price
1024 || 2051 || 10720 || 3.19
*/
/* column definitions {
"line_id": "the unique identifier of the order line",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"book_id": "the id of the book\nMaps to book(book_id)",
"price": "the price of the order"
}*/
|
6,023 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE address_status
(
status_id INTEGER
primary key,
address_status TEXT
)
/*
1 example row:
SELECT * FROM address_status LIMIT 1;
status_id ||address_status
1 || Active
*/
/* column definitions {
"status_id": "the unique identifier of the status",
"address_status": "the status of the address"
}*/
CREATE TABLE author
(
author_id INTEGER
primary key,
author_name TEXT
)
/*
1 example row:
SELECT * FROM author LIMIT 1;
author_id || author_name
1 ||A. Bartlett Giamatti
*/
/* column definitions {
"author_id": "the unique identifier of the author",
"author_name": "the name of the author"
}*/
CREATE TABLE book_language
(
language_id INTEGER
primary key,
language_code TEXT,
language_name TEXT
)
/*
1 example row:
SELECT * FROM book_language LIMIT 1;
language_id ||language_code ||language_name
1 || eng || English
*/
/* column definitions {
"language_id": "the unique identifier of the language ",
"language_code": "the language code",
"language_name": "the language name"
}*/
CREATE TABLE country
(
country_id INTEGER
primary key,
country_name TEXT
)
/*
1 example row:
SELECT * FROM country LIMIT 1;
country_id ||country_name
1 || Afghanistan
*/
/* column definitions {
"country_id": "the unique identifier of the country",
"country_name": "the country name"
}*/
CREATE TABLE address
(
address_id INTEGER
primary key,
street_number TEXT,
street_name TEXT,
city TEXT,
country_id INTEGER,
foreign key (country_id) references country(country_id)
)
/*
1 example row:
SELECT * FROM address LIMIT 1;
address_id ||street_number || street_name || city ||country_id
1 || 57 ||Glacier Hill Avenue ||Torbat-e Jām || 95
*/
/* column definitions {
"address_id": "the unique identifier of the address",
"street_number": "the street number of the address",
"street_name": "the street name",
"city": "the city where the address belongs",
"country_id": "the id of the country where the address belongs "
}*/
CREATE TABLE customer
(
customer_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
email TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
customer_id ||first_name ||last_name || email
1 || Ursola || Purdy ||upurdy0@cdbaby.com
*/
/* column definitions {
"customer_id": "the unique identifier of the customer",
"first_name": "the first name of the customer",
"last_name": "the last name of the customer",
"email": "the email of the customer"
}*/
CREATE TABLE customer_address
(
customer_id INTEGER,
address_id INTEGER,
status_id INTEGER,
primary key (customer_id, address_id),
foreign key (address_id) references address(address_id),
foreign key (customer_id) references customer(customer_id)
)
/*
1 example row:
SELECT * FROM customer_address LIMIT 1;
customer_id ||address_id ||status_id
1 || 606 || 1
*/
/* column definitions {
"customer_id": "the id of the customer\nMaps to customer(customer_id)",
"address_id": "the id of the address\nMaps to address(address_id)",
"status_id": "the id of the address status"
}*/
CREATE TABLE order_status
(
status_id INTEGER
primary key,
status_value TEXT
)
/*
1 example row:
SELECT * FROM order_status LIMIT 1;
status_id || status_value
1 ||Order Received
*/
/* column definitions {
"status_id": "the unique identifier of the order status",
"status_value": "the status value"
}*/
CREATE TABLE publisher
(
publisher_id INTEGER
primary key,
publisher_name TEXT
)
/*
1 example row:
SELECT * FROM publisher LIMIT 1;
publisher_id ||publisher_name
1 || 10/18
*/
/* column definitions {
"publisher_id": "the unique identifier of the publisher",
"publisher_name": "the name of the publisher"
}*/
CREATE TABLE book
(
book_id INTEGER
primary key,
title TEXT,
isbn13 TEXT,
language_id INTEGER,
num_pages INTEGER,
publication_date DATE,
publisher_id INTEGER,
foreign key (language_id) references book_language(language_id),
foreign key (publisher_id) references publisher(publisher_id)
)
/*
1 example row:
SELECT * FROM book LIMIT 1;
book_id || title || isbn13 ||language_id ||num_pages ||publication_date ||publisher_id
1 ||The World's First Love: Mary Mother of God ||8987059752 || 2 || 276 || 1996-09-01 || 1010
*/
/* column definitions {
"book_id": "the unique identifier of the book",
"title": "the title of the book ",
"isbn13": "the International Standard Book Number of the book",
"language_id": "the id of the book language\nMaps to book_language (language_id)",
"num_pages": "the number of the pages",
"publication_date": "the publication date of the book",
"publisher_id": "the id of the publisher\nMaps to publisher (publisher_id)"
}*/
CREATE TABLE book_author
(
book_id INTEGER,
author_id INTEGER,
primary key (book_id, author_id),
foreign key (author_id) references author(author_id),
foreign key (book_id) references book(book_id)
)
/*
1 example row:
SELECT * FROM book_author LIMIT 1;
book_id ||author_id
10539 || 1
*/
/* column definitions {
"book_id": "the id of the book\nMaps to book(book_id)",
"author_id": "the id of the author\nMaps to author(author_id)"
}*/
CREATE TABLE shipping_method
(
method_id INTEGER
primary key,
method_name TEXT,
cost REAL
)
/*
1 example row:
SELECT * FROM shipping_method LIMIT 1;
method_id ||method_name ||cost
1 || Standard || 5.9
*/
/* column definitions {
"method_id": "the unique identifier of the method",
"method_name": "the method name",
"cost": "the cost of the shipping method"
}*/
CREATE TABLE "cust_order"
(
order_id INTEGER
primary key autoincrement,
order_date DATETIME,
customer_id INTEGER
references customer,
shipping_method_id INTEGER
references shipping_method,
dest_address_id INTEGER
references address
)
/*
1 example row:
SELECT * FROM cust_order LIMIT 1;
order_id || order_date ||customer_id ||shipping_method_id ||dest_address_id
1 ||2021-07-14 10:47:19 || 387 || 4 || 1
*/
/* column definitions {
"order_id": "the unique identifier of the customer order",
"order_date": "the date of the order",
"customer_id": "the id of the customer\nMaps to customer(customer_Id)",
"shipping_method_id": "the id of the shipping method\nMaps to shipping_method(method_id)",
"dest_address_id": "the id of the destination address\nMaps to address(address_id)"
}*/
CREATE TABLE "order_history"
(
history_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
status_id INTEGER
references order_status,
status_date DATETIME
)
/*
1 example row:
SELECT * FROM order_history LIMIT 1;
history_id ||order_id ||status_id || status_date
1 || 1 || 1 ||2021-07-14 17:04:28
*/
/* column definitions {
"history_id": "the unique identifier of the order history",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"status_id": "the id of the order\nMaps to order_status(status_id)",
"status_date": "the date of the status updated "
}*/
CREATE TABLE "order_line"
(
line_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
book_id INTEGER
references book,
price REAL
)
/*
1 example row:
SELECT * FROM order_line LIMIT 1;
line_id ||order_id ||book_id ||price
1024 || 2051 || 10720 || 3.19
*/
/* column definitions {
"line_id": "the unique identifier of the order line",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"book_id": "the id of the book\nMaps to book(book_id)",
"price": "the price of the order"
}*/
### Question
Among the books that were published by Scholastic, how many were written by J.K Rowling?
Clarification: "J.K Rowling" is the author_name; 'Scholastic' is the publisher_name
| [query_database(**{'query': 'SELECT COUNT(*) FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id INNER JOIN book_author AS T3 ON T3.book_id = T1.book_id INNER JOIN author AS T4 ON T4.author_id = T3.author_id WHERE T2.publisher_name = 'Scholastic' AND T4.author_name = 'J.K. Rowling''})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE address_status
(
status_id INTEGER
primary key,
address_status TEXT
)
/*
1 example row:
SELECT * FROM address_status LIMIT 1;
status_id ||address_status
1 || Active
*/
/* column definitions {
"status_id": "the unique identifier of the status",
"address_status": "the status of the address"
}*/
CREATE TABLE author
(
author_id INTEGER
primary key,
author_name TEXT
)
/*
1 example row:
SELECT * FROM author LIMIT 1;
author_id || author_name
1 ||A. Bartlett Giamatti
*/
/* column definitions {
"author_id": "the unique identifier of the author",
"author_name": "the name of the author"
}*/
CREATE TABLE book_language
(
language_id INTEGER
primary key,
language_code TEXT,
language_name TEXT
)
/*
1 example row:
SELECT * FROM book_language LIMIT 1;
language_id ||language_code ||language_name
1 || eng || English
*/
/* column definitions {
"language_id": "the unique identifier of the language ",
"language_code": "the language code",
"language_name": "the language name"
}*/
CREATE TABLE country
(
country_id INTEGER
primary key,
country_name TEXT
)
/*
1 example row:
SELECT * FROM country LIMIT 1;
country_id ||country_name
1 || Afghanistan
*/
/* column definitions {
"country_id": "the unique identifier of the country",
"country_name": "the country name"
}*/
CREATE TABLE address
(
address_id INTEGER
primary key,
street_number TEXT,
street_name TEXT,
city TEXT,
country_id INTEGER,
foreign key (country_id) references country(country_id)
)
/*
1 example row:
SELECT * FROM address LIMIT 1;
address_id ||street_number || street_name || city ||country_id
1 || 57 ||Glacier Hill Avenue ||Torbat-e Jām || 95
*/
/* column definitions {
"address_id": "the unique identifier of the address",
"street_number": "the street number of the address",
"street_name": "the street name",
"city": "the city where the address belongs",
"country_id": "the id of the country where the address belongs "
}*/
CREATE TABLE customer
(
customer_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
email TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
customer_id ||first_name ||last_name || email
1 || Ursola || Purdy ||upurdy0@cdbaby.com
*/
/* column definitions {
"customer_id": "the unique identifier of the customer",
"first_name": "the first name of the customer",
"last_name": "the last name of the customer",
"email": "the email of the customer"
}*/
CREATE TABLE customer_address
(
customer_id INTEGER,
address_id INTEGER,
status_id INTEGER,
primary key (customer_id, address_id),
foreign key (address_id) references address(address_id),
foreign key (customer_id) references customer(customer_id)
)
/*
1 example row:
SELECT * FROM customer_address LIMIT 1;
customer_id ||address_id ||status_id
1 || 606 || 1
*/
/* column definitions {
"customer_id": "the id of the customer\nMaps to customer(customer_id)",
"address_id": "the id of the address\nMaps to address(address_id)",
"status_id": "the id of the address status"
}*/
CREATE TABLE order_status
(
status_id INTEGER
primary key,
status_value TEXT
)
/*
1 example row:
SELECT * FROM order_status LIMIT 1;
status_id || status_value
1 ||Order Received
*/
/* column definitions {
"status_id": "the unique identifier of the order status",
"status_value": "the status value"
}*/
CREATE TABLE publisher
(
publisher_id INTEGER
primary key,
publisher_name TEXT
)
/*
1 example row:
SELECT * FROM publisher LIMIT 1;
publisher_id ||publisher_name
1 || 10/18
*/
/* column definitions {
"publisher_id": "the unique identifier of the publisher",
"publisher_name": "the name of the publisher"
}*/
CREATE TABLE book
(
book_id INTEGER
primary key,
title TEXT,
isbn13 TEXT,
language_id INTEGER,
num_pages INTEGER,
publication_date DATE,
publisher_id INTEGER,
foreign key (language_id) references book_language(language_id),
foreign key (publisher_id) references publisher(publisher_id)
)
/*
1 example row:
SELECT * FROM book LIMIT 1;
book_id || title || isbn13 ||language_id ||num_pages ||publication_date ||publisher_id
1 ||The World's First Love: Mary Mother of God ||8987059752 || 2 || 276 || 1996-09-01 || 1010
*/
/* column definitions {
"book_id": "the unique identifier of the book",
"title": "the title of the book ",
"isbn13": "the International Standard Book Number of the book",
"language_id": "the id of the book language\nMaps to book_language (language_id)",
"num_pages": "the number of the pages",
"publication_date": "the publication date of the book",
"publisher_id": "the id of the publisher\nMaps to publisher (publisher_id)"
}*/
CREATE TABLE book_author
(
book_id INTEGER,
author_id INTEGER,
primary key (book_id, author_id),
foreign key (author_id) references author(author_id),
foreign key (book_id) references book(book_id)
)
/*
1 example row:
SELECT * FROM book_author LIMIT 1;
book_id ||author_id
10539 || 1
*/
/* column definitions {
"book_id": "the id of the book\nMaps to book(book_id)",
"author_id": "the id of the author\nMaps to author(author_id)"
}*/
CREATE TABLE shipping_method
(
method_id INTEGER
primary key,
method_name TEXT,
cost REAL
)
/*
1 example row:
SELECT * FROM shipping_method LIMIT 1;
method_id ||method_name ||cost
1 || Standard || 5.9
*/
/* column definitions {
"method_id": "the unique identifier of the method",
"method_name": "the method name",
"cost": "the cost of the shipping method"
}*/
CREATE TABLE "cust_order"
(
order_id INTEGER
primary key autoincrement,
order_date DATETIME,
customer_id INTEGER
references customer,
shipping_method_id INTEGER
references shipping_method,
dest_address_id INTEGER
references address
)
/*
1 example row:
SELECT * FROM cust_order LIMIT 1;
order_id || order_date ||customer_id ||shipping_method_id ||dest_address_id
1 ||2021-07-14 10:47:19 || 387 || 4 || 1
*/
/* column definitions {
"order_id": "the unique identifier of the customer order",
"order_date": "the date of the order",
"customer_id": "the id of the customer\nMaps to customer(customer_Id)",
"shipping_method_id": "the id of the shipping method\nMaps to shipping_method(method_id)",
"dest_address_id": "the id of the destination address\nMaps to address(address_id)"
}*/
CREATE TABLE "order_history"
(
history_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
status_id INTEGER
references order_status,
status_date DATETIME
)
/*
1 example row:
SELECT * FROM order_history LIMIT 1;
history_id ||order_id ||status_id || status_date
1 || 1 || 1 ||2021-07-14 17:04:28
*/
/* column definitions {
"history_id": "the unique identifier of the order history",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"status_id": "the id of the order\nMaps to order_status(status_id)",
"status_date": "the date of the status updated "
}*/
CREATE TABLE "order_line"
(
line_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
book_id INTEGER
references book,
price REAL
)
/*
1 example row:
SELECT * FROM order_line LIMIT 1;
line_id ||order_id ||book_id ||price
1024 || 2051 || 10720 || 3.19
*/
/* column definitions {
"line_id": "the unique identifier of the order line",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"book_id": "the id of the book\nMaps to book(book_id)",
"price": "the price of the order"
}*/
|
6,027 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE address_status
(
status_id INTEGER
primary key,
address_status TEXT
)
/*
1 example row:
SELECT * FROM address_status LIMIT 1;
status_id ||address_status
1 || Active
*/
/* column definitions {
"status_id": "the unique identifier of the status",
"address_status": "the status of the address"
}*/
CREATE TABLE author
(
author_id INTEGER
primary key,
author_name TEXT
)
/*
1 example row:
SELECT * FROM author LIMIT 1;
author_id || author_name
1 ||A. Bartlett Giamatti
*/
/* column definitions {
"author_id": "the unique identifier of the author",
"author_name": "the name of the author"
}*/
CREATE TABLE book_language
(
language_id INTEGER
primary key,
language_code TEXT,
language_name TEXT
)
/*
1 example row:
SELECT * FROM book_language LIMIT 1;
language_id ||language_code ||language_name
1 || eng || English
*/
/* column definitions {
"language_id": "the unique identifier of the language ",
"language_code": "the language code",
"language_name": "the language name"
}*/
CREATE TABLE country
(
country_id INTEGER
primary key,
country_name TEXT
)
/*
1 example row:
SELECT * FROM country LIMIT 1;
country_id ||country_name
1 || Afghanistan
*/
/* column definitions {
"country_id": "the unique identifier of the country",
"country_name": "the country name"
}*/
CREATE TABLE address
(
address_id INTEGER
primary key,
street_number TEXT,
street_name TEXT,
city TEXT,
country_id INTEGER,
foreign key (country_id) references country(country_id)
)
/*
1 example row:
SELECT * FROM address LIMIT 1;
address_id ||street_number || street_name || city ||country_id
1 || 57 ||Glacier Hill Avenue ||Torbat-e Jām || 95
*/
/* column definitions {
"address_id": "the unique identifier of the address",
"street_number": "the street number of the address",
"street_name": "the street name",
"city": "the city where the address belongs",
"country_id": "the id of the country where the address belongs "
}*/
CREATE TABLE customer
(
customer_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
email TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
customer_id ||first_name ||last_name || email
1 || Ursola || Purdy ||upurdy0@cdbaby.com
*/
/* column definitions {
"customer_id": "the unique identifier of the customer",
"first_name": "the first name of the customer",
"last_name": "the last name of the customer",
"email": "the email of the customer"
}*/
CREATE TABLE customer_address
(
customer_id INTEGER,
address_id INTEGER,
status_id INTEGER,
primary key (customer_id, address_id),
foreign key (address_id) references address(address_id),
foreign key (customer_id) references customer(customer_id)
)
/*
1 example row:
SELECT * FROM customer_address LIMIT 1;
customer_id ||address_id ||status_id
1 || 606 || 1
*/
/* column definitions {
"customer_id": "the id of the customer\nMaps to customer(customer_id)",
"address_id": "the id of the address\nMaps to address(address_id)",
"status_id": "the id of the address status"
}*/
CREATE TABLE order_status
(
status_id INTEGER
primary key,
status_value TEXT
)
/*
1 example row:
SELECT * FROM order_status LIMIT 1;
status_id || status_value
1 ||Order Received
*/
/* column definitions {
"status_id": "the unique identifier of the order status",
"status_value": "the status value"
}*/
CREATE TABLE publisher
(
publisher_id INTEGER
primary key,
publisher_name TEXT
)
/*
1 example row:
SELECT * FROM publisher LIMIT 1;
publisher_id ||publisher_name
1 || 10/18
*/
/* column definitions {
"publisher_id": "the unique identifier of the publisher",
"publisher_name": "the name of the publisher"
}*/
CREATE TABLE book
(
book_id INTEGER
primary key,
title TEXT,
isbn13 TEXT,
language_id INTEGER,
num_pages INTEGER,
publication_date DATE,
publisher_id INTEGER,
foreign key (language_id) references book_language(language_id),
foreign key (publisher_id) references publisher(publisher_id)
)
/*
1 example row:
SELECT * FROM book LIMIT 1;
book_id || title || isbn13 ||language_id ||num_pages ||publication_date ||publisher_id
1 ||The World's First Love: Mary Mother of God ||8987059752 || 2 || 276 || 1996-09-01 || 1010
*/
/* column definitions {
"book_id": "the unique identifier of the book",
"title": "the title of the book ",
"isbn13": "the International Standard Book Number of the book",
"language_id": "the id of the book language\nMaps to book_language (language_id)",
"num_pages": "the number of the pages",
"publication_date": "the publication date of the book",
"publisher_id": "the id of the publisher\nMaps to publisher (publisher_id)"
}*/
CREATE TABLE book_author
(
book_id INTEGER,
author_id INTEGER,
primary key (book_id, author_id),
foreign key (author_id) references author(author_id),
foreign key (book_id) references book(book_id)
)
/*
1 example row:
SELECT * FROM book_author LIMIT 1;
book_id ||author_id
10539 || 1
*/
/* column definitions {
"book_id": "the id of the book\nMaps to book(book_id)",
"author_id": "the id of the author\nMaps to author(author_id)"
}*/
CREATE TABLE shipping_method
(
method_id INTEGER
primary key,
method_name TEXT,
cost REAL
)
/*
1 example row:
SELECT * FROM shipping_method LIMIT 1;
method_id ||method_name ||cost
1 || Standard || 5.9
*/
/* column definitions {
"method_id": "the unique identifier of the method",
"method_name": "the method name",
"cost": "the cost of the shipping method"
}*/
CREATE TABLE "cust_order"
(
order_id INTEGER
primary key autoincrement,
order_date DATETIME,
customer_id INTEGER
references customer,
shipping_method_id INTEGER
references shipping_method,
dest_address_id INTEGER
references address
)
/*
1 example row:
SELECT * FROM cust_order LIMIT 1;
order_id || order_date ||customer_id ||shipping_method_id ||dest_address_id
1 ||2021-07-14 10:47:19 || 387 || 4 || 1
*/
/* column definitions {
"order_id": "the unique identifier of the customer order",
"order_date": "the date of the order",
"customer_id": "the id of the customer\nMaps to customer(customer_Id)",
"shipping_method_id": "the id of the shipping method\nMaps to shipping_method(method_id)",
"dest_address_id": "the id of the destination address\nMaps to address(address_id)"
}*/
CREATE TABLE "order_history"
(
history_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
status_id INTEGER
references order_status,
status_date DATETIME
)
/*
1 example row:
SELECT * FROM order_history LIMIT 1;
history_id ||order_id ||status_id || status_date
1 || 1 || 1 ||2021-07-14 17:04:28
*/
/* column definitions {
"history_id": "the unique identifier of the order history",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"status_id": "the id of the order\nMaps to order_status(status_id)",
"status_date": "the date of the status updated "
}*/
CREATE TABLE "order_line"
(
line_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
book_id INTEGER
references book,
price REAL
)
/*
1 example row:
SELECT * FROM order_line LIMIT 1;
line_id ||order_id ||book_id ||price
1024 || 2051 || 10720 || 3.19
*/
/* column definitions {
"line_id": "the unique identifier of the order line",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"book_id": "the id of the book\nMaps to book(book_id)",
"price": "the price of the order"
}*/
### Question
Indicate the ISBN13 of all the books that have less than 140 pages and more than 135.
Clarification: ISBN13 refers to isbn13; less than 140 pages and more than 135 refers to num_pages > 135 AND num_pages < 140;
| [query_database(**{'query': 'SELECT isbn13 FROM book WHERE num_pages < 140 AND num_pages > 135'})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE address_status
(
status_id INTEGER
primary key,
address_status TEXT
)
/*
1 example row:
SELECT * FROM address_status LIMIT 1;
status_id ||address_status
1 || Active
*/
/* column definitions {
"status_id": "the unique identifier of the status",
"address_status": "the status of the address"
}*/
CREATE TABLE author
(
author_id INTEGER
primary key,
author_name TEXT
)
/*
1 example row:
SELECT * FROM author LIMIT 1;
author_id || author_name
1 ||A. Bartlett Giamatti
*/
/* column definitions {
"author_id": "the unique identifier of the author",
"author_name": "the name of the author"
}*/
CREATE TABLE book_language
(
language_id INTEGER
primary key,
language_code TEXT,
language_name TEXT
)
/*
1 example row:
SELECT * FROM book_language LIMIT 1;
language_id ||language_code ||language_name
1 || eng || English
*/
/* column definitions {
"language_id": "the unique identifier of the language ",
"language_code": "the language code",
"language_name": "the language name"
}*/
CREATE TABLE country
(
country_id INTEGER
primary key,
country_name TEXT
)
/*
1 example row:
SELECT * FROM country LIMIT 1;
country_id ||country_name
1 || Afghanistan
*/
/* column definitions {
"country_id": "the unique identifier of the country",
"country_name": "the country name"
}*/
CREATE TABLE address
(
address_id INTEGER
primary key,
street_number TEXT,
street_name TEXT,
city TEXT,
country_id INTEGER,
foreign key (country_id) references country(country_id)
)
/*
1 example row:
SELECT * FROM address LIMIT 1;
address_id ||street_number || street_name || city ||country_id
1 || 57 ||Glacier Hill Avenue ||Torbat-e Jām || 95
*/
/* column definitions {
"address_id": "the unique identifier of the address",
"street_number": "the street number of the address",
"street_name": "the street name",
"city": "the city where the address belongs",
"country_id": "the id of the country where the address belongs "
}*/
CREATE TABLE customer
(
customer_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
email TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
customer_id ||first_name ||last_name || email
1 || Ursola || Purdy ||upurdy0@cdbaby.com
*/
/* column definitions {
"customer_id": "the unique identifier of the customer",
"first_name": "the first name of the customer",
"last_name": "the last name of the customer",
"email": "the email of the customer"
}*/
CREATE TABLE customer_address
(
customer_id INTEGER,
address_id INTEGER,
status_id INTEGER,
primary key (customer_id, address_id),
foreign key (address_id) references address(address_id),
foreign key (customer_id) references customer(customer_id)
)
/*
1 example row:
SELECT * FROM customer_address LIMIT 1;
customer_id ||address_id ||status_id
1 || 606 || 1
*/
/* column definitions {
"customer_id": "the id of the customer\nMaps to customer(customer_id)",
"address_id": "the id of the address\nMaps to address(address_id)",
"status_id": "the id of the address status"
}*/
CREATE TABLE order_status
(
status_id INTEGER
primary key,
status_value TEXT
)
/*
1 example row:
SELECT * FROM order_status LIMIT 1;
status_id || status_value
1 ||Order Received
*/
/* column definitions {
"status_id": "the unique identifier of the order status",
"status_value": "the status value"
}*/
CREATE TABLE publisher
(
publisher_id INTEGER
primary key,
publisher_name TEXT
)
/*
1 example row:
SELECT * FROM publisher LIMIT 1;
publisher_id ||publisher_name
1 || 10/18
*/
/* column definitions {
"publisher_id": "the unique identifier of the publisher",
"publisher_name": "the name of the publisher"
}*/
CREATE TABLE book
(
book_id INTEGER
primary key,
title TEXT,
isbn13 TEXT,
language_id INTEGER,
num_pages INTEGER,
publication_date DATE,
publisher_id INTEGER,
foreign key (language_id) references book_language(language_id),
foreign key (publisher_id) references publisher(publisher_id)
)
/*
1 example row:
SELECT * FROM book LIMIT 1;
book_id || title || isbn13 ||language_id ||num_pages ||publication_date ||publisher_id
1 ||The World's First Love: Mary Mother of God ||8987059752 || 2 || 276 || 1996-09-01 || 1010
*/
/* column definitions {
"book_id": "the unique identifier of the book",
"title": "the title of the book ",
"isbn13": "the International Standard Book Number of the book",
"language_id": "the id of the book language\nMaps to book_language (language_id)",
"num_pages": "the number of the pages",
"publication_date": "the publication date of the book",
"publisher_id": "the id of the publisher\nMaps to publisher (publisher_id)"
}*/
CREATE TABLE book_author
(
book_id INTEGER,
author_id INTEGER,
primary key (book_id, author_id),
foreign key (author_id) references author(author_id),
foreign key (book_id) references book(book_id)
)
/*
1 example row:
SELECT * FROM book_author LIMIT 1;
book_id ||author_id
10539 || 1
*/
/* column definitions {
"book_id": "the id of the book\nMaps to book(book_id)",
"author_id": "the id of the author\nMaps to author(author_id)"
}*/
CREATE TABLE shipping_method
(
method_id INTEGER
primary key,
method_name TEXT,
cost REAL
)
/*
1 example row:
SELECT * FROM shipping_method LIMIT 1;
method_id ||method_name ||cost
1 || Standard || 5.9
*/
/* column definitions {
"method_id": "the unique identifier of the method",
"method_name": "the method name",
"cost": "the cost of the shipping method"
}*/
CREATE TABLE "cust_order"
(
order_id INTEGER
primary key autoincrement,
order_date DATETIME,
customer_id INTEGER
references customer,
shipping_method_id INTEGER
references shipping_method,
dest_address_id INTEGER
references address
)
/*
1 example row:
SELECT * FROM cust_order LIMIT 1;
order_id || order_date ||customer_id ||shipping_method_id ||dest_address_id
1 ||2021-07-14 10:47:19 || 387 || 4 || 1
*/
/* column definitions {
"order_id": "the unique identifier of the customer order",
"order_date": "the date of the order",
"customer_id": "the id of the customer\nMaps to customer(customer_Id)",
"shipping_method_id": "the id of the shipping method\nMaps to shipping_method(method_id)",
"dest_address_id": "the id of the destination address\nMaps to address(address_id)"
}*/
CREATE TABLE "order_history"
(
history_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
status_id INTEGER
references order_status,
status_date DATETIME
)
/*
1 example row:
SELECT * FROM order_history LIMIT 1;
history_id ||order_id ||status_id || status_date
1 || 1 || 1 ||2021-07-14 17:04:28
*/
/* column definitions {
"history_id": "the unique identifier of the order history",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"status_id": "the id of the order\nMaps to order_status(status_id)",
"status_date": "the date of the status updated "
}*/
CREATE TABLE "order_line"
(
line_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
book_id INTEGER
references book,
price REAL
)
/*
1 example row:
SELECT * FROM order_line LIMIT 1;
line_id ||order_id ||book_id ||price
1024 || 2051 || 10720 || 3.19
*/
/* column definitions {
"line_id": "the unique identifier of the order line",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"book_id": "the id of the book\nMaps to book(book_id)",
"price": "the price of the order"
}*/
|
6,031 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE address_status
(
status_id INTEGER
primary key,
address_status TEXT
)
/*
1 example row:
SELECT * FROM address_status LIMIT 1;
status_id ||address_status
1 || Active
*/
/* column definitions {
"status_id": "the unique identifier of the status",
"address_status": "the status of the address"
}*/
CREATE TABLE author
(
author_id INTEGER
primary key,
author_name TEXT
)
/*
1 example row:
SELECT * FROM author LIMIT 1;
author_id || author_name
1 ||A. Bartlett Giamatti
*/
/* column definitions {
"author_id": "the unique identifier of the author",
"author_name": "the name of the author"
}*/
CREATE TABLE book_language
(
language_id INTEGER
primary key,
language_code TEXT,
language_name TEXT
)
/*
1 example row:
SELECT * FROM book_language LIMIT 1;
language_id ||language_code ||language_name
1 || eng || English
*/
/* column definitions {
"language_id": "the unique identifier of the language ",
"language_code": "the language code",
"language_name": "the language name"
}*/
CREATE TABLE country
(
country_id INTEGER
primary key,
country_name TEXT
)
/*
1 example row:
SELECT * FROM country LIMIT 1;
country_id ||country_name
1 || Afghanistan
*/
/* column definitions {
"country_id": "the unique identifier of the country",
"country_name": "the country name"
}*/
CREATE TABLE address
(
address_id INTEGER
primary key,
street_number TEXT,
street_name TEXT,
city TEXT,
country_id INTEGER,
foreign key (country_id) references country(country_id)
)
/*
1 example row:
SELECT * FROM address LIMIT 1;
address_id ||street_number || street_name || city ||country_id
1 || 57 ||Glacier Hill Avenue ||Torbat-e Jām || 95
*/
/* column definitions {
"address_id": "the unique identifier of the address",
"street_number": "the street number of the address",
"street_name": "the street name",
"city": "the city where the address belongs",
"country_id": "the id of the country where the address belongs "
}*/
CREATE TABLE customer
(
customer_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
email TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
customer_id ||first_name ||last_name || email
1 || Ursola || Purdy ||upurdy0@cdbaby.com
*/
/* column definitions {
"customer_id": "the unique identifier of the customer",
"first_name": "the first name of the customer",
"last_name": "the last name of the customer",
"email": "the email of the customer"
}*/
CREATE TABLE customer_address
(
customer_id INTEGER,
address_id INTEGER,
status_id INTEGER,
primary key (customer_id, address_id),
foreign key (address_id) references address(address_id),
foreign key (customer_id) references customer(customer_id)
)
/*
1 example row:
SELECT * FROM customer_address LIMIT 1;
customer_id ||address_id ||status_id
1 || 606 || 1
*/
/* column definitions {
"customer_id": "the id of the customer\nMaps to customer(customer_id)",
"address_id": "the id of the address\nMaps to address(address_id)",
"status_id": "the id of the address status"
}*/
CREATE TABLE order_status
(
status_id INTEGER
primary key,
status_value TEXT
)
/*
1 example row:
SELECT * FROM order_status LIMIT 1;
status_id || status_value
1 ||Order Received
*/
/* column definitions {
"status_id": "the unique identifier of the order status",
"status_value": "the status value"
}*/
CREATE TABLE publisher
(
publisher_id INTEGER
primary key,
publisher_name TEXT
)
/*
1 example row:
SELECT * FROM publisher LIMIT 1;
publisher_id ||publisher_name
1 || 10/18
*/
/* column definitions {
"publisher_id": "the unique identifier of the publisher",
"publisher_name": "the name of the publisher"
}*/
CREATE TABLE book
(
book_id INTEGER
primary key,
title TEXT,
isbn13 TEXT,
language_id INTEGER,
num_pages INTEGER,
publication_date DATE,
publisher_id INTEGER,
foreign key (language_id) references book_language(language_id),
foreign key (publisher_id) references publisher(publisher_id)
)
/*
1 example row:
SELECT * FROM book LIMIT 1;
book_id || title || isbn13 ||language_id ||num_pages ||publication_date ||publisher_id
1 ||The World's First Love: Mary Mother of God ||8987059752 || 2 || 276 || 1996-09-01 || 1010
*/
/* column definitions {
"book_id": "the unique identifier of the book",
"title": "the title of the book ",
"isbn13": "the International Standard Book Number of the book",
"language_id": "the id of the book language\nMaps to book_language (language_id)",
"num_pages": "the number of the pages",
"publication_date": "the publication date of the book",
"publisher_id": "the id of the publisher\nMaps to publisher (publisher_id)"
}*/
CREATE TABLE book_author
(
book_id INTEGER,
author_id INTEGER,
primary key (book_id, author_id),
foreign key (author_id) references author(author_id),
foreign key (book_id) references book(book_id)
)
/*
1 example row:
SELECT * FROM book_author LIMIT 1;
book_id ||author_id
10539 || 1
*/
/* column definitions {
"book_id": "the id of the book\nMaps to book(book_id)",
"author_id": "the id of the author\nMaps to author(author_id)"
}*/
CREATE TABLE shipping_method
(
method_id INTEGER
primary key,
method_name TEXT,
cost REAL
)
/*
1 example row:
SELECT * FROM shipping_method LIMIT 1;
method_id ||method_name ||cost
1 || Standard || 5.9
*/
/* column definitions {
"method_id": "the unique identifier of the method",
"method_name": "the method name",
"cost": "the cost of the shipping method"
}*/
CREATE TABLE "cust_order"
(
order_id INTEGER
primary key autoincrement,
order_date DATETIME,
customer_id INTEGER
references customer,
shipping_method_id INTEGER
references shipping_method,
dest_address_id INTEGER
references address
)
/*
1 example row:
SELECT * FROM cust_order LIMIT 1;
order_id || order_date ||customer_id ||shipping_method_id ||dest_address_id
1 ||2021-07-14 10:47:19 || 387 || 4 || 1
*/
/* column definitions {
"order_id": "the unique identifier of the customer order",
"order_date": "the date of the order",
"customer_id": "the id of the customer\nMaps to customer(customer_Id)",
"shipping_method_id": "the id of the shipping method\nMaps to shipping_method(method_id)",
"dest_address_id": "the id of the destination address\nMaps to address(address_id)"
}*/
CREATE TABLE "order_history"
(
history_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
status_id INTEGER
references order_status,
status_date DATETIME
)
/*
1 example row:
SELECT * FROM order_history LIMIT 1;
history_id ||order_id ||status_id || status_date
1 || 1 || 1 ||2021-07-14 17:04:28
*/
/* column definitions {
"history_id": "the unique identifier of the order history",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"status_id": "the id of the order\nMaps to order_status(status_id)",
"status_date": "the date of the status updated "
}*/
CREATE TABLE "order_line"
(
line_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
book_id INTEGER
references book,
price REAL
)
/*
1 example row:
SELECT * FROM order_line LIMIT 1;
line_id ||order_id ||book_id ||price
1024 || 2051 || 10720 || 3.19
*/
/* column definitions {
"line_id": "the unique identifier of the order line",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"book_id": "the id of the book\nMaps to book(book_id)",
"price": "the price of the order"
}*/
### Question
In which cities are the customers of Costa Rica located?
Clarification: "Costa Rica" is the country_name
| [query_database(**{'query': 'SELECT T1.city FROM address AS T1 INNER JOIN country AS T2 ON T2.country_id = T1.country_id WHERE T2.country_name = 'Costa Rica''})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE address_status
(
status_id INTEGER
primary key,
address_status TEXT
)
/*
1 example row:
SELECT * FROM address_status LIMIT 1;
status_id ||address_status
1 || Active
*/
/* column definitions {
"status_id": "the unique identifier of the status",
"address_status": "the status of the address"
}*/
CREATE TABLE author
(
author_id INTEGER
primary key,
author_name TEXT
)
/*
1 example row:
SELECT * FROM author LIMIT 1;
author_id || author_name
1 ||A. Bartlett Giamatti
*/
/* column definitions {
"author_id": "the unique identifier of the author",
"author_name": "the name of the author"
}*/
CREATE TABLE book_language
(
language_id INTEGER
primary key,
language_code TEXT,
language_name TEXT
)
/*
1 example row:
SELECT * FROM book_language LIMIT 1;
language_id ||language_code ||language_name
1 || eng || English
*/
/* column definitions {
"language_id": "the unique identifier of the language ",
"language_code": "the language code",
"language_name": "the language name"
}*/
CREATE TABLE country
(
country_id INTEGER
primary key,
country_name TEXT
)
/*
1 example row:
SELECT * FROM country LIMIT 1;
country_id ||country_name
1 || Afghanistan
*/
/* column definitions {
"country_id": "the unique identifier of the country",
"country_name": "the country name"
}*/
CREATE TABLE address
(
address_id INTEGER
primary key,
street_number TEXT,
street_name TEXT,
city TEXT,
country_id INTEGER,
foreign key (country_id) references country(country_id)
)
/*
1 example row:
SELECT * FROM address LIMIT 1;
address_id ||street_number || street_name || city ||country_id
1 || 57 ||Glacier Hill Avenue ||Torbat-e Jām || 95
*/
/* column definitions {
"address_id": "the unique identifier of the address",
"street_number": "the street number of the address",
"street_name": "the street name",
"city": "the city where the address belongs",
"country_id": "the id of the country where the address belongs "
}*/
CREATE TABLE customer
(
customer_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
email TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
customer_id ||first_name ||last_name || email
1 || Ursola || Purdy ||upurdy0@cdbaby.com
*/
/* column definitions {
"customer_id": "the unique identifier of the customer",
"first_name": "the first name of the customer",
"last_name": "the last name of the customer",
"email": "the email of the customer"
}*/
CREATE TABLE customer_address
(
customer_id INTEGER,
address_id INTEGER,
status_id INTEGER,
primary key (customer_id, address_id),
foreign key (address_id) references address(address_id),
foreign key (customer_id) references customer(customer_id)
)
/*
1 example row:
SELECT * FROM customer_address LIMIT 1;
customer_id ||address_id ||status_id
1 || 606 || 1
*/
/* column definitions {
"customer_id": "the id of the customer\nMaps to customer(customer_id)",
"address_id": "the id of the address\nMaps to address(address_id)",
"status_id": "the id of the address status"
}*/
CREATE TABLE order_status
(
status_id INTEGER
primary key,
status_value TEXT
)
/*
1 example row:
SELECT * FROM order_status LIMIT 1;
status_id || status_value
1 ||Order Received
*/
/* column definitions {
"status_id": "the unique identifier of the order status",
"status_value": "the status value"
}*/
CREATE TABLE publisher
(
publisher_id INTEGER
primary key,
publisher_name TEXT
)
/*
1 example row:
SELECT * FROM publisher LIMIT 1;
publisher_id ||publisher_name
1 || 10/18
*/
/* column definitions {
"publisher_id": "the unique identifier of the publisher",
"publisher_name": "the name of the publisher"
}*/
CREATE TABLE book
(
book_id INTEGER
primary key,
title TEXT,
isbn13 TEXT,
language_id INTEGER,
num_pages INTEGER,
publication_date DATE,
publisher_id INTEGER,
foreign key (language_id) references book_language(language_id),
foreign key (publisher_id) references publisher(publisher_id)
)
/*
1 example row:
SELECT * FROM book LIMIT 1;
book_id || title || isbn13 ||language_id ||num_pages ||publication_date ||publisher_id
1 ||The World's First Love: Mary Mother of God ||8987059752 || 2 || 276 || 1996-09-01 || 1010
*/
/* column definitions {
"book_id": "the unique identifier of the book",
"title": "the title of the book ",
"isbn13": "the International Standard Book Number of the book",
"language_id": "the id of the book language\nMaps to book_language (language_id)",
"num_pages": "the number of the pages",
"publication_date": "the publication date of the book",
"publisher_id": "the id of the publisher\nMaps to publisher (publisher_id)"
}*/
CREATE TABLE book_author
(
book_id INTEGER,
author_id INTEGER,
primary key (book_id, author_id),
foreign key (author_id) references author(author_id),
foreign key (book_id) references book(book_id)
)
/*
1 example row:
SELECT * FROM book_author LIMIT 1;
book_id ||author_id
10539 || 1
*/
/* column definitions {
"book_id": "the id of the book\nMaps to book(book_id)",
"author_id": "the id of the author\nMaps to author(author_id)"
}*/
CREATE TABLE shipping_method
(
method_id INTEGER
primary key,
method_name TEXT,
cost REAL
)
/*
1 example row:
SELECT * FROM shipping_method LIMIT 1;
method_id ||method_name ||cost
1 || Standard || 5.9
*/
/* column definitions {
"method_id": "the unique identifier of the method",
"method_name": "the method name",
"cost": "the cost of the shipping method"
}*/
CREATE TABLE "cust_order"
(
order_id INTEGER
primary key autoincrement,
order_date DATETIME,
customer_id INTEGER
references customer,
shipping_method_id INTEGER
references shipping_method,
dest_address_id INTEGER
references address
)
/*
1 example row:
SELECT * FROM cust_order LIMIT 1;
order_id || order_date ||customer_id ||shipping_method_id ||dest_address_id
1 ||2021-07-14 10:47:19 || 387 || 4 || 1
*/
/* column definitions {
"order_id": "the unique identifier of the customer order",
"order_date": "the date of the order",
"customer_id": "the id of the customer\nMaps to customer(customer_Id)",
"shipping_method_id": "the id of the shipping method\nMaps to shipping_method(method_id)",
"dest_address_id": "the id of the destination address\nMaps to address(address_id)"
}*/
CREATE TABLE "order_history"
(
history_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
status_id INTEGER
references order_status,
status_date DATETIME
)
/*
1 example row:
SELECT * FROM order_history LIMIT 1;
history_id ||order_id ||status_id || status_date
1 || 1 || 1 ||2021-07-14 17:04:28
*/
/* column definitions {
"history_id": "the unique identifier of the order history",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"status_id": "the id of the order\nMaps to order_status(status_id)",
"status_date": "the date of the status updated "
}*/
CREATE TABLE "order_line"
(
line_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
book_id INTEGER
references book,
price REAL
)
/*
1 example row:
SELECT * FROM order_line LIMIT 1;
line_id ||order_id ||book_id ||price
1024 || 2051 || 10720 || 3.19
*/
/* column definitions {
"line_id": "the unique identifier of the order line",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"book_id": "the id of the book\nMaps to book(book_id)",
"price": "the price of the order"
}*/
|
6,035 | [
128000,
128006,
882,
128007,
271,
33,
5412,
374,
264,
8668,
315,
11470,
23524,
264,
3488,
36864,
3465,
430,
1253,
1397,
1495,
311,
5822,
23115,
11,
1701,
279,
7372,
635,
20047,
13,
20400,
459,
8475,
4320,
311,
279,
2728,
3488,
13,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | Bellow is a sequence of instructions describing a question answering task that may require text to sql parsing, using the Sqlite syntax. Generate an appropriate answer to the given question. A question is considered 'Foo' if it can be answered by querying from the database. Strictly follow the required format. In your answer(s), give only the necessary information in a concise way. You must not re generate the input prompt.
### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE address_status
(
status_id INTEGER
primary key,
address_status TEXT
)
/*
1 example row:
SELECT * FROM address_status LIMIT 1;
status_id ||address_status
1 || Active
*/
/* column definitions {
"status_id": "the unique identifier of the status",
"address_status": "the status of the address"
}*/
CREATE TABLE author
(
author_id INTEGER
primary key,
author_name TEXT
)
/*
1 example row:
SELECT * FROM author LIMIT 1;
author_id || author_name
1 ||A. Bartlett Giamatti
*/
/* column definitions {
"author_id": "the unique identifier of the author",
"author_name": "the name of the author"
}*/
CREATE TABLE book_language
(
language_id INTEGER
primary key,
language_code TEXT,
language_name TEXT
)
/*
1 example row:
SELECT * FROM book_language LIMIT 1;
language_id ||language_code ||language_name
1 || eng || English
*/
/* column definitions {
"language_id": "the unique identifier of the language ",
"language_code": "the language code",
"language_name": "the language name"
}*/
CREATE TABLE country
(
country_id INTEGER
primary key,
country_name TEXT
)
/*
1 example row:
SELECT * FROM country LIMIT 1;
country_id ||country_name
1 || Afghanistan
*/
/* column definitions {
"country_id": "the unique identifier of the country",
"country_name": "the country name"
}*/
CREATE TABLE address
(
address_id INTEGER
primary key,
street_number TEXT,
street_name TEXT,
city TEXT,
country_id INTEGER,
foreign key (country_id) references country(country_id)
)
/*
1 example row:
SELECT * FROM address LIMIT 1;
address_id ||street_number || street_name || city ||country_id
1 || 57 ||Glacier Hill Avenue ||Torbat-e Jām || 95
*/
/* column definitions {
"address_id": "the unique identifier of the address",
"street_number": "the street number of the address",
"street_name": "the street name",
"city": "the city where the address belongs",
"country_id": "the id of the country where the address belongs "
}*/
CREATE TABLE customer
(
customer_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
email TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
customer_id ||first_name ||last_name || email
1 || Ursola || Purdy ||upurdy0@cdbaby.com
*/
/* column definitions {
"customer_id": "the unique identifier of the customer",
"first_name": "the first name of the customer",
"last_name": "the last name of the customer",
"email": "the email of the customer"
}*/
CREATE TABLE customer_address
(
customer_id INTEGER,
address_id INTEGER,
status_id INTEGER,
primary key (customer_id, address_id),
foreign key (address_id) references address(address_id),
foreign key (customer_id) references customer(customer_id)
)
/*
1 example row:
SELECT * FROM customer_address LIMIT 1;
customer_id ||address_id ||status_id
1 || 606 || 1
*/
/* column definitions {
"customer_id": "the id of the customer\nMaps to customer(customer_id)",
"address_id": "the id of the address\nMaps to address(address_id)",
"status_id": "the id of the address status"
}*/
CREATE TABLE order_status
(
status_id INTEGER
primary key,
status_value TEXT
)
/*
1 example row:
SELECT * FROM order_status LIMIT 1;
status_id || status_value
1 ||Order Received
*/
/* column definitions {
"status_id": "the unique identifier of the order status",
"status_value": "the status value"
}*/
CREATE TABLE publisher
(
publisher_id INTEGER
primary key,
publisher_name TEXT
)
/*
1 example row:
SELECT * FROM publisher LIMIT 1;
publisher_id ||publisher_name
1 || 10/18
*/
/* column definitions {
"publisher_id": "the unique identifier of the publisher",
"publisher_name": "the name of the publisher"
}*/
CREATE TABLE book
(
book_id INTEGER
primary key,
title TEXT,
isbn13 TEXT,
language_id INTEGER,
num_pages INTEGER,
publication_date DATE,
publisher_id INTEGER,
foreign key (language_id) references book_language(language_id),
foreign key (publisher_id) references publisher(publisher_id)
)
/*
1 example row:
SELECT * FROM book LIMIT 1;
book_id || title || isbn13 ||language_id ||num_pages ||publication_date ||publisher_id
1 ||The World's First Love: Mary Mother of God ||8987059752 || 2 || 276 || 1996-09-01 || 1010
*/
/* column definitions {
"book_id": "the unique identifier of the book",
"title": "the title of the book ",
"isbn13": "the International Standard Book Number of the book",
"language_id": "the id of the book language\nMaps to book_language (language_id)",
"num_pages": "the number of the pages",
"publication_date": "the publication date of the book",
"publisher_id": "the id of the publisher\nMaps to publisher (publisher_id)"
}*/
CREATE TABLE book_author
(
book_id INTEGER,
author_id INTEGER,
primary key (book_id, author_id),
foreign key (author_id) references author(author_id),
foreign key (book_id) references book(book_id)
)
/*
1 example row:
SELECT * FROM book_author LIMIT 1;
book_id ||author_id
10539 || 1
*/
/* column definitions {
"book_id": "the id of the book\nMaps to book(book_id)",
"author_id": "the id of the author\nMaps to author(author_id)"
}*/
CREATE TABLE shipping_method
(
method_id INTEGER
primary key,
method_name TEXT,
cost REAL
)
/*
1 example row:
SELECT * FROM shipping_method LIMIT 1;
method_id ||method_name ||cost
1 || Standard || 5.9
*/
/* column definitions {
"method_id": "the unique identifier of the method",
"method_name": "the method name",
"cost": "the cost of the shipping method"
}*/
CREATE TABLE "cust_order"
(
order_id INTEGER
primary key autoincrement,
order_date DATETIME,
customer_id INTEGER
references customer,
shipping_method_id INTEGER
references shipping_method,
dest_address_id INTEGER
references address
)
/*
1 example row:
SELECT * FROM cust_order LIMIT 1;
order_id || order_date ||customer_id ||shipping_method_id ||dest_address_id
1 ||2021-07-14 10:47:19 || 387 || 4 || 1
*/
/* column definitions {
"order_id": "the unique identifier of the customer order",
"order_date": "the date of the order",
"customer_id": "the id of the customer\nMaps to customer(customer_Id)",
"shipping_method_id": "the id of the shipping method\nMaps to shipping_method(method_id)",
"dest_address_id": "the id of the destination address\nMaps to address(address_id)"
}*/
CREATE TABLE "order_history"
(
history_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
status_id INTEGER
references order_status,
status_date DATETIME
)
/*
1 example row:
SELECT * FROM order_history LIMIT 1;
history_id ||order_id ||status_id || status_date
1 || 1 || 1 ||2021-07-14 17:04:28
*/
/* column definitions {
"history_id": "the unique identifier of the order history",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"status_id": "the id of the order\nMaps to order_status(status_id)",
"status_date": "the date of the status updated "
}*/
CREATE TABLE "order_line"
(
line_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
book_id INTEGER
references book,
price REAL
)
/*
1 example row:
SELECT * FROM order_line LIMIT 1;
line_id ||order_id ||book_id ||price
1024 || 2051 || 10720 || 3.19
*/
/* column definitions {
"line_id": "the unique identifier of the order line",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"book_id": "the id of the book\nMaps to book(book_id)",
"price": "the price of the order"
}*/
### Question
On what date did the customers who live at number 460 of their respective streets place their orders?
Clarification: live at number 460 refers to street_number = '460'; date the customers placed their orders refers to order_date
| [query_database(**{'query': 'SELECT T1.order_date FROM cust_order AS T1 INNER JOIN address AS T2 ON T1.dest_address_id = T2.address_id WHERE T2.street_number = 460'})] | ### Instruction
1. Given an SQL script to initialize a database of multiple tables under '### Database Schema' section. Each table is followed by one example row extracted from the database and a ditionary of definitions for further clarifying its column names meaning.
2. A user give you a question under '### Question' section.
3. Determine if the user question is 'Foo'. Base on the given definition of 'Foo'.
4. If the question is 'Foo', generate an SQL query for answering the question and store it in a variable named "sql". Make a function call to an external SQL engine by generating "[query_database(**{'query': sql})]"
5. If the question is not 'Foo'. Generate an answer based on your own reflection. If you don't know the answer, just be honest and don't make up a random answer.
### Database Schema
CREATE TABLE address_status
(
status_id INTEGER
primary key,
address_status TEXT
)
/*
1 example row:
SELECT * FROM address_status LIMIT 1;
status_id ||address_status
1 || Active
*/
/* column definitions {
"status_id": "the unique identifier of the status",
"address_status": "the status of the address"
}*/
CREATE TABLE author
(
author_id INTEGER
primary key,
author_name TEXT
)
/*
1 example row:
SELECT * FROM author LIMIT 1;
author_id || author_name
1 ||A. Bartlett Giamatti
*/
/* column definitions {
"author_id": "the unique identifier of the author",
"author_name": "the name of the author"
}*/
CREATE TABLE book_language
(
language_id INTEGER
primary key,
language_code TEXT,
language_name TEXT
)
/*
1 example row:
SELECT * FROM book_language LIMIT 1;
language_id ||language_code ||language_name
1 || eng || English
*/
/* column definitions {
"language_id": "the unique identifier of the language ",
"language_code": "the language code",
"language_name": "the language name"
}*/
CREATE TABLE country
(
country_id INTEGER
primary key,
country_name TEXT
)
/*
1 example row:
SELECT * FROM country LIMIT 1;
country_id ||country_name
1 || Afghanistan
*/
/* column definitions {
"country_id": "the unique identifier of the country",
"country_name": "the country name"
}*/
CREATE TABLE address
(
address_id INTEGER
primary key,
street_number TEXT,
street_name TEXT,
city TEXT,
country_id INTEGER,
foreign key (country_id) references country(country_id)
)
/*
1 example row:
SELECT * FROM address LIMIT 1;
address_id ||street_number || street_name || city ||country_id
1 || 57 ||Glacier Hill Avenue ||Torbat-e Jām || 95
*/
/* column definitions {
"address_id": "the unique identifier of the address",
"street_number": "the street number of the address",
"street_name": "the street name",
"city": "the city where the address belongs",
"country_id": "the id of the country where the address belongs "
}*/
CREATE TABLE customer
(
customer_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
email TEXT
)
/*
1 example row:
SELECT * FROM customer LIMIT 1;
customer_id ||first_name ||last_name || email
1 || Ursola || Purdy ||upurdy0@cdbaby.com
*/
/* column definitions {
"customer_id": "the unique identifier of the customer",
"first_name": "the first name of the customer",
"last_name": "the last name of the customer",
"email": "the email of the customer"
}*/
CREATE TABLE customer_address
(
customer_id INTEGER,
address_id INTEGER,
status_id INTEGER,
primary key (customer_id, address_id),
foreign key (address_id) references address(address_id),
foreign key (customer_id) references customer(customer_id)
)
/*
1 example row:
SELECT * FROM customer_address LIMIT 1;
customer_id ||address_id ||status_id
1 || 606 || 1
*/
/* column definitions {
"customer_id": "the id of the customer\nMaps to customer(customer_id)",
"address_id": "the id of the address\nMaps to address(address_id)",
"status_id": "the id of the address status"
}*/
CREATE TABLE order_status
(
status_id INTEGER
primary key,
status_value TEXT
)
/*
1 example row:
SELECT * FROM order_status LIMIT 1;
status_id || status_value
1 ||Order Received
*/
/* column definitions {
"status_id": "the unique identifier of the order status",
"status_value": "the status value"
}*/
CREATE TABLE publisher
(
publisher_id INTEGER
primary key,
publisher_name TEXT
)
/*
1 example row:
SELECT * FROM publisher LIMIT 1;
publisher_id ||publisher_name
1 || 10/18
*/
/* column definitions {
"publisher_id": "the unique identifier of the publisher",
"publisher_name": "the name of the publisher"
}*/
CREATE TABLE book
(
book_id INTEGER
primary key,
title TEXT,
isbn13 TEXT,
language_id INTEGER,
num_pages INTEGER,
publication_date DATE,
publisher_id INTEGER,
foreign key (language_id) references book_language(language_id),
foreign key (publisher_id) references publisher(publisher_id)
)
/*
1 example row:
SELECT * FROM book LIMIT 1;
book_id || title || isbn13 ||language_id ||num_pages ||publication_date ||publisher_id
1 ||The World's First Love: Mary Mother of God ||8987059752 || 2 || 276 || 1996-09-01 || 1010
*/
/* column definitions {
"book_id": "the unique identifier of the book",
"title": "the title of the book ",
"isbn13": "the International Standard Book Number of the book",
"language_id": "the id of the book language\nMaps to book_language (language_id)",
"num_pages": "the number of the pages",
"publication_date": "the publication date of the book",
"publisher_id": "the id of the publisher\nMaps to publisher (publisher_id)"
}*/
CREATE TABLE book_author
(
book_id INTEGER,
author_id INTEGER,
primary key (book_id, author_id),
foreign key (author_id) references author(author_id),
foreign key (book_id) references book(book_id)
)
/*
1 example row:
SELECT * FROM book_author LIMIT 1;
book_id ||author_id
10539 || 1
*/
/* column definitions {
"book_id": "the id of the book\nMaps to book(book_id)",
"author_id": "the id of the author\nMaps to author(author_id)"
}*/
CREATE TABLE shipping_method
(
method_id INTEGER
primary key,
method_name TEXT,
cost REAL
)
/*
1 example row:
SELECT * FROM shipping_method LIMIT 1;
method_id ||method_name ||cost
1 || Standard || 5.9
*/
/* column definitions {
"method_id": "the unique identifier of the method",
"method_name": "the method name",
"cost": "the cost of the shipping method"
}*/
CREATE TABLE "cust_order"
(
order_id INTEGER
primary key autoincrement,
order_date DATETIME,
customer_id INTEGER
references customer,
shipping_method_id INTEGER
references shipping_method,
dest_address_id INTEGER
references address
)
/*
1 example row:
SELECT * FROM cust_order LIMIT 1;
order_id || order_date ||customer_id ||shipping_method_id ||dest_address_id
1 ||2021-07-14 10:47:19 || 387 || 4 || 1
*/
/* column definitions {
"order_id": "the unique identifier of the customer order",
"order_date": "the date of the order",
"customer_id": "the id of the customer\nMaps to customer(customer_Id)",
"shipping_method_id": "the id of the shipping method\nMaps to shipping_method(method_id)",
"dest_address_id": "the id of the destination address\nMaps to address(address_id)"
}*/
CREATE TABLE "order_history"
(
history_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
status_id INTEGER
references order_status,
status_date DATETIME
)
/*
1 example row:
SELECT * FROM order_history LIMIT 1;
history_id ||order_id ||status_id || status_date
1 || 1 || 1 ||2021-07-14 17:04:28
*/
/* column definitions {
"history_id": "the unique identifier of the order history",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"status_id": "the id of the order\nMaps to order_status(status_id)",
"status_date": "the date of the status updated "
}*/
CREATE TABLE "order_line"
(
line_id INTEGER
primary key autoincrement,
order_id INTEGER
references cust_order,
book_id INTEGER
references book,
price REAL
)
/*
1 example row:
SELECT * FROM order_line LIMIT 1;
line_id ||order_id ||book_id ||price
1024 || 2051 || 10720 || 3.19
*/
/* column definitions {
"line_id": "the unique identifier of the order line",
"order_id": "the id of the order\nMaps to cust_order(order_id)",
"book_id": "the id of the book\nMaps to book(book_id)",
"price": "the price of the order"
}*/
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.