db_id
stringclasses
140 values
messages
listlengths
2
2
allergy_1
[ { "content": "Translate the following question to SQL: How many students does each advisor have?\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT advisor , count(*) FROM Student GROUP BY advisor", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: Which advisor has most number of students?\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT advisor FROM Student GROUP BY advisor ORDER BY count(*) DESC LIMIT 1", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: Give the advisor with the most students.\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT advisor FROM Student GROUP BY advisor ORDER BY count(*) DESC LIMIT 1", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: How many students have cat allergies?\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT count(*) FROM Has_allergy WHERE Allergy = \"Cat\"", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: How many students are affected by cat allergies?\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT count(*) FROM Has_allergy WHERE Allergy = \"Cat\"", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: Show all student IDs who have at least two allergies.\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT StuID FROM Has_allergy GROUP BY StuID HAVING count(*) >= 2", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: What are the students ids of students who have more than one allergy?\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT StuID FROM Has_allergy GROUP BY StuID HAVING count(*) >= 2", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: What are the student ids of students who don't have any allergies?\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT StuID FROM Student EXCEPT SELECT StuID FROM Has_allergy", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: Which students are unaffected by allergies?\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT StuID FROM Student EXCEPT SELECT StuID FROM Has_allergy", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: How many female students have milk or egg allergies?\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT count(*) FROM has_allergy AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T2.sex = \"F\" AND T1.allergy = \"Milk\" OR T1.allergy = \"Eggs\"", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: How many students who are female are allergic to milk or eggs?\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT count(*) FROM has_allergy AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T2.sex = \"F\" AND T1.allergy = \"Milk\" OR T1.allergy = \"Eggs\"", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: How many students have a food allergy?\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT count(*) FROM Has_allergy AS T1 JOIN Allergy_type AS T2 ON T1.allergy = T2.allergy WHERE T2.allergytype = \"food\"", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: How many students are affected by food related allergies?\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT count(*) FROM Has_allergy AS T1 JOIN Allergy_type AS T2 ON T1.allergy = T2.allergy WHERE T2.allergytype = \"food\"", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: Which allergy has most number of students affected?\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT Allergy FROM Has_allergy GROUP BY Allergy ORDER BY count(*) DESC LIMIT 1", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: Which allergy is the most common?\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT Allergy FROM Has_allergy GROUP BY Allergy ORDER BY count(*) DESC LIMIT 1", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: Show all allergies with number of students affected.\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT Allergy , count(*) FROM Has_allergy GROUP BY Allergy", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: How many students have each different allergy?\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT Allergy , count(*) FROM Has_allergy GROUP BY Allergy", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: Show all allergy type with number of students affected.\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT T2.allergytype , count(*) FROM Has_allergy AS T1 JOIN Allergy_type AS T2 ON T1.allergy = T2.allergy GROUP BY T2.allergytype", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: How many students are affected by each allergy type?\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT T2.allergytype , count(*) FROM Has_allergy AS T1 JOIN Allergy_type AS T2 ON T1.allergy = T2.allergy GROUP BY T2.allergytype", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: Find the last name and age of the student who has allergy to both milk and cat.\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT lname , age FROM Student WHERE StuID IN (SELECT StuID FROM Has_allergy WHERE Allergy = \"Milk\" INTERSECT SELECT StuID FROM Has_allergy WHERE Allergy = \"Cat\")", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: What are the last names and ages of the students who are allergic to milk and cat?\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT lname , age FROM Student WHERE StuID IN (SELECT StuID FROM Has_allergy WHERE Allergy = \"Milk\" INTERSECT SELECT StuID FROM Has_allergy WHERE Allergy = \"Cat\")", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: What are the allergies and their types that the student with first name Lisa has? And order the result by name of allergies.\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT T1.Allergy , T1.AllergyType FROM Allergy_type AS T1 JOIN Has_allergy AS T2 ON T1.Allergy = T2.Allergy JOIN Student AS T3 ON T3.StuID = T2.StuID WHERE T3.Fname = \"Lisa\" ORDER BY T1.Allergy", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: What are the allergies the girl named Lisa has? And what are the types of them? Order the result by allergy names.\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT T1.Allergy , T1.AllergyType FROM Allergy_type AS T1 JOIN Has_allergy AS T2 ON T1.Allergy = T2.Allergy JOIN Student AS T3 ON T3.StuID = T2.StuID WHERE T3.Fname = \"Lisa\" ORDER BY T1.Allergy", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: Find the first name and gender of the student who has allergy to milk but not cat.\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT fname , sex FROM Student WHERE StuID IN (SELECT StuID FROM Has_allergy WHERE Allergy = \"Milk\" EXCEPT SELECT StuID FROM Has_allergy WHERE Allergy = \"Cat\")", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: What are the first name and gender of the students who have allergy to milk but can put up with cats?\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT fname , sex FROM Student WHERE StuID IN (SELECT StuID FROM Has_allergy WHERE Allergy = \"Milk\" EXCEPT SELECT StuID FROM Has_allergy WHERE Allergy = \"Cat\")", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: Find the average age of the students who have allergies with food and animal types.\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT avg(age) FROM Student WHERE StuID IN ( SELECT T1.StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = \"food\" INTERSECT SELECT T1.StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = \"animal\")", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: How old are the students with allergies to food and animal types on average?\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT avg(age) FROM Student WHERE StuID IN ( SELECT T1.StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = \"food\" INTERSECT SELECT T1.StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = \"animal\")", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: List the first and last name of the students who do not have any food type allergy.\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT fname , lname FROM Student WHERE StuID NOT IN (SELECT T1.StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = \"food\")", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: What is the full name of each student who is not allergic to any type of food.\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT fname , lname FROM Student WHERE StuID NOT IN (SELECT T1.StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = \"food\")", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: Find the number of male (sex is 'M') students who have some food type allery.\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT count(*) FROM Student WHERE sex = \"M\" AND StuID IN (SELECT StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = \"food\")", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: How many male students (sex is 'M') are allergic to any type of food?\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT count(*) FROM Student WHERE sex = \"M\" AND StuID IN (SELECT StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = \"food\")", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: Find the different first names and cities of the students who have allergy to milk or cat.\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT DISTINCT T1.fname , T1.city_code FROM Student AS T1 JOIN Has_Allergy AS T2 ON T1.stuid = T2.stuid WHERE T2.Allergy = \"Milk\" OR T2.Allergy = \"Cat\"", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: What are the distinct first names and cities of the students who have allergy either to milk or to cat?\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT DISTINCT T1.fname , T1.city_code FROM Student AS T1 JOIN Has_Allergy AS T2 ON T1.stuid = T2.stuid WHERE T2.Allergy = \"Milk\" OR T2.Allergy = \"Cat\"", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: Find the number of students who are older than 18 and do not have allergy to either food or animal.\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT count(*) FROM Student WHERE age > 18 AND StuID NOT IN ( SELECT StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = \"food\" OR T2.allergytype = \"animal\")", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: How many students are over 18 and do not have allergy to food type or animal type?\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT count(*) FROM Student WHERE age > 18 AND StuID NOT IN ( SELECT StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = \"food\" OR T2.allergytype = \"animal\")", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: Find the first name and major of the students who are not allegry to soy.\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT fname , major FROM Student WHERE StuID NOT IN (SELECT StuID FROM Has_allergy WHERE Allergy = \"Soy\")", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: What are the first name and major of the students who are able to consume soy?\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT fname , major FROM Student WHERE StuID NOT IN (SELECT StuID FROM Has_allergy WHERE Allergy = \"Soy\")", "role": "assistant" } ]
store_1
[ { "content": "Translate the following question to SQL: A list of the top 5 countries by number of invoices. List country name and number of invoices.\n\nSchema: CREATE TABLE artists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE albums (\n id INTEGER PRIMARY KEY,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (artist_id) REFERENCES artists(id)\n);\n\nCREATE TABLE employees (\n id INTEGER PRIMARY KEY,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n UNIQUE (id),\n FOREIGN KEY (reports_to) REFERENCES employees(id)\n);\n\nCREATE TABLE customers (\n id INTEGER PRIMARY KEY,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n UNIQUE (id),\n FOREIGN KEY (support_rep_id) REFERENCES employees(id)\n);\n\nCREATE TABLE genres (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE invoices (\n id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (customer_id) REFERENCES customers(id)\n);\n\nCREATE TABLE media_types (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE tracks (\n id INTEGER PRIMARY KEY,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (media_type_id) REFERENCES media_types(id),\n FOREIGN KEY (genre_id) REFERENCES genres(id),\n FOREIGN KEY (album_id) REFERENCES albums(id)\n);\n\nCREATE TABLE invoice_lines (\n id INTEGER PRIMARY KEY,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (invoice_id) REFERENCES invoices(id)\n);\n\nCREATE TABLE playlists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE playlist_tracks (\n playlist_id INTEGER NOT NULL PRIMARY KEY,\n track_id INTEGER NOT NULL PRIMARY KEY,\n PRIMARY KEY (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (playlist_id) REFERENCES playlists(id)\n);", "role": "user" }, { "content": "SELECT billing_country , COUNT(*) FROM invoices GROUP BY billing_country ORDER BY count(*) DESC LIMIT 5;", "role": "assistant" } ]
store_1
[ { "content": "Translate the following question to SQL: What are the top 5 countries by number of invoices and how many do they have?\n\nSchema: CREATE TABLE artists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE albums (\n id INTEGER PRIMARY KEY,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (artist_id) REFERENCES artists(id)\n);\n\nCREATE TABLE employees (\n id INTEGER PRIMARY KEY,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n UNIQUE (id),\n FOREIGN KEY (reports_to) REFERENCES employees(id)\n);\n\nCREATE TABLE customers (\n id INTEGER PRIMARY KEY,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n UNIQUE (id),\n FOREIGN KEY (support_rep_id) REFERENCES employees(id)\n);\n\nCREATE TABLE genres (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE invoices (\n id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (customer_id) REFERENCES customers(id)\n);\n\nCREATE TABLE media_types (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE tracks (\n id INTEGER PRIMARY KEY,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (media_type_id) REFERENCES media_types(id),\n FOREIGN KEY (genre_id) REFERENCES genres(id),\n FOREIGN KEY (album_id) REFERENCES albums(id)\n);\n\nCREATE TABLE invoice_lines (\n id INTEGER PRIMARY KEY,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (invoice_id) REFERENCES invoices(id)\n);\n\nCREATE TABLE playlists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE playlist_tracks (\n playlist_id INTEGER NOT NULL PRIMARY KEY,\n track_id INTEGER NOT NULL PRIMARY KEY,\n PRIMARY KEY (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (playlist_id) REFERENCES playlists(id)\n);", "role": "user" }, { "content": "SELECT billing_country , COUNT(*) FROM invoices GROUP BY billing_country ORDER BY count(*) DESC LIMIT 5;", "role": "assistant" } ]
store_1
[ { "content": "Translate the following question to SQL: A list of the top 8 countries by gross/total invoice size. List country name and gross invoice size.\n\nSchema: CREATE TABLE artists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE albums (\n id INTEGER PRIMARY KEY,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (artist_id) REFERENCES artists(id)\n);\n\nCREATE TABLE employees (\n id INTEGER PRIMARY KEY,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n UNIQUE (id),\n FOREIGN KEY (reports_to) REFERENCES employees(id)\n);\n\nCREATE TABLE customers (\n id INTEGER PRIMARY KEY,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n UNIQUE (id),\n FOREIGN KEY (support_rep_id) REFERENCES employees(id)\n);\n\nCREATE TABLE genres (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE invoices (\n id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (customer_id) REFERENCES customers(id)\n);\n\nCREATE TABLE media_types (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE tracks (\n id INTEGER PRIMARY KEY,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (media_type_id) REFERENCES media_types(id),\n FOREIGN KEY (genre_id) REFERENCES genres(id),\n FOREIGN KEY (album_id) REFERENCES albums(id)\n);\n\nCREATE TABLE invoice_lines (\n id INTEGER PRIMARY KEY,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (invoice_id) REFERENCES invoices(id)\n);\n\nCREATE TABLE playlists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE playlist_tracks (\n playlist_id INTEGER NOT NULL PRIMARY KEY,\n track_id INTEGER NOT NULL PRIMARY KEY,\n PRIMARY KEY (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (playlist_id) REFERENCES playlists(id)\n);", "role": "user" }, { "content": "SELECT billing_country , SUM(total) FROM invoices GROUP BY billing_country ORDER BY SUM(total) DESC LIMIT 8;", "role": "assistant" } ]
store_1
[ { "content": "Translate the following question to SQL: What are the names of the top 8 countries by total invoice size and what are those sizes?\n\nSchema: CREATE TABLE artists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE albums (\n id INTEGER PRIMARY KEY,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (artist_id) REFERENCES artists(id)\n);\n\nCREATE TABLE employees (\n id INTEGER PRIMARY KEY,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n UNIQUE (id),\n FOREIGN KEY (reports_to) REFERENCES employees(id)\n);\n\nCREATE TABLE customers (\n id INTEGER PRIMARY KEY,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n UNIQUE (id),\n FOREIGN KEY (support_rep_id) REFERENCES employees(id)\n);\n\nCREATE TABLE genres (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE invoices (\n id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (customer_id) REFERENCES customers(id)\n);\n\nCREATE TABLE media_types (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE tracks (\n id INTEGER PRIMARY KEY,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (media_type_id) REFERENCES media_types(id),\n FOREIGN KEY (genre_id) REFERENCES genres(id),\n FOREIGN KEY (album_id) REFERENCES albums(id)\n);\n\nCREATE TABLE invoice_lines (\n id INTEGER PRIMARY KEY,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (invoice_id) REFERENCES invoices(id)\n);\n\nCREATE TABLE playlists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE playlist_tracks (\n playlist_id INTEGER NOT NULL PRIMARY KEY,\n track_id INTEGER NOT NULL PRIMARY KEY,\n PRIMARY KEY (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (playlist_id) REFERENCES playlists(id)\n);", "role": "user" }, { "content": "SELECT billing_country , SUM(total) FROM invoices GROUP BY billing_country ORDER BY SUM(total) DESC LIMIT 8;", "role": "assistant" } ]
store_1
[ { "content": "Translate the following question to SQL: A list of the top 10 countries by average invoice size. List country name and average invoice size.\n\nSchema: CREATE TABLE artists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE albums (\n id INTEGER PRIMARY KEY,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (artist_id) REFERENCES artists(id)\n);\n\nCREATE TABLE employees (\n id INTEGER PRIMARY KEY,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n UNIQUE (id),\n FOREIGN KEY (reports_to) REFERENCES employees(id)\n);\n\nCREATE TABLE customers (\n id INTEGER PRIMARY KEY,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n UNIQUE (id),\n FOREIGN KEY (support_rep_id) REFERENCES employees(id)\n);\n\nCREATE TABLE genres (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE invoices (\n id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (customer_id) REFERENCES customers(id)\n);\n\nCREATE TABLE media_types (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE tracks (\n id INTEGER PRIMARY KEY,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (media_type_id) REFERENCES media_types(id),\n FOREIGN KEY (genre_id) REFERENCES genres(id),\n FOREIGN KEY (album_id) REFERENCES albums(id)\n);\n\nCREATE TABLE invoice_lines (\n id INTEGER PRIMARY KEY,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (invoice_id) REFERENCES invoices(id)\n);\n\nCREATE TABLE playlists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE playlist_tracks (\n playlist_id INTEGER NOT NULL PRIMARY KEY,\n track_id INTEGER NOT NULL PRIMARY KEY,\n PRIMARY KEY (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (playlist_id) REFERENCES playlists(id)\n);", "role": "user" }, { "content": "SELECT billing_country , AVG(total) FROM invoices GROUP BY billing_country ORDER BY AVG(total) DESC LIMIT 10;", "role": "assistant" } ]
store_1
[ { "content": "Translate the following question to SQL: What are the names of the countries and average invoice size of the top countries by size?\n\nSchema: CREATE TABLE artists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE albums (\n id INTEGER PRIMARY KEY,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (artist_id) REFERENCES artists(id)\n);\n\nCREATE TABLE employees (\n id INTEGER PRIMARY KEY,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n UNIQUE (id),\n FOREIGN KEY (reports_to) REFERENCES employees(id)\n);\n\nCREATE TABLE customers (\n id INTEGER PRIMARY KEY,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n UNIQUE (id),\n FOREIGN KEY (support_rep_id) REFERENCES employees(id)\n);\n\nCREATE TABLE genres (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE invoices (\n id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (customer_id) REFERENCES customers(id)\n);\n\nCREATE TABLE media_types (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE tracks (\n id INTEGER PRIMARY KEY,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (media_type_id) REFERENCES media_types(id),\n FOREIGN KEY (genre_id) REFERENCES genres(id),\n FOREIGN KEY (album_id) REFERENCES albums(id)\n);\n\nCREATE TABLE invoice_lines (\n id INTEGER PRIMARY KEY,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (invoice_id) REFERENCES invoices(id)\n);\n\nCREATE TABLE playlists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE playlist_tracks (\n playlist_id INTEGER NOT NULL PRIMARY KEY,\n track_id INTEGER NOT NULL PRIMARY KEY,\n PRIMARY KEY (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (playlist_id) REFERENCES playlists(id)\n);", "role": "user" }, { "content": "SELECT billing_country , AVG(total) FROM invoices GROUP BY billing_country ORDER BY AVG(total) DESC LIMIT 10;", "role": "assistant" } ]
store_1
[ { "content": "Translate the following question to SQL: Find out 5 customers who most recently purchased something. List customers' first and last name.\n\nSchema: CREATE TABLE artists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE albums (\n id INTEGER PRIMARY KEY,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (artist_id) REFERENCES artists(id)\n);\n\nCREATE TABLE employees (\n id INTEGER PRIMARY KEY,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n UNIQUE (id),\n FOREIGN KEY (reports_to) REFERENCES employees(id)\n);\n\nCREATE TABLE customers (\n id INTEGER PRIMARY KEY,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n UNIQUE (id),\n FOREIGN KEY (support_rep_id) REFERENCES employees(id)\n);\n\nCREATE TABLE genres (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE invoices (\n id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (customer_id) REFERENCES customers(id)\n);\n\nCREATE TABLE media_types (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE tracks (\n id INTEGER PRIMARY KEY,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (media_type_id) REFERENCES media_types(id),\n FOREIGN KEY (genre_id) REFERENCES genres(id),\n FOREIGN KEY (album_id) REFERENCES albums(id)\n);\n\nCREATE TABLE invoice_lines (\n id INTEGER PRIMARY KEY,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (invoice_id) REFERENCES invoices(id)\n);\n\nCREATE TABLE playlists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE playlist_tracks (\n playlist_id INTEGER NOT NULL PRIMARY KEY,\n track_id INTEGER NOT NULL PRIMARY KEY,\n PRIMARY KEY (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (playlist_id) REFERENCES playlists(id)\n);", "role": "user" }, { "content": "SELECT T1.first_name , T1.last_name FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id = T1.id ORDER BY T2.invoice_date DESC LIMIT 5;", "role": "assistant" } ]
store_1
[ { "content": "Translate the following question to SQL: What are the first and last names of the 5 customers who purchased something most recently?\n\nSchema: CREATE TABLE artists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE albums (\n id INTEGER PRIMARY KEY,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (artist_id) REFERENCES artists(id)\n);\n\nCREATE TABLE employees (\n id INTEGER PRIMARY KEY,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n UNIQUE (id),\n FOREIGN KEY (reports_to) REFERENCES employees(id)\n);\n\nCREATE TABLE customers (\n id INTEGER PRIMARY KEY,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n UNIQUE (id),\n FOREIGN KEY (support_rep_id) REFERENCES employees(id)\n);\n\nCREATE TABLE genres (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE invoices (\n id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (customer_id) REFERENCES customers(id)\n);\n\nCREATE TABLE media_types (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE tracks (\n id INTEGER PRIMARY KEY,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (media_type_id) REFERENCES media_types(id),\n FOREIGN KEY (genre_id) REFERENCES genres(id),\n FOREIGN KEY (album_id) REFERENCES albums(id)\n);\n\nCREATE TABLE invoice_lines (\n id INTEGER PRIMARY KEY,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (invoice_id) REFERENCES invoices(id)\n);\n\nCREATE TABLE playlists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE playlist_tracks (\n playlist_id INTEGER NOT NULL PRIMARY KEY,\n track_id INTEGER NOT NULL PRIMARY KEY,\n PRIMARY KEY (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (playlist_id) REFERENCES playlists(id)\n);", "role": "user" }, { "content": "SELECT T1.first_name , T1.last_name FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id = T1.id ORDER BY T2.invoice_date DESC LIMIT 5;", "role": "assistant" } ]
store_1
[ { "content": "Translate the following question to SQL: Find out the top 10 customers by total number of orders. List customers' first and last name and the number of total orders.\n\nSchema: CREATE TABLE artists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE albums (\n id INTEGER PRIMARY KEY,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (artist_id) REFERENCES artists(id)\n);\n\nCREATE TABLE employees (\n id INTEGER PRIMARY KEY,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n UNIQUE (id),\n FOREIGN KEY (reports_to) REFERENCES employees(id)\n);\n\nCREATE TABLE customers (\n id INTEGER PRIMARY KEY,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n UNIQUE (id),\n FOREIGN KEY (support_rep_id) REFERENCES employees(id)\n);\n\nCREATE TABLE genres (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE invoices (\n id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (customer_id) REFERENCES customers(id)\n);\n\nCREATE TABLE media_types (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE tracks (\n id INTEGER PRIMARY KEY,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (media_type_id) REFERENCES media_types(id),\n FOREIGN KEY (genre_id) REFERENCES genres(id),\n FOREIGN KEY (album_id) REFERENCES albums(id)\n);\n\nCREATE TABLE invoice_lines (\n id INTEGER PRIMARY KEY,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (invoice_id) REFERENCES invoices(id)\n);\n\nCREATE TABLE playlists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE playlist_tracks (\n playlist_id INTEGER NOT NULL PRIMARY KEY,\n track_id INTEGER NOT NULL PRIMARY KEY,\n PRIMARY KEY (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (playlist_id) REFERENCES playlists(id)\n);", "role": "user" }, { "content": "SELECT T1.first_name , T1.last_name , COUNT(*) FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id = T1.id GROUP BY T1.id ORDER BY COUNT(*) DESC LIMIT 10;", "role": "assistant" } ]
store_1
[ { "content": "Translate the following question to SQL: What are the top 10 customers' first and last names by total number of orders and how many orders did they make?\n\nSchema: CREATE TABLE artists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE albums (\n id INTEGER PRIMARY KEY,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (artist_id) REFERENCES artists(id)\n);\n\nCREATE TABLE employees (\n id INTEGER PRIMARY KEY,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n UNIQUE (id),\n FOREIGN KEY (reports_to) REFERENCES employees(id)\n);\n\nCREATE TABLE customers (\n id INTEGER PRIMARY KEY,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n UNIQUE (id),\n FOREIGN KEY (support_rep_id) REFERENCES employees(id)\n);\n\nCREATE TABLE genres (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE invoices (\n id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (customer_id) REFERENCES customers(id)\n);\n\nCREATE TABLE media_types (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE tracks (\n id INTEGER PRIMARY KEY,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (media_type_id) REFERENCES media_types(id),\n FOREIGN KEY (genre_id) REFERENCES genres(id),\n FOREIGN KEY (album_id) REFERENCES albums(id)\n);\n\nCREATE TABLE invoice_lines (\n id INTEGER PRIMARY KEY,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (invoice_id) REFERENCES invoices(id)\n);\n\nCREATE TABLE playlists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE playlist_tracks (\n playlist_id INTEGER NOT NULL PRIMARY KEY,\n track_id INTEGER NOT NULL PRIMARY KEY,\n PRIMARY KEY (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (playlist_id) REFERENCES playlists(id)\n);", "role": "user" }, { "content": "SELECT T1.first_name , T1.last_name , COUNT(*) FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id = T1.id GROUP BY T1.id ORDER BY COUNT(*) DESC LIMIT 10;", "role": "assistant" } ]
store_1
[ { "content": "Translate the following question to SQL: List the top 10 customers by total gross sales. List customers' first and last name and total gross sales.\n\nSchema: CREATE TABLE artists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE albums (\n id INTEGER PRIMARY KEY,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (artist_id) REFERENCES artists(id)\n);\n\nCREATE TABLE employees (\n id INTEGER PRIMARY KEY,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n UNIQUE (id),\n FOREIGN KEY (reports_to) REFERENCES employees(id)\n);\n\nCREATE TABLE customers (\n id INTEGER PRIMARY KEY,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n UNIQUE (id),\n FOREIGN KEY (support_rep_id) REFERENCES employees(id)\n);\n\nCREATE TABLE genres (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE invoices (\n id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (customer_id) REFERENCES customers(id)\n);\n\nCREATE TABLE media_types (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE tracks (\n id INTEGER PRIMARY KEY,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (media_type_id) REFERENCES media_types(id),\n FOREIGN KEY (genre_id) REFERENCES genres(id),\n FOREIGN KEY (album_id) REFERENCES albums(id)\n);\n\nCREATE TABLE invoice_lines (\n id INTEGER PRIMARY KEY,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (invoice_id) REFERENCES invoices(id)\n);\n\nCREATE TABLE playlists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE playlist_tracks (\n playlist_id INTEGER NOT NULL PRIMARY KEY,\n track_id INTEGER NOT NULL PRIMARY KEY,\n PRIMARY KEY (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (playlist_id) REFERENCES playlists(id)\n);", "role": "user" }, { "content": "SELECT T1.first_name , T1.last_name , SUM(T2.total) FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id = T1.id GROUP BY T1.id ORDER BY SUM(T2.total) DESC LIMIT 10;", "role": "assistant" } ]
store_1
[ { "content": "Translate the following question to SQL: What are the top 10 customers' first and last names with the highest gross sales, and also what are the sales?\n\nSchema: CREATE TABLE artists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE albums (\n id INTEGER PRIMARY KEY,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (artist_id) REFERENCES artists(id)\n);\n\nCREATE TABLE employees (\n id INTEGER PRIMARY KEY,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n UNIQUE (id),\n FOREIGN KEY (reports_to) REFERENCES employees(id)\n);\n\nCREATE TABLE customers (\n id INTEGER PRIMARY KEY,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n UNIQUE (id),\n FOREIGN KEY (support_rep_id) REFERENCES employees(id)\n);\n\nCREATE TABLE genres (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE invoices (\n id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (customer_id) REFERENCES customers(id)\n);\n\nCREATE TABLE media_types (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE tracks (\n id INTEGER PRIMARY KEY,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (media_type_id) REFERENCES media_types(id),\n FOREIGN KEY (genre_id) REFERENCES genres(id),\n FOREIGN KEY (album_id) REFERENCES albums(id)\n);\n\nCREATE TABLE invoice_lines (\n id INTEGER PRIMARY KEY,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (invoice_id) REFERENCES invoices(id)\n);\n\nCREATE TABLE playlists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE playlist_tracks (\n playlist_id INTEGER NOT NULL PRIMARY KEY,\n track_id INTEGER NOT NULL PRIMARY KEY,\n PRIMARY KEY (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (playlist_id) REFERENCES playlists(id)\n);", "role": "user" }, { "content": "SELECT T1.first_name , T1.last_name , SUM(T2.total) FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id = T1.id GROUP BY T1.id ORDER BY SUM(T2.total) DESC LIMIT 10;", "role": "assistant" } ]
store_1
[ { "content": "Translate the following question to SQL: List the top 5 genres by number of tracks. List genres name and total tracks.\n\nSchema: CREATE TABLE artists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE albums (\n id INTEGER PRIMARY KEY,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (artist_id) REFERENCES artists(id)\n);\n\nCREATE TABLE employees (\n id INTEGER PRIMARY KEY,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n UNIQUE (id),\n FOREIGN KEY (reports_to) REFERENCES employees(id)\n);\n\nCREATE TABLE customers (\n id INTEGER PRIMARY KEY,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n UNIQUE (id),\n FOREIGN KEY (support_rep_id) REFERENCES employees(id)\n);\n\nCREATE TABLE genres (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE invoices (\n id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (customer_id) REFERENCES customers(id)\n);\n\nCREATE TABLE media_types (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE tracks (\n id INTEGER PRIMARY KEY,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (media_type_id) REFERENCES media_types(id),\n FOREIGN KEY (genre_id) REFERENCES genres(id),\n FOREIGN KEY (album_id) REFERENCES albums(id)\n);\n\nCREATE TABLE invoice_lines (\n id INTEGER PRIMARY KEY,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (invoice_id) REFERENCES invoices(id)\n);\n\nCREATE TABLE playlists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE playlist_tracks (\n playlist_id INTEGER NOT NULL PRIMARY KEY,\n track_id INTEGER NOT NULL PRIMARY KEY,\n PRIMARY KEY (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (playlist_id) REFERENCES playlists(id)\n);", "role": "user" }, { "content": "SELECT T1.name , COUNT(*) FROM genres AS T1 JOIN tracks AS T2 ON T2.genre_id = T1.id GROUP BY T1.id ORDER BY count(*) DESC LIMIT 5;", "role": "assistant" } ]
store_1
[ { "content": "Translate the following question to SQL: How many tracks does each genre have and what are the names of the top 5?\n\nSchema: CREATE TABLE artists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE albums (\n id INTEGER PRIMARY KEY,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (artist_id) REFERENCES artists(id)\n);\n\nCREATE TABLE employees (\n id INTEGER PRIMARY KEY,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n UNIQUE (id),\n FOREIGN KEY (reports_to) REFERENCES employees(id)\n);\n\nCREATE TABLE customers (\n id INTEGER PRIMARY KEY,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n UNIQUE (id),\n FOREIGN KEY (support_rep_id) REFERENCES employees(id)\n);\n\nCREATE TABLE genres (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE invoices (\n id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (customer_id) REFERENCES customers(id)\n);\n\nCREATE TABLE media_types (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE tracks (\n id INTEGER PRIMARY KEY,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (media_type_id) REFERENCES media_types(id),\n FOREIGN KEY (genre_id) REFERENCES genres(id),\n FOREIGN KEY (album_id) REFERENCES albums(id)\n);\n\nCREATE TABLE invoice_lines (\n id INTEGER PRIMARY KEY,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (invoice_id) REFERENCES invoices(id)\n);\n\nCREATE TABLE playlists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE playlist_tracks (\n playlist_id INTEGER NOT NULL PRIMARY KEY,\n track_id INTEGER NOT NULL PRIMARY KEY,\n PRIMARY KEY (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (playlist_id) REFERENCES playlists(id)\n);", "role": "user" }, { "content": "SELECT T1.name , COUNT(*) FROM genres AS T1 JOIN tracks AS T2 ON T2.genre_id = T1.id GROUP BY T1.id ORDER BY count(*) DESC LIMIT 5;", "role": "assistant" } ]
store_1
[ { "content": "Translate the following question to SQL: List every album's title.\n\nSchema: CREATE TABLE artists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE albums (\n id INTEGER PRIMARY KEY,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (artist_id) REFERENCES artists(id)\n);\n\nCREATE TABLE employees (\n id INTEGER PRIMARY KEY,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n UNIQUE (id),\n FOREIGN KEY (reports_to) REFERENCES employees(id)\n);\n\nCREATE TABLE customers (\n id INTEGER PRIMARY KEY,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n UNIQUE (id),\n FOREIGN KEY (support_rep_id) REFERENCES employees(id)\n);\n\nCREATE TABLE genres (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE invoices (\n id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (customer_id) REFERENCES customers(id)\n);\n\nCREATE TABLE media_types (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE tracks (\n id INTEGER PRIMARY KEY,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (media_type_id) REFERENCES media_types(id),\n FOREIGN KEY (genre_id) REFERENCES genres(id),\n FOREIGN KEY (album_id) REFERENCES albums(id)\n);\n\nCREATE TABLE invoice_lines (\n id INTEGER PRIMARY KEY,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (invoice_id) REFERENCES invoices(id)\n);\n\nCREATE TABLE playlists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE playlist_tracks (\n playlist_id INTEGER NOT NULL PRIMARY KEY,\n track_id INTEGER NOT NULL PRIMARY KEY,\n PRIMARY KEY (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (playlist_id) REFERENCES playlists(id)\n);", "role": "user" }, { "content": "SELECT title FROM albums;", "role": "assistant" } ]
store_1
[ { "content": "Translate the following question to SQL: What are the titles of all the albums?\n\nSchema: CREATE TABLE artists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE albums (\n id INTEGER PRIMARY KEY,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (artist_id) REFERENCES artists(id)\n);\n\nCREATE TABLE employees (\n id INTEGER PRIMARY KEY,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n UNIQUE (id),\n FOREIGN KEY (reports_to) REFERENCES employees(id)\n);\n\nCREATE TABLE customers (\n id INTEGER PRIMARY KEY,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n UNIQUE (id),\n FOREIGN KEY (support_rep_id) REFERENCES employees(id)\n);\n\nCREATE TABLE genres (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE invoices (\n id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (customer_id) REFERENCES customers(id)\n);\n\nCREATE TABLE media_types (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE tracks (\n id INTEGER PRIMARY KEY,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (media_type_id) REFERENCES media_types(id),\n FOREIGN KEY (genre_id) REFERENCES genres(id),\n FOREIGN KEY (album_id) REFERENCES albums(id)\n);\n\nCREATE TABLE invoice_lines (\n id INTEGER PRIMARY KEY,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (invoice_id) REFERENCES invoices(id)\n);\n\nCREATE TABLE playlists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE playlist_tracks (\n playlist_id INTEGER NOT NULL PRIMARY KEY,\n track_id INTEGER NOT NULL PRIMARY KEY,\n PRIMARY KEY (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (playlist_id) REFERENCES playlists(id)\n);", "role": "user" }, { "content": "SELECT title FROM albums;", "role": "assistant" } ]
store_1
[ { "content": "Translate the following question to SQL: List every album ordered by album title in ascending order.\n\nSchema: CREATE TABLE artists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE albums (\n id INTEGER PRIMARY KEY,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (artist_id) REFERENCES artists(id)\n);\n\nCREATE TABLE employees (\n id INTEGER PRIMARY KEY,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n UNIQUE (id),\n FOREIGN KEY (reports_to) REFERENCES employees(id)\n);\n\nCREATE TABLE customers (\n id INTEGER PRIMARY KEY,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n UNIQUE (id),\n FOREIGN KEY (support_rep_id) REFERENCES employees(id)\n);\n\nCREATE TABLE genres (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE invoices (\n id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (customer_id) REFERENCES customers(id)\n);\n\nCREATE TABLE media_types (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE tracks (\n id INTEGER PRIMARY KEY,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (media_type_id) REFERENCES media_types(id),\n FOREIGN KEY (genre_id) REFERENCES genres(id),\n FOREIGN KEY (album_id) REFERENCES albums(id)\n);\n\nCREATE TABLE invoice_lines (\n id INTEGER PRIMARY KEY,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (invoice_id) REFERENCES invoices(id)\n);\n\nCREATE TABLE playlists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE playlist_tracks (\n playlist_id INTEGER NOT NULL PRIMARY KEY,\n track_id INTEGER NOT NULL PRIMARY KEY,\n PRIMARY KEY (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (playlist_id) REFERENCES playlists(id)\n);", "role": "user" }, { "content": "SELECT title FROM albums ORDER BY title;", "role": "assistant" } ]
store_1
[ { "content": "Translate the following question to SQL: What are the titles of all the albums alphabetically ascending?\n\nSchema: CREATE TABLE artists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE albums (\n id INTEGER PRIMARY KEY,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (artist_id) REFERENCES artists(id)\n);\n\nCREATE TABLE employees (\n id INTEGER PRIMARY KEY,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n UNIQUE (id),\n FOREIGN KEY (reports_to) REFERENCES employees(id)\n);\n\nCREATE TABLE customers (\n id INTEGER PRIMARY KEY,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n UNIQUE (id),\n FOREIGN KEY (support_rep_id) REFERENCES employees(id)\n);\n\nCREATE TABLE genres (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE invoices (\n id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (customer_id) REFERENCES customers(id)\n);\n\nCREATE TABLE media_types (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE tracks (\n id INTEGER PRIMARY KEY,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (media_type_id) REFERENCES media_types(id),\n FOREIGN KEY (genre_id) REFERENCES genres(id),\n FOREIGN KEY (album_id) REFERENCES albums(id)\n);\n\nCREATE TABLE invoice_lines (\n id INTEGER PRIMARY KEY,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (invoice_id) REFERENCES invoices(id)\n);\n\nCREATE TABLE playlists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE playlist_tracks (\n playlist_id INTEGER NOT NULL PRIMARY KEY,\n track_id INTEGER NOT NULL PRIMARY KEY,\n PRIMARY KEY (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (playlist_id) REFERENCES playlists(id)\n);", "role": "user" }, { "content": "SELECT title FROM albums ORDER BY title;", "role": "assistant" } ]
store_1
[ { "content": "Translate the following question to SQL: List every album whose title starts with A in alphabetical order.\n\nSchema: CREATE TABLE artists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE albums (\n id INTEGER PRIMARY KEY,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (artist_id) REFERENCES artists(id)\n);\n\nCREATE TABLE employees (\n id INTEGER PRIMARY KEY,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n UNIQUE (id),\n FOREIGN KEY (reports_to) REFERENCES employees(id)\n);\n\nCREATE TABLE customers (\n id INTEGER PRIMARY KEY,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n UNIQUE (id),\n FOREIGN KEY (support_rep_id) REFERENCES employees(id)\n);\n\nCREATE TABLE genres (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE invoices (\n id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (customer_id) REFERENCES customers(id)\n);\n\nCREATE TABLE media_types (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE tracks (\n id INTEGER PRIMARY KEY,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (media_type_id) REFERENCES media_types(id),\n FOREIGN KEY (genre_id) REFERENCES genres(id),\n FOREIGN KEY (album_id) REFERENCES albums(id)\n);\n\nCREATE TABLE invoice_lines (\n id INTEGER PRIMARY KEY,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (invoice_id) REFERENCES invoices(id)\n);\n\nCREATE TABLE playlists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE playlist_tracks (\n playlist_id INTEGER NOT NULL PRIMARY KEY,\n track_id INTEGER NOT NULL PRIMARY KEY,\n PRIMARY KEY (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (playlist_id) REFERENCES playlists(id)\n);", "role": "user" }, { "content": "SELECT title FROM albums WHERE title LIKE 'A%' ORDER BY title;", "role": "assistant" } ]
store_1
[ { "content": "Translate the following question to SQL: What are the titles of all albums that start with A in alphabetical order?\n\nSchema: CREATE TABLE artists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE albums (\n id INTEGER PRIMARY KEY,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (artist_id) REFERENCES artists(id)\n);\n\nCREATE TABLE employees (\n id INTEGER PRIMARY KEY,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n UNIQUE (id),\n FOREIGN KEY (reports_to) REFERENCES employees(id)\n);\n\nCREATE TABLE customers (\n id INTEGER PRIMARY KEY,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n UNIQUE (id),\n FOREIGN KEY (support_rep_id) REFERENCES employees(id)\n);\n\nCREATE TABLE genres (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE invoices (\n id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (customer_id) REFERENCES customers(id)\n);\n\nCREATE TABLE media_types (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE tracks (\n id INTEGER PRIMARY KEY,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (media_type_id) REFERENCES media_types(id),\n FOREIGN KEY (genre_id) REFERENCES genres(id),\n FOREIGN KEY (album_id) REFERENCES albums(id)\n);\n\nCREATE TABLE invoice_lines (\n id INTEGER PRIMARY KEY,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (invoice_id) REFERENCES invoices(id)\n);\n\nCREATE TABLE playlists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE playlist_tracks (\n playlist_id INTEGER NOT NULL PRIMARY KEY,\n track_id INTEGER NOT NULL PRIMARY KEY,\n PRIMARY KEY (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (playlist_id) REFERENCES playlists(id)\n);", "role": "user" }, { "content": "SELECT title FROM albums WHERE title LIKE 'A%' ORDER BY title;", "role": "assistant" } ]
store_1
[ { "content": "Translate the following question to SQL: List the customers first and last name of 10 least expensive invoices.\n\nSchema: CREATE TABLE artists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE albums (\n id INTEGER PRIMARY KEY,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (artist_id) REFERENCES artists(id)\n);\n\nCREATE TABLE employees (\n id INTEGER PRIMARY KEY,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n UNIQUE (id),\n FOREIGN KEY (reports_to) REFERENCES employees(id)\n);\n\nCREATE TABLE customers (\n id INTEGER PRIMARY KEY,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n UNIQUE (id),\n FOREIGN KEY (support_rep_id) REFERENCES employees(id)\n);\n\nCREATE TABLE genres (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE invoices (\n id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (customer_id) REFERENCES customers(id)\n);\n\nCREATE TABLE media_types (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE tracks (\n id INTEGER PRIMARY KEY,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (media_type_id) REFERENCES media_types(id),\n FOREIGN KEY (genre_id) REFERENCES genres(id),\n FOREIGN KEY (album_id) REFERENCES albums(id)\n);\n\nCREATE TABLE invoice_lines (\n id INTEGER PRIMARY KEY,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (invoice_id) REFERENCES invoices(id)\n);\n\nCREATE TABLE playlists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE playlist_tracks (\n playlist_id INTEGER NOT NULL PRIMARY KEY,\n track_id INTEGER NOT NULL PRIMARY KEY,\n PRIMARY KEY (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (playlist_id) REFERENCES playlists(id)\n);", "role": "user" }, { "content": "SELECT T1.first_name , T1.last_name FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id = T1.id ORDER BY total LIMIT 10;", "role": "assistant" } ]
store_1
[ { "content": "Translate the following question to SQL: What are the first and last names of the customers with the 10 cheapest invoices?\n\nSchema: CREATE TABLE artists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE albums (\n id INTEGER PRIMARY KEY,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (artist_id) REFERENCES artists(id)\n);\n\nCREATE TABLE employees (\n id INTEGER PRIMARY KEY,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n UNIQUE (id),\n FOREIGN KEY (reports_to) REFERENCES employees(id)\n);\n\nCREATE TABLE customers (\n id INTEGER PRIMARY KEY,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n UNIQUE (id),\n FOREIGN KEY (support_rep_id) REFERENCES employees(id)\n);\n\nCREATE TABLE genres (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE invoices (\n id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (customer_id) REFERENCES customers(id)\n);\n\nCREATE TABLE media_types (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE tracks (\n id INTEGER PRIMARY KEY,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (media_type_id) REFERENCES media_types(id),\n FOREIGN KEY (genre_id) REFERENCES genres(id),\n FOREIGN KEY (album_id) REFERENCES albums(id)\n);\n\nCREATE TABLE invoice_lines (\n id INTEGER PRIMARY KEY,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (invoice_id) REFERENCES invoices(id)\n);\n\nCREATE TABLE playlists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE playlist_tracks (\n playlist_id INTEGER NOT NULL PRIMARY KEY,\n track_id INTEGER NOT NULL PRIMARY KEY,\n PRIMARY KEY (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (playlist_id) REFERENCES playlists(id)\n);", "role": "user" }, { "content": "SELECT T1.first_name , T1.last_name FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id = T1.id ORDER BY total LIMIT 10;", "role": "assistant" } ]
store_1
[ { "content": "Translate the following question to SQL: List total amount of invoice from Chicago, IL.\n\nSchema: CREATE TABLE artists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE albums (\n id INTEGER PRIMARY KEY,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (artist_id) REFERENCES artists(id)\n);\n\nCREATE TABLE employees (\n id INTEGER PRIMARY KEY,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n UNIQUE (id),\n FOREIGN KEY (reports_to) REFERENCES employees(id)\n);\n\nCREATE TABLE customers (\n id INTEGER PRIMARY KEY,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n UNIQUE (id),\n FOREIGN KEY (support_rep_id) REFERENCES employees(id)\n);\n\nCREATE TABLE genres (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE invoices (\n id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (customer_id) REFERENCES customers(id)\n);\n\nCREATE TABLE media_types (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE tracks (\n id INTEGER PRIMARY KEY,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (media_type_id) REFERENCES media_types(id),\n FOREIGN KEY (genre_id) REFERENCES genres(id),\n FOREIGN KEY (album_id) REFERENCES albums(id)\n);\n\nCREATE TABLE invoice_lines (\n id INTEGER PRIMARY KEY,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (invoice_id) REFERENCES invoices(id)\n);\n\nCREATE TABLE playlists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE playlist_tracks (\n playlist_id INTEGER NOT NULL PRIMARY KEY,\n track_id INTEGER NOT NULL PRIMARY KEY,\n PRIMARY KEY (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (playlist_id) REFERENCES playlists(id)\n);", "role": "user" }, { "content": "SELECT sum(total) FROM invoices WHERE billing_city = \"Chicago\" AND billing_state = \"IL\";", "role": "assistant" } ]
store_1
[ { "content": "Translate the following question to SQL: What are the total amount of money in the invoices billed from Chicago, Illinois?\n\nSchema: CREATE TABLE artists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE albums (\n id INTEGER PRIMARY KEY,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (artist_id) REFERENCES artists(id)\n);\n\nCREATE TABLE employees (\n id INTEGER PRIMARY KEY,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n UNIQUE (id),\n FOREIGN KEY (reports_to) REFERENCES employees(id)\n);\n\nCREATE TABLE customers (\n id INTEGER PRIMARY KEY,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n UNIQUE (id),\n FOREIGN KEY (support_rep_id) REFERENCES employees(id)\n);\n\nCREATE TABLE genres (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE invoices (\n id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (customer_id) REFERENCES customers(id)\n);\n\nCREATE TABLE media_types (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE tracks (\n id INTEGER PRIMARY KEY,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (media_type_id) REFERENCES media_types(id),\n FOREIGN KEY (genre_id) REFERENCES genres(id),\n FOREIGN KEY (album_id) REFERENCES albums(id)\n);\n\nCREATE TABLE invoice_lines (\n id INTEGER PRIMARY KEY,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (invoice_id) REFERENCES invoices(id)\n);\n\nCREATE TABLE playlists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE playlist_tracks (\n playlist_id INTEGER NOT NULL PRIMARY KEY,\n track_id INTEGER NOT NULL PRIMARY KEY,\n PRIMARY KEY (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (playlist_id) REFERENCES playlists(id)\n);", "role": "user" }, { "content": "SELECT sum(total) FROM invoices WHERE billing_city = \"Chicago\" AND billing_state = \"IL\";", "role": "assistant" } ]
store_1
[ { "content": "Translate the following question to SQL: List the number of invoices from Chicago, IL.\n\nSchema: CREATE TABLE artists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE albums (\n id INTEGER PRIMARY KEY,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (artist_id) REFERENCES artists(id)\n);\n\nCREATE TABLE employees (\n id INTEGER PRIMARY KEY,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n UNIQUE (id),\n FOREIGN KEY (reports_to) REFERENCES employees(id)\n);\n\nCREATE TABLE customers (\n id INTEGER PRIMARY KEY,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n UNIQUE (id),\n FOREIGN KEY (support_rep_id) REFERENCES employees(id)\n);\n\nCREATE TABLE genres (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE invoices (\n id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (customer_id) REFERENCES customers(id)\n);\n\nCREATE TABLE media_types (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE tracks (\n id INTEGER PRIMARY KEY,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (media_type_id) REFERENCES media_types(id),\n FOREIGN KEY (genre_id) REFERENCES genres(id),\n FOREIGN KEY (album_id) REFERENCES albums(id)\n);\n\nCREATE TABLE invoice_lines (\n id INTEGER PRIMARY KEY,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (invoice_id) REFERENCES invoices(id)\n);\n\nCREATE TABLE playlists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE playlist_tracks (\n playlist_id INTEGER NOT NULL PRIMARY KEY,\n track_id INTEGER NOT NULL PRIMARY KEY,\n PRIMARY KEY (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (playlist_id) REFERENCES playlists(id)\n);", "role": "user" }, { "content": "SELECT COUNT(*) FROM invoices WHERE billing_city = \"Chicago\" AND billing_state = \"IL\";", "role": "assistant" } ]
store_1
[ { "content": "Translate the following question to SQL: How many invoices were billed from Chicago, IL?\n\nSchema: CREATE TABLE artists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE albums (\n id INTEGER PRIMARY KEY,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (artist_id) REFERENCES artists(id)\n);\n\nCREATE TABLE employees (\n id INTEGER PRIMARY KEY,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n UNIQUE (id),\n FOREIGN KEY (reports_to) REFERENCES employees(id)\n);\n\nCREATE TABLE customers (\n id INTEGER PRIMARY KEY,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n UNIQUE (id),\n FOREIGN KEY (support_rep_id) REFERENCES employees(id)\n);\n\nCREATE TABLE genres (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE invoices (\n id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (customer_id) REFERENCES customers(id)\n);\n\nCREATE TABLE media_types (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE tracks (\n id INTEGER PRIMARY KEY,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (media_type_id) REFERENCES media_types(id),\n FOREIGN KEY (genre_id) REFERENCES genres(id),\n FOREIGN KEY (album_id) REFERENCES albums(id)\n);\n\nCREATE TABLE invoice_lines (\n id INTEGER PRIMARY KEY,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (invoice_id) REFERENCES invoices(id)\n);\n\nCREATE TABLE playlists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE playlist_tracks (\n playlist_id INTEGER NOT NULL PRIMARY KEY,\n track_id INTEGER NOT NULL PRIMARY KEY,\n PRIMARY KEY (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (playlist_id) REFERENCES playlists(id)\n);", "role": "user" }, { "content": "SELECT COUNT(*) FROM invoices WHERE billing_city = \"Chicago\" AND billing_state = \"IL\";", "role": "assistant" } ]
store_1
[ { "content": "Translate the following question to SQL: List the number of invoices from the US, grouped by state.\n\nSchema: CREATE TABLE artists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE albums (\n id INTEGER PRIMARY KEY,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (artist_id) REFERENCES artists(id)\n);\n\nCREATE TABLE employees (\n id INTEGER PRIMARY KEY,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n UNIQUE (id),\n FOREIGN KEY (reports_to) REFERENCES employees(id)\n);\n\nCREATE TABLE customers (\n id INTEGER PRIMARY KEY,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n UNIQUE (id),\n FOREIGN KEY (support_rep_id) REFERENCES employees(id)\n);\n\nCREATE TABLE genres (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE invoices (\n id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (customer_id) REFERENCES customers(id)\n);\n\nCREATE TABLE media_types (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE tracks (\n id INTEGER PRIMARY KEY,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (media_type_id) REFERENCES media_types(id),\n FOREIGN KEY (genre_id) REFERENCES genres(id),\n FOREIGN KEY (album_id) REFERENCES albums(id)\n);\n\nCREATE TABLE invoice_lines (\n id INTEGER PRIMARY KEY,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (invoice_id) REFERENCES invoices(id)\n);\n\nCREATE TABLE playlists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE playlist_tracks (\n playlist_id INTEGER NOT NULL PRIMARY KEY,\n track_id INTEGER NOT NULL PRIMARY KEY,\n PRIMARY KEY (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (playlist_id) REFERENCES playlists(id)\n);", "role": "user" }, { "content": "SELECT billing_state , COUNT(*) FROM invoices WHERE billing_country = \"USA\" GROUP BY billing_state;", "role": "assistant" } ]
store_1
[ { "content": "Translate the following question to SQL: How many invoices were billed from each state?\n\nSchema: CREATE TABLE artists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE albums (\n id INTEGER PRIMARY KEY,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (artist_id) REFERENCES artists(id)\n);\n\nCREATE TABLE employees (\n id INTEGER PRIMARY KEY,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n UNIQUE (id),\n FOREIGN KEY (reports_to) REFERENCES employees(id)\n);\n\nCREATE TABLE customers (\n id INTEGER PRIMARY KEY,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n UNIQUE (id),\n FOREIGN KEY (support_rep_id) REFERENCES employees(id)\n);\n\nCREATE TABLE genres (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE invoices (\n id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (customer_id) REFERENCES customers(id)\n);\n\nCREATE TABLE media_types (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE tracks (\n id INTEGER PRIMARY KEY,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (media_type_id) REFERENCES media_types(id),\n FOREIGN KEY (genre_id) REFERENCES genres(id),\n FOREIGN KEY (album_id) REFERENCES albums(id)\n);\n\nCREATE TABLE invoice_lines (\n id INTEGER PRIMARY KEY,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (invoice_id) REFERENCES invoices(id)\n);\n\nCREATE TABLE playlists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE playlist_tracks (\n playlist_id INTEGER NOT NULL PRIMARY KEY,\n track_id INTEGER NOT NULL PRIMARY KEY,\n PRIMARY KEY (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (playlist_id) REFERENCES playlists(id)\n);", "role": "user" }, { "content": "SELECT billing_state , COUNT(*) FROM invoices WHERE billing_country = \"USA\" GROUP BY billing_state;", "role": "assistant" } ]
store_1
[ { "content": "Translate the following question to SQL: List the state in the US with the most invoices.\n\nSchema: CREATE TABLE artists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE albums (\n id INTEGER PRIMARY KEY,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (artist_id) REFERENCES artists(id)\n);\n\nCREATE TABLE employees (\n id INTEGER PRIMARY KEY,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n UNIQUE (id),\n FOREIGN KEY (reports_to) REFERENCES employees(id)\n);\n\nCREATE TABLE customers (\n id INTEGER PRIMARY KEY,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n UNIQUE (id),\n FOREIGN KEY (support_rep_id) REFERENCES employees(id)\n);\n\nCREATE TABLE genres (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE invoices (\n id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (customer_id) REFERENCES customers(id)\n);\n\nCREATE TABLE media_types (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE tracks (\n id INTEGER PRIMARY KEY,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (media_type_id) REFERENCES media_types(id),\n FOREIGN KEY (genre_id) REFERENCES genres(id),\n FOREIGN KEY (album_id) REFERENCES albums(id)\n);\n\nCREATE TABLE invoice_lines (\n id INTEGER PRIMARY KEY,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (invoice_id) REFERENCES invoices(id)\n);\n\nCREATE TABLE playlists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE playlist_tracks (\n playlist_id INTEGER NOT NULL PRIMARY KEY,\n track_id INTEGER NOT NULL PRIMARY KEY,\n PRIMARY KEY (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (playlist_id) REFERENCES playlists(id)\n);", "role": "user" }, { "content": "SELECT billing_state , COUNT(*) FROM invoices WHERE billing_country = \"USA\" GROUP BY billing_state ORDER BY COUNT(*) DESC LIMIT 1;", "role": "assistant" } ]
store_1
[ { "content": "Translate the following question to SQL: What are the states with the most invoices?\n\nSchema: CREATE TABLE artists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE albums (\n id INTEGER PRIMARY KEY,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (artist_id) REFERENCES artists(id)\n);\n\nCREATE TABLE employees (\n id INTEGER PRIMARY KEY,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n UNIQUE (id),\n FOREIGN KEY (reports_to) REFERENCES employees(id)\n);\n\nCREATE TABLE customers (\n id INTEGER PRIMARY KEY,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n UNIQUE (id),\n FOREIGN KEY (support_rep_id) REFERENCES employees(id)\n);\n\nCREATE TABLE genres (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE invoices (\n id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (customer_id) REFERENCES customers(id)\n);\n\nCREATE TABLE media_types (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE tracks (\n id INTEGER PRIMARY KEY,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (media_type_id) REFERENCES media_types(id),\n FOREIGN KEY (genre_id) REFERENCES genres(id),\n FOREIGN KEY (album_id) REFERENCES albums(id)\n);\n\nCREATE TABLE invoice_lines (\n id INTEGER PRIMARY KEY,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (invoice_id) REFERENCES invoices(id)\n);\n\nCREATE TABLE playlists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE playlist_tracks (\n playlist_id INTEGER NOT NULL PRIMARY KEY,\n track_id INTEGER NOT NULL PRIMARY KEY,\n PRIMARY KEY (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (playlist_id) REFERENCES playlists(id)\n);", "role": "user" }, { "content": "SELECT billing_state , COUNT(*) FROM invoices WHERE billing_country = \"USA\" GROUP BY billing_state ORDER BY COUNT(*) DESC LIMIT 1;", "role": "assistant" } ]
store_1
[ { "content": "Translate the following question to SQL: List the number of invoices and the invoice total from California.\n\nSchema: CREATE TABLE artists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE albums (\n id INTEGER PRIMARY KEY,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (artist_id) REFERENCES artists(id)\n);\n\nCREATE TABLE employees (\n id INTEGER PRIMARY KEY,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n UNIQUE (id),\n FOREIGN KEY (reports_to) REFERENCES employees(id)\n);\n\nCREATE TABLE customers (\n id INTEGER PRIMARY KEY,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n UNIQUE (id),\n FOREIGN KEY (support_rep_id) REFERENCES employees(id)\n);\n\nCREATE TABLE genres (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE invoices (\n id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (customer_id) REFERENCES customers(id)\n);\n\nCREATE TABLE media_types (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE tracks (\n id INTEGER PRIMARY KEY,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (media_type_id) REFERENCES media_types(id),\n FOREIGN KEY (genre_id) REFERENCES genres(id),\n FOREIGN KEY (album_id) REFERENCES albums(id)\n);\n\nCREATE TABLE invoice_lines (\n id INTEGER PRIMARY KEY,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (invoice_id) REFERENCES invoices(id)\n);\n\nCREATE TABLE playlists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE playlist_tracks (\n playlist_id INTEGER NOT NULL PRIMARY KEY,\n track_id INTEGER NOT NULL PRIMARY KEY,\n PRIMARY KEY (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (playlist_id) REFERENCES playlists(id)\n);", "role": "user" }, { "content": "SELECT billing_state , COUNT(*) , SUM(total) FROM invoices WHERE billing_state = \"CA\";", "role": "assistant" } ]
store_1
[ { "content": "Translate the following question to SQL: What is the number of invoices and total money billed in them from CA?\n\nSchema: CREATE TABLE artists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE albums (\n id INTEGER PRIMARY KEY,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (artist_id) REFERENCES artists(id)\n);\n\nCREATE TABLE employees (\n id INTEGER PRIMARY KEY,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n UNIQUE (id),\n FOREIGN KEY (reports_to) REFERENCES employees(id)\n);\n\nCREATE TABLE customers (\n id INTEGER PRIMARY KEY,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n UNIQUE (id),\n FOREIGN KEY (support_rep_id) REFERENCES employees(id)\n);\n\nCREATE TABLE genres (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE invoices (\n id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (customer_id) REFERENCES customers(id)\n);\n\nCREATE TABLE media_types (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE tracks (\n id INTEGER PRIMARY KEY,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (media_type_id) REFERENCES media_types(id),\n FOREIGN KEY (genre_id) REFERENCES genres(id),\n FOREIGN KEY (album_id) REFERENCES albums(id)\n);\n\nCREATE TABLE invoice_lines (\n id INTEGER PRIMARY KEY,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (invoice_id) REFERENCES invoices(id)\n);\n\nCREATE TABLE playlists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE playlist_tracks (\n playlist_id INTEGER NOT NULL PRIMARY KEY,\n track_id INTEGER NOT NULL PRIMARY KEY,\n PRIMARY KEY (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (playlist_id) REFERENCES playlists(id)\n);", "role": "user" }, { "content": "SELECT billing_state , COUNT(*) , SUM(total) FROM invoices WHERE billing_state = \"CA\";", "role": "assistant" } ]
store_1
[ { "content": "Translate the following question to SQL: List Aerosmith's albums.\n\nSchema: CREATE TABLE artists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE albums (\n id INTEGER PRIMARY KEY,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (artist_id) REFERENCES artists(id)\n);\n\nCREATE TABLE employees (\n id INTEGER PRIMARY KEY,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n UNIQUE (id),\n FOREIGN KEY (reports_to) REFERENCES employees(id)\n);\n\nCREATE TABLE customers (\n id INTEGER PRIMARY KEY,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n UNIQUE (id),\n FOREIGN KEY (support_rep_id) REFERENCES employees(id)\n);\n\nCREATE TABLE genres (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE invoices (\n id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (customer_id) REFERENCES customers(id)\n);\n\nCREATE TABLE media_types (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE tracks (\n id INTEGER PRIMARY KEY,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (media_type_id) REFERENCES media_types(id),\n FOREIGN KEY (genre_id) REFERENCES genres(id),\n FOREIGN KEY (album_id) REFERENCES albums(id)\n);\n\nCREATE TABLE invoice_lines (\n id INTEGER PRIMARY KEY,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (invoice_id) REFERENCES invoices(id)\n);\n\nCREATE TABLE playlists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE playlist_tracks (\n playlist_id INTEGER NOT NULL PRIMARY KEY,\n track_id INTEGER NOT NULL PRIMARY KEY,\n PRIMARY KEY (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (playlist_id) REFERENCES playlists(id)\n);", "role": "user" }, { "content": "SELECT T1.title FROM albums AS T1 JOIN artists AS T2 ON T1.artist_id = T2.id WHERE T2.name = \"Aerosmith\";", "role": "assistant" } ]
store_1
[ { "content": "Translate the following question to SQL: What are the titles of all the Aerosmith albums?\n\nSchema: CREATE TABLE artists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE albums (\n id INTEGER PRIMARY KEY,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (artist_id) REFERENCES artists(id)\n);\n\nCREATE TABLE employees (\n id INTEGER PRIMARY KEY,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n UNIQUE (id),\n FOREIGN KEY (reports_to) REFERENCES employees(id)\n);\n\nCREATE TABLE customers (\n id INTEGER PRIMARY KEY,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n UNIQUE (id),\n FOREIGN KEY (support_rep_id) REFERENCES employees(id)\n);\n\nCREATE TABLE genres (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE invoices (\n id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (customer_id) REFERENCES customers(id)\n);\n\nCREATE TABLE media_types (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE tracks (\n id INTEGER PRIMARY KEY,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (media_type_id) REFERENCES media_types(id),\n FOREIGN KEY (genre_id) REFERENCES genres(id),\n FOREIGN KEY (album_id) REFERENCES albums(id)\n);\n\nCREATE TABLE invoice_lines (\n id INTEGER PRIMARY KEY,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (invoice_id) REFERENCES invoices(id)\n);\n\nCREATE TABLE playlists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE playlist_tracks (\n playlist_id INTEGER NOT NULL PRIMARY KEY,\n track_id INTEGER NOT NULL PRIMARY KEY,\n PRIMARY KEY (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (playlist_id) REFERENCES playlists(id)\n);", "role": "user" }, { "content": "SELECT T1.title FROM albums AS T1 JOIN artists AS T2 ON T1.artist_id = T2.id WHERE T2.name = \"Aerosmith\";", "role": "assistant" } ]
store_1
[ { "content": "Translate the following question to SQL: How many albums does Billy Cobham has?\n\nSchema: CREATE TABLE artists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE albums (\n id INTEGER PRIMARY KEY,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (artist_id) REFERENCES artists(id)\n);\n\nCREATE TABLE employees (\n id INTEGER PRIMARY KEY,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n UNIQUE (id),\n FOREIGN KEY (reports_to) REFERENCES employees(id)\n);\n\nCREATE TABLE customers (\n id INTEGER PRIMARY KEY,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n UNIQUE (id),\n FOREIGN KEY (support_rep_id) REFERENCES employees(id)\n);\n\nCREATE TABLE genres (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE invoices (\n id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (customer_id) REFERENCES customers(id)\n);\n\nCREATE TABLE media_types (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE tracks (\n id INTEGER PRIMARY KEY,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (media_type_id) REFERENCES media_types(id),\n FOREIGN KEY (genre_id) REFERENCES genres(id),\n FOREIGN KEY (album_id) REFERENCES albums(id)\n);\n\nCREATE TABLE invoice_lines (\n id INTEGER PRIMARY KEY,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (invoice_id) REFERENCES invoices(id)\n);\n\nCREATE TABLE playlists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE playlist_tracks (\n playlist_id INTEGER NOT NULL PRIMARY KEY,\n track_id INTEGER NOT NULL PRIMARY KEY,\n PRIMARY KEY (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (playlist_id) REFERENCES playlists(id)\n);", "role": "user" }, { "content": "SELECT count(*) FROM albums AS T1 JOIN artists AS T2 ON T1.artist_id = T2.id WHERE T2.name = \"Billy Cobham\";", "role": "assistant" } ]
store_1
[ { "content": "Translate the following question to SQL: How many albums has Billy Cobam released?\n\nSchema: CREATE TABLE artists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE albums (\n id INTEGER PRIMARY KEY,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (artist_id) REFERENCES artists(id)\n);\n\nCREATE TABLE employees (\n id INTEGER PRIMARY KEY,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n UNIQUE (id),\n FOREIGN KEY (reports_to) REFERENCES employees(id)\n);\n\nCREATE TABLE customers (\n id INTEGER PRIMARY KEY,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n UNIQUE (id),\n FOREIGN KEY (support_rep_id) REFERENCES employees(id)\n);\n\nCREATE TABLE genres (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE invoices (\n id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (customer_id) REFERENCES customers(id)\n);\n\nCREATE TABLE media_types (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE tracks (\n id INTEGER PRIMARY KEY,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (media_type_id) REFERENCES media_types(id),\n FOREIGN KEY (genre_id) REFERENCES genres(id),\n FOREIGN KEY (album_id) REFERENCES albums(id)\n);\n\nCREATE TABLE invoice_lines (\n id INTEGER PRIMARY KEY,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (invoice_id) REFERENCES invoices(id)\n);\n\nCREATE TABLE playlists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE playlist_tracks (\n playlist_id INTEGER NOT NULL PRIMARY KEY,\n track_id INTEGER NOT NULL PRIMARY KEY,\n PRIMARY KEY (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (playlist_id) REFERENCES playlists(id)\n);", "role": "user" }, { "content": "SELECT count(*) FROM albums AS T1 JOIN artists AS T2 ON T1.artist_id = T2.id WHERE T2.name = \"Billy Cobham\";", "role": "assistant" } ]
store_1
[ { "content": "Translate the following question to SQL: Eduardo Martins is a customer at which company?\n\nSchema: CREATE TABLE artists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE albums (\n id INTEGER PRIMARY KEY,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (artist_id) REFERENCES artists(id)\n);\n\nCREATE TABLE employees (\n id INTEGER PRIMARY KEY,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n UNIQUE (id),\n FOREIGN KEY (reports_to) REFERENCES employees(id)\n);\n\nCREATE TABLE customers (\n id INTEGER PRIMARY KEY,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n UNIQUE (id),\n FOREIGN KEY (support_rep_id) REFERENCES employees(id)\n);\n\nCREATE TABLE genres (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE invoices (\n id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (customer_id) REFERENCES customers(id)\n);\n\nCREATE TABLE media_types (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE tracks (\n id INTEGER PRIMARY KEY,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (media_type_id) REFERENCES media_types(id),\n FOREIGN KEY (genre_id) REFERENCES genres(id),\n FOREIGN KEY (album_id) REFERENCES albums(id)\n);\n\nCREATE TABLE invoice_lines (\n id INTEGER PRIMARY KEY,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (invoice_id) REFERENCES invoices(id)\n);\n\nCREATE TABLE playlists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE playlist_tracks (\n playlist_id INTEGER NOT NULL PRIMARY KEY,\n track_id INTEGER NOT NULL PRIMARY KEY,\n PRIMARY KEY (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (playlist_id) REFERENCES playlists(id)\n);", "role": "user" }, { "content": "SELECT company FROM customers WHERE first_name = \"Eduardo\" AND last_name = \"Martins\";", "role": "assistant" } ]
store_1
[ { "content": "Translate the following question to SQL: What is the company where Eduardo Martins is a customer?\n\nSchema: CREATE TABLE artists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE albums (\n id INTEGER PRIMARY KEY,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (artist_id) REFERENCES artists(id)\n);\n\nCREATE TABLE employees (\n id INTEGER PRIMARY KEY,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n UNIQUE (id),\n FOREIGN KEY (reports_to) REFERENCES employees(id)\n);\n\nCREATE TABLE customers (\n id INTEGER PRIMARY KEY,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n UNIQUE (id),\n FOREIGN KEY (support_rep_id) REFERENCES employees(id)\n);\n\nCREATE TABLE genres (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE invoices (\n id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (customer_id) REFERENCES customers(id)\n);\n\nCREATE TABLE media_types (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE tracks (\n id INTEGER PRIMARY KEY,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (media_type_id) REFERENCES media_types(id),\n FOREIGN KEY (genre_id) REFERENCES genres(id),\n FOREIGN KEY (album_id) REFERENCES albums(id)\n);\n\nCREATE TABLE invoice_lines (\n id INTEGER PRIMARY KEY,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (invoice_id) REFERENCES invoices(id)\n);\n\nCREATE TABLE playlists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE playlist_tracks (\n playlist_id INTEGER NOT NULL PRIMARY KEY,\n track_id INTEGER NOT NULL PRIMARY KEY,\n PRIMARY KEY (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (playlist_id) REFERENCES playlists(id)\n);", "role": "user" }, { "content": "SELECT company FROM customers WHERE first_name = \"Eduardo\" AND last_name = \"Martins\";", "role": "assistant" } ]
store_1
[ { "content": "Translate the following question to SQL: What is Astrid Gruber's email and phone number?\n\nSchema: CREATE TABLE artists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE albums (\n id INTEGER PRIMARY KEY,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (artist_id) REFERENCES artists(id)\n);\n\nCREATE TABLE employees (\n id INTEGER PRIMARY KEY,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n UNIQUE (id),\n FOREIGN KEY (reports_to) REFERENCES employees(id)\n);\n\nCREATE TABLE customers (\n id INTEGER PRIMARY KEY,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n UNIQUE (id),\n FOREIGN KEY (support_rep_id) REFERENCES employees(id)\n);\n\nCREATE TABLE genres (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE invoices (\n id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (customer_id) REFERENCES customers(id)\n);\n\nCREATE TABLE media_types (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE tracks (\n id INTEGER PRIMARY KEY,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (media_type_id) REFERENCES media_types(id),\n FOREIGN KEY (genre_id) REFERENCES genres(id),\n FOREIGN KEY (album_id) REFERENCES albums(id)\n);\n\nCREATE TABLE invoice_lines (\n id INTEGER PRIMARY KEY,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (invoice_id) REFERENCES invoices(id)\n);\n\nCREATE TABLE playlists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE playlist_tracks (\n playlist_id INTEGER NOT NULL PRIMARY KEY,\n track_id INTEGER NOT NULL PRIMARY KEY,\n PRIMARY KEY (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (playlist_id) REFERENCES playlists(id)\n);", "role": "user" }, { "content": "SELECT email , phone FROM customers WHERE first_name = \"Astrid\" AND last_name = \"Gruber\";", "role": "assistant" } ]
store_1
[ { "content": "Translate the following question to SQL: What is the email and phone number of Astrid Gruber the customer?\n\nSchema: CREATE TABLE artists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE albums (\n id INTEGER PRIMARY KEY,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (artist_id) REFERENCES artists(id)\n);\n\nCREATE TABLE employees (\n id INTEGER PRIMARY KEY,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n UNIQUE (id),\n FOREIGN KEY (reports_to) REFERENCES employees(id)\n);\n\nCREATE TABLE customers (\n id INTEGER PRIMARY KEY,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n UNIQUE (id),\n FOREIGN KEY (support_rep_id) REFERENCES employees(id)\n);\n\nCREATE TABLE genres (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE invoices (\n id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (customer_id) REFERENCES customers(id)\n);\n\nCREATE TABLE media_types (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE tracks (\n id INTEGER PRIMARY KEY,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (media_type_id) REFERENCES media_types(id),\n FOREIGN KEY (genre_id) REFERENCES genres(id),\n FOREIGN KEY (album_id) REFERENCES albums(id)\n);\n\nCREATE TABLE invoice_lines (\n id INTEGER PRIMARY KEY,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (invoice_id) REFERENCES invoices(id)\n);\n\nCREATE TABLE playlists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE playlist_tracks (\n playlist_id INTEGER NOT NULL PRIMARY KEY,\n track_id INTEGER NOT NULL PRIMARY KEY,\n PRIMARY KEY (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (playlist_id) REFERENCES playlists(id)\n);", "role": "user" }, { "content": "SELECT email , phone FROM customers WHERE first_name = \"Astrid\" AND last_name = \"Gruber\";", "role": "assistant" } ]
store_1
[ { "content": "Translate the following question to SQL: How many customers live in Prague city?\n\nSchema: CREATE TABLE artists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE albums (\n id INTEGER PRIMARY KEY,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (artist_id) REFERENCES artists(id)\n);\n\nCREATE TABLE employees (\n id INTEGER PRIMARY KEY,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n UNIQUE (id),\n FOREIGN KEY (reports_to) REFERENCES employees(id)\n);\n\nCREATE TABLE customers (\n id INTEGER PRIMARY KEY,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n UNIQUE (id),\n FOREIGN KEY (support_rep_id) REFERENCES employees(id)\n);\n\nCREATE TABLE genres (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE invoices (\n id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (customer_id) REFERENCES customers(id)\n);\n\nCREATE TABLE media_types (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE tracks (\n id INTEGER PRIMARY KEY,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (media_type_id) REFERENCES media_types(id),\n FOREIGN KEY (genre_id) REFERENCES genres(id),\n FOREIGN KEY (album_id) REFERENCES albums(id)\n);\n\nCREATE TABLE invoice_lines (\n id INTEGER PRIMARY KEY,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (invoice_id) REFERENCES invoices(id)\n);\n\nCREATE TABLE playlists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE playlist_tracks (\n playlist_id INTEGER NOT NULL PRIMARY KEY,\n track_id INTEGER NOT NULL PRIMARY KEY,\n PRIMARY KEY (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (playlist_id) REFERENCES playlists(id)\n);", "role": "user" }, { "content": "SELECT count(*) FROM customers WHERE city = \"Prague\";", "role": "assistant" } ]
store_1
[ { "content": "Translate the following question to SQL: How many customers live in the city of Prague?\n\nSchema: CREATE TABLE artists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE albums (\n id INTEGER PRIMARY KEY,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (artist_id) REFERENCES artists(id)\n);\n\nCREATE TABLE employees (\n id INTEGER PRIMARY KEY,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n UNIQUE (id),\n FOREIGN KEY (reports_to) REFERENCES employees(id)\n);\n\nCREATE TABLE customers (\n id INTEGER PRIMARY KEY,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n UNIQUE (id),\n FOREIGN KEY (support_rep_id) REFERENCES employees(id)\n);\n\nCREATE TABLE genres (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE invoices (\n id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (customer_id) REFERENCES customers(id)\n);\n\nCREATE TABLE media_types (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE tracks (\n id INTEGER PRIMARY KEY,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (media_type_id) REFERENCES media_types(id),\n FOREIGN KEY (genre_id) REFERENCES genres(id),\n FOREIGN KEY (album_id) REFERENCES albums(id)\n);\n\nCREATE TABLE invoice_lines (\n id INTEGER PRIMARY KEY,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (invoice_id) REFERENCES invoices(id)\n);\n\nCREATE TABLE playlists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE playlist_tracks (\n playlist_id INTEGER NOT NULL PRIMARY KEY,\n track_id INTEGER NOT NULL PRIMARY KEY,\n PRIMARY KEY (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (playlist_id) REFERENCES playlists(id)\n);", "role": "user" }, { "content": "SELECT count(*) FROM customers WHERE city = \"Prague\";", "role": "assistant" } ]
store_1
[ { "content": "Translate the following question to SQL: How many customers in state of CA?\n\nSchema: CREATE TABLE artists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE albums (\n id INTEGER PRIMARY KEY,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (artist_id) REFERENCES artists(id)\n);\n\nCREATE TABLE employees (\n id INTEGER PRIMARY KEY,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n UNIQUE (id),\n FOREIGN KEY (reports_to) REFERENCES employees(id)\n);\n\nCREATE TABLE customers (\n id INTEGER PRIMARY KEY,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n UNIQUE (id),\n FOREIGN KEY (support_rep_id) REFERENCES employees(id)\n);\n\nCREATE TABLE genres (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE invoices (\n id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (customer_id) REFERENCES customers(id)\n);\n\nCREATE TABLE media_types (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE tracks (\n id INTEGER PRIMARY KEY,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (media_type_id) REFERENCES media_types(id),\n FOREIGN KEY (genre_id) REFERENCES genres(id),\n FOREIGN KEY (album_id) REFERENCES albums(id)\n);\n\nCREATE TABLE invoice_lines (\n id INTEGER PRIMARY KEY,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (invoice_id) REFERENCES invoices(id)\n);\n\nCREATE TABLE playlists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE playlist_tracks (\n playlist_id INTEGER NOT NULL PRIMARY KEY,\n track_id INTEGER NOT NULL PRIMARY KEY,\n PRIMARY KEY (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (playlist_id) REFERENCES playlists(id)\n);", "role": "user" }, { "content": "SELECT count(*) FROM customers WHERE state = \"CA\";", "role": "assistant" } ]
store_1
[ { "content": "Translate the following question to SQL: How many customers are from California?\n\nSchema: CREATE TABLE artists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE albums (\n id INTEGER PRIMARY KEY,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (artist_id) REFERENCES artists(id)\n);\n\nCREATE TABLE employees (\n id INTEGER PRIMARY KEY,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n UNIQUE (id),\n FOREIGN KEY (reports_to) REFERENCES employees(id)\n);\n\nCREATE TABLE customers (\n id INTEGER PRIMARY KEY,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n UNIQUE (id),\n FOREIGN KEY (support_rep_id) REFERENCES employees(id)\n);\n\nCREATE TABLE genres (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE invoices (\n id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (customer_id) REFERENCES customers(id)\n);\n\nCREATE TABLE media_types (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE tracks (\n id INTEGER PRIMARY KEY,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (media_type_id) REFERENCES media_types(id),\n FOREIGN KEY (genre_id) REFERENCES genres(id),\n FOREIGN KEY (album_id) REFERENCES albums(id)\n);\n\nCREATE TABLE invoice_lines (\n id INTEGER PRIMARY KEY,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (invoice_id) REFERENCES invoices(id)\n);\n\nCREATE TABLE playlists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE playlist_tracks (\n playlist_id INTEGER NOT NULL PRIMARY KEY,\n track_id INTEGER NOT NULL PRIMARY KEY,\n PRIMARY KEY (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (playlist_id) REFERENCES playlists(id)\n);", "role": "user" }, { "content": "SELECT count(*) FROM customers WHERE state = \"CA\";", "role": "assistant" } ]
store_1
[ { "content": "Translate the following question to SQL: What country does Roberto Almeida live?\n\nSchema: CREATE TABLE artists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE albums (\n id INTEGER PRIMARY KEY,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (artist_id) REFERENCES artists(id)\n);\n\nCREATE TABLE employees (\n id INTEGER PRIMARY KEY,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n UNIQUE (id),\n FOREIGN KEY (reports_to) REFERENCES employees(id)\n);\n\nCREATE TABLE customers (\n id INTEGER PRIMARY KEY,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n UNIQUE (id),\n FOREIGN KEY (support_rep_id) REFERENCES employees(id)\n);\n\nCREATE TABLE genres (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE invoices (\n id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (customer_id) REFERENCES customers(id)\n);\n\nCREATE TABLE media_types (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE tracks (\n id INTEGER PRIMARY KEY,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (media_type_id) REFERENCES media_types(id),\n FOREIGN KEY (genre_id) REFERENCES genres(id),\n FOREIGN KEY (album_id) REFERENCES albums(id)\n);\n\nCREATE TABLE invoice_lines (\n id INTEGER PRIMARY KEY,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (invoice_id) REFERENCES invoices(id)\n);\n\nCREATE TABLE playlists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE playlist_tracks (\n playlist_id INTEGER NOT NULL PRIMARY KEY,\n track_id INTEGER NOT NULL PRIMARY KEY,\n PRIMARY KEY (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (playlist_id) REFERENCES playlists(id)\n);", "role": "user" }, { "content": "SELECT country FROM customers WHERE first_name = \"Roberto\" AND last_name = \"Almeida\";", "role": "assistant" } ]
store_1
[ { "content": "Translate the following question to SQL: In which country does Roberto Almeida?\n\nSchema: CREATE TABLE artists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE albums (\n id INTEGER PRIMARY KEY,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (artist_id) REFERENCES artists(id)\n);\n\nCREATE TABLE employees (\n id INTEGER PRIMARY KEY,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n UNIQUE (id),\n FOREIGN KEY (reports_to) REFERENCES employees(id)\n);\n\nCREATE TABLE customers (\n id INTEGER PRIMARY KEY,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n UNIQUE (id),\n FOREIGN KEY (support_rep_id) REFERENCES employees(id)\n);\n\nCREATE TABLE genres (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE invoices (\n id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (customer_id) REFERENCES customers(id)\n);\n\nCREATE TABLE media_types (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE tracks (\n id INTEGER PRIMARY KEY,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (media_type_id) REFERENCES media_types(id),\n FOREIGN KEY (genre_id) REFERENCES genres(id),\n FOREIGN KEY (album_id) REFERENCES albums(id)\n);\n\nCREATE TABLE invoice_lines (\n id INTEGER PRIMARY KEY,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (invoice_id) REFERENCES invoices(id)\n);\n\nCREATE TABLE playlists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE playlist_tracks (\n playlist_id INTEGER NOT NULL PRIMARY KEY,\n track_id INTEGER NOT NULL PRIMARY KEY,\n PRIMARY KEY (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (playlist_id) REFERENCES playlists(id)\n);", "role": "user" }, { "content": "SELECT country FROM customers WHERE first_name = \"Roberto\" AND last_name = \"Almeida\";", "role": "assistant" } ]
store_1
[ { "content": "Translate the following question to SQL: List the name of albums that are released by aritist whose name has 'Led'\n\nSchema: CREATE TABLE artists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE albums (\n id INTEGER PRIMARY KEY,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (artist_id) REFERENCES artists(id)\n);\n\nCREATE TABLE employees (\n id INTEGER PRIMARY KEY,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n UNIQUE (id),\n FOREIGN KEY (reports_to) REFERENCES employees(id)\n);\n\nCREATE TABLE customers (\n id INTEGER PRIMARY KEY,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n UNIQUE (id),\n FOREIGN KEY (support_rep_id) REFERENCES employees(id)\n);\n\nCREATE TABLE genres (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE invoices (\n id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (customer_id) REFERENCES customers(id)\n);\n\nCREATE TABLE media_types (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE tracks (\n id INTEGER PRIMARY KEY,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (media_type_id) REFERENCES media_types(id),\n FOREIGN KEY (genre_id) REFERENCES genres(id),\n FOREIGN KEY (album_id) REFERENCES albums(id)\n);\n\nCREATE TABLE invoice_lines (\n id INTEGER PRIMARY KEY,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (invoice_id) REFERENCES invoices(id)\n);\n\nCREATE TABLE playlists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE playlist_tracks (\n playlist_id INTEGER NOT NULL PRIMARY KEY,\n track_id INTEGER NOT NULL PRIMARY KEY,\n PRIMARY KEY (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (playlist_id) REFERENCES playlists(id)\n);", "role": "user" }, { "content": "SELECT T2.title FROM artists AS T1 JOIN albums AS T2 ON T1.id = T2.artist_id WHERE T1.name LIKE '%Led%'", "role": "assistant" } ]
store_1
[ { "content": "Translate the following question to SQL: What is the title of the album that was released by the artist whose name has the phrase 'Led'?\n\nSchema: CREATE TABLE artists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE albums (\n id INTEGER PRIMARY KEY,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (artist_id) REFERENCES artists(id)\n);\n\nCREATE TABLE employees (\n id INTEGER PRIMARY KEY,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n UNIQUE (id),\n FOREIGN KEY (reports_to) REFERENCES employees(id)\n);\n\nCREATE TABLE customers (\n id INTEGER PRIMARY KEY,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n UNIQUE (id),\n FOREIGN KEY (support_rep_id) REFERENCES employees(id)\n);\n\nCREATE TABLE genres (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE invoices (\n id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (customer_id) REFERENCES customers(id)\n);\n\nCREATE TABLE media_types (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE tracks (\n id INTEGER PRIMARY KEY,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (media_type_id) REFERENCES media_types(id),\n FOREIGN KEY (genre_id) REFERENCES genres(id),\n FOREIGN KEY (album_id) REFERENCES albums(id)\n);\n\nCREATE TABLE invoice_lines (\n id INTEGER PRIMARY KEY,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (invoice_id) REFERENCES invoices(id)\n);\n\nCREATE TABLE playlists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE playlist_tracks (\n playlist_id INTEGER NOT NULL PRIMARY KEY,\n track_id INTEGER NOT NULL PRIMARY KEY,\n PRIMARY KEY (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (playlist_id) REFERENCES playlists(id)\n);", "role": "user" }, { "content": "SELECT T2.title FROM artists AS T1 JOIN albums AS T2 ON T1.id = T2.artist_id WHERE T1.name LIKE '%Led%'", "role": "assistant" } ]
store_1
[ { "content": "Translate the following question to SQL: How many customers does Steve Johnson support?\n\nSchema: CREATE TABLE artists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE albums (\n id INTEGER PRIMARY KEY,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (artist_id) REFERENCES artists(id)\n);\n\nCREATE TABLE employees (\n id INTEGER PRIMARY KEY,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n UNIQUE (id),\n FOREIGN KEY (reports_to) REFERENCES employees(id)\n);\n\nCREATE TABLE customers (\n id INTEGER PRIMARY KEY,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n UNIQUE (id),\n FOREIGN KEY (support_rep_id) REFERENCES employees(id)\n);\n\nCREATE TABLE genres (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE invoices (\n id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (customer_id) REFERENCES customers(id)\n);\n\nCREATE TABLE media_types (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE tracks (\n id INTEGER PRIMARY KEY,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (media_type_id) REFERENCES media_types(id),\n FOREIGN KEY (genre_id) REFERENCES genres(id),\n FOREIGN KEY (album_id) REFERENCES albums(id)\n);\n\nCREATE TABLE invoice_lines (\n id INTEGER PRIMARY KEY,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (invoice_id) REFERENCES invoices(id)\n);\n\nCREATE TABLE playlists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE playlist_tracks (\n playlist_id INTEGER NOT NULL PRIMARY KEY,\n track_id INTEGER NOT NULL PRIMARY KEY,\n PRIMARY KEY (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (playlist_id) REFERENCES playlists(id)\n);", "role": "user" }, { "content": "SELECT count(*) FROM employees AS T1 JOIN customers AS T2 ON T2.support_rep_id = T1.id WHERE T1.first_name = \"Steve\" AND T1.last_name = \"Johnson\";", "role": "assistant" } ]
store_1
[ { "content": "Translate the following question to SQL: What is the count of customers that Steve Johnson supports?\n\nSchema: CREATE TABLE artists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE albums (\n id INTEGER PRIMARY KEY,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (artist_id) REFERENCES artists(id)\n);\n\nCREATE TABLE employees (\n id INTEGER PRIMARY KEY,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n UNIQUE (id),\n FOREIGN KEY (reports_to) REFERENCES employees(id)\n);\n\nCREATE TABLE customers (\n id INTEGER PRIMARY KEY,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n UNIQUE (id),\n FOREIGN KEY (support_rep_id) REFERENCES employees(id)\n);\n\nCREATE TABLE genres (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE invoices (\n id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (customer_id) REFERENCES customers(id)\n);\n\nCREATE TABLE media_types (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE tracks (\n id INTEGER PRIMARY KEY,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (media_type_id) REFERENCES media_types(id),\n FOREIGN KEY (genre_id) REFERENCES genres(id),\n FOREIGN KEY (album_id) REFERENCES albums(id)\n);\n\nCREATE TABLE invoice_lines (\n id INTEGER PRIMARY KEY,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (invoice_id) REFERENCES invoices(id)\n);\n\nCREATE TABLE playlists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE playlist_tracks (\n playlist_id INTEGER NOT NULL PRIMARY KEY,\n track_id INTEGER NOT NULL PRIMARY KEY,\n PRIMARY KEY (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (playlist_id) REFERENCES playlists(id)\n);", "role": "user" }, { "content": "SELECT count(*) FROM employees AS T1 JOIN customers AS T2 ON T2.support_rep_id = T1.id WHERE T1.first_name = \"Steve\" AND T1.last_name = \"Johnson\";", "role": "assistant" } ]
store_1
[ { "content": "Translate the following question to SQL: What is the title, phone and hire date of Nancy Edwards?\n\nSchema: CREATE TABLE artists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE albums (\n id INTEGER PRIMARY KEY,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (artist_id) REFERENCES artists(id)\n);\n\nCREATE TABLE employees (\n id INTEGER PRIMARY KEY,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n UNIQUE (id),\n FOREIGN KEY (reports_to) REFERENCES employees(id)\n);\n\nCREATE TABLE customers (\n id INTEGER PRIMARY KEY,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n UNIQUE (id),\n FOREIGN KEY (support_rep_id) REFERENCES employees(id)\n);\n\nCREATE TABLE genres (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE invoices (\n id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (customer_id) REFERENCES customers(id)\n);\n\nCREATE TABLE media_types (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE tracks (\n id INTEGER PRIMARY KEY,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (media_type_id) REFERENCES media_types(id),\n FOREIGN KEY (genre_id) REFERENCES genres(id),\n FOREIGN KEY (album_id) REFERENCES albums(id)\n);\n\nCREATE TABLE invoice_lines (\n id INTEGER PRIMARY KEY,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (invoice_id) REFERENCES invoices(id)\n);\n\nCREATE TABLE playlists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE playlist_tracks (\n playlist_id INTEGER NOT NULL PRIMARY KEY,\n track_id INTEGER NOT NULL PRIMARY KEY,\n PRIMARY KEY (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (playlist_id) REFERENCES playlists(id)\n);", "role": "user" }, { "content": "SELECT title , phone , hire_date FROM employees WHERE first_name = \"Nancy\" AND last_name = \"Edwards\";", "role": "assistant" } ]
store_1
[ { "content": "Translate the following question to SQL: What is the title, phone number and hire date for the employee named Nancy Edwards?\n\nSchema: CREATE TABLE artists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE albums (\n id INTEGER PRIMARY KEY,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (artist_id) REFERENCES artists(id)\n);\n\nCREATE TABLE employees (\n id INTEGER PRIMARY KEY,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n UNIQUE (id),\n FOREIGN KEY (reports_to) REFERENCES employees(id)\n);\n\nCREATE TABLE customers (\n id INTEGER PRIMARY KEY,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n UNIQUE (id),\n FOREIGN KEY (support_rep_id) REFERENCES employees(id)\n);\n\nCREATE TABLE genres (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE invoices (\n id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (customer_id) REFERENCES customers(id)\n);\n\nCREATE TABLE media_types (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE tracks (\n id INTEGER PRIMARY KEY,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (media_type_id) REFERENCES media_types(id),\n FOREIGN KEY (genre_id) REFERENCES genres(id),\n FOREIGN KEY (album_id) REFERENCES albums(id)\n);\n\nCREATE TABLE invoice_lines (\n id INTEGER PRIMARY KEY,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (invoice_id) REFERENCES invoices(id)\n);\n\nCREATE TABLE playlists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE playlist_tracks (\n playlist_id INTEGER NOT NULL PRIMARY KEY,\n track_id INTEGER NOT NULL PRIMARY KEY,\n PRIMARY KEY (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (playlist_id) REFERENCES playlists(id)\n);", "role": "user" }, { "content": "SELECT title , phone , hire_date FROM employees WHERE first_name = \"Nancy\" AND last_name = \"Edwards\";", "role": "assistant" } ]
store_1
[ { "content": "Translate the following question to SQL: find the full name of employees who report to Nancy Edwards?\n\nSchema: CREATE TABLE artists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE albums (\n id INTEGER PRIMARY KEY,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (artist_id) REFERENCES artists(id)\n);\n\nCREATE TABLE employees (\n id INTEGER PRIMARY KEY,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n UNIQUE (id),\n FOREIGN KEY (reports_to) REFERENCES employees(id)\n);\n\nCREATE TABLE customers (\n id INTEGER PRIMARY KEY,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n UNIQUE (id),\n FOREIGN KEY (support_rep_id) REFERENCES employees(id)\n);\n\nCREATE TABLE genres (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE invoices (\n id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (customer_id) REFERENCES customers(id)\n);\n\nCREATE TABLE media_types (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE tracks (\n id INTEGER PRIMARY KEY,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (media_type_id) REFERENCES media_types(id),\n FOREIGN KEY (genre_id) REFERENCES genres(id),\n FOREIGN KEY (album_id) REFERENCES albums(id)\n);\n\nCREATE TABLE invoice_lines (\n id INTEGER PRIMARY KEY,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (invoice_id) REFERENCES invoices(id)\n);\n\nCREATE TABLE playlists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE playlist_tracks (\n playlist_id INTEGER NOT NULL PRIMARY KEY,\n track_id INTEGER NOT NULL PRIMARY KEY,\n PRIMARY KEY (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (playlist_id) REFERENCES playlists(id)\n);", "role": "user" }, { "content": "SELECT T2.first_name , T2.last_name FROM employees AS T1 JOIN employees AS T2 ON T1.id = T2.reports_to WHERE T1.first_name = \"Nancy\" AND T1.last_name = \"Edwards\";", "role": "assistant" } ]
store_1
[ { "content": "Translate the following question to SQL: What is the first and last name of the employee who reports to Nancy Edwards?\n\nSchema: CREATE TABLE artists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE albums (\n id INTEGER PRIMARY KEY,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (artist_id) REFERENCES artists(id)\n);\n\nCREATE TABLE employees (\n id INTEGER PRIMARY KEY,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n UNIQUE (id),\n FOREIGN KEY (reports_to) REFERENCES employees(id)\n);\n\nCREATE TABLE customers (\n id INTEGER PRIMARY KEY,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n UNIQUE (id),\n FOREIGN KEY (support_rep_id) REFERENCES employees(id)\n);\n\nCREATE TABLE genres (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE invoices (\n id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (customer_id) REFERENCES customers(id)\n);\n\nCREATE TABLE media_types (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE tracks (\n id INTEGER PRIMARY KEY,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (media_type_id) REFERENCES media_types(id),\n FOREIGN KEY (genre_id) REFERENCES genres(id),\n FOREIGN KEY (album_id) REFERENCES albums(id)\n);\n\nCREATE TABLE invoice_lines (\n id INTEGER PRIMARY KEY,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (invoice_id) REFERENCES invoices(id)\n);\n\nCREATE TABLE playlists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE playlist_tracks (\n playlist_id INTEGER NOT NULL PRIMARY KEY,\n track_id INTEGER NOT NULL PRIMARY KEY,\n PRIMARY KEY (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (playlist_id) REFERENCES playlists(id)\n);", "role": "user" }, { "content": "SELECT T2.first_name , T2.last_name FROM employees AS T1 JOIN employees AS T2 ON T1.id = T2.reports_to WHERE T1.first_name = \"Nancy\" AND T1.last_name = \"Edwards\";", "role": "assistant" } ]
store_1
[ { "content": "Translate the following question to SQL: What is the address of employee Nancy Edwards?\n\nSchema: CREATE TABLE artists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE albums (\n id INTEGER PRIMARY KEY,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (artist_id) REFERENCES artists(id)\n);\n\nCREATE TABLE employees (\n id INTEGER PRIMARY KEY,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n UNIQUE (id),\n FOREIGN KEY (reports_to) REFERENCES employees(id)\n);\n\nCREATE TABLE customers (\n id INTEGER PRIMARY KEY,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n UNIQUE (id),\n FOREIGN KEY (support_rep_id) REFERENCES employees(id)\n);\n\nCREATE TABLE genres (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE invoices (\n id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (customer_id) REFERENCES customers(id)\n);\n\nCREATE TABLE media_types (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE tracks (\n id INTEGER PRIMARY KEY,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (media_type_id) REFERENCES media_types(id),\n FOREIGN KEY (genre_id) REFERENCES genres(id),\n FOREIGN KEY (album_id) REFERENCES albums(id)\n);\n\nCREATE TABLE invoice_lines (\n id INTEGER PRIMARY KEY,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (invoice_id) REFERENCES invoices(id)\n);\n\nCREATE TABLE playlists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE playlist_tracks (\n playlist_id INTEGER NOT NULL PRIMARY KEY,\n track_id INTEGER NOT NULL PRIMARY KEY,\n PRIMARY KEY (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (playlist_id) REFERENCES playlists(id)\n);", "role": "user" }, { "content": "SELECT address FROM employees WHERE first_name = \"Nancy\" AND last_name = \"Edwards\";", "role": "assistant" } ]
store_1
[ { "content": "Translate the following question to SQL: What is Nancy Edwards's address?\n\nSchema: CREATE TABLE artists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE albums (\n id INTEGER PRIMARY KEY,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (artist_id) REFERENCES artists(id)\n);\n\nCREATE TABLE employees (\n id INTEGER PRIMARY KEY,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n UNIQUE (id),\n FOREIGN KEY (reports_to) REFERENCES employees(id)\n);\n\nCREATE TABLE customers (\n id INTEGER PRIMARY KEY,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n UNIQUE (id),\n FOREIGN KEY (support_rep_id) REFERENCES employees(id)\n);\n\nCREATE TABLE genres (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE invoices (\n id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (customer_id) REFERENCES customers(id)\n);\n\nCREATE TABLE media_types (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE tracks (\n id INTEGER PRIMARY KEY,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (media_type_id) REFERENCES media_types(id),\n FOREIGN KEY (genre_id) REFERENCES genres(id),\n FOREIGN KEY (album_id) REFERENCES albums(id)\n);\n\nCREATE TABLE invoice_lines (\n id INTEGER PRIMARY KEY,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (invoice_id) REFERENCES invoices(id)\n);\n\nCREATE TABLE playlists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE playlist_tracks (\n playlist_id INTEGER NOT NULL PRIMARY KEY,\n track_id INTEGER NOT NULL PRIMARY KEY,\n PRIMARY KEY (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (playlist_id) REFERENCES playlists(id)\n);", "role": "user" }, { "content": "SELECT address FROM employees WHERE first_name = \"Nancy\" AND last_name = \"Edwards\";", "role": "assistant" } ]
store_1
[ { "content": "Translate the following question to SQL: Find the full name of employee who supported the most number of customers.\n\nSchema: CREATE TABLE artists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE albums (\n id INTEGER PRIMARY KEY,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (artist_id) REFERENCES artists(id)\n);\n\nCREATE TABLE employees (\n id INTEGER PRIMARY KEY,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n UNIQUE (id),\n FOREIGN KEY (reports_to) REFERENCES employees(id)\n);\n\nCREATE TABLE customers (\n id INTEGER PRIMARY KEY,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n UNIQUE (id),\n FOREIGN KEY (support_rep_id) REFERENCES employees(id)\n);\n\nCREATE TABLE genres (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE invoices (\n id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (customer_id) REFERENCES customers(id)\n);\n\nCREATE TABLE media_types (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE tracks (\n id INTEGER PRIMARY KEY,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (media_type_id) REFERENCES media_types(id),\n FOREIGN KEY (genre_id) REFERENCES genres(id),\n FOREIGN KEY (album_id) REFERENCES albums(id)\n);\n\nCREATE TABLE invoice_lines (\n id INTEGER PRIMARY KEY,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (invoice_id) REFERENCES invoices(id)\n);\n\nCREATE TABLE playlists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE playlist_tracks (\n playlist_id INTEGER NOT NULL PRIMARY KEY,\n track_id INTEGER NOT NULL PRIMARY KEY,\n PRIMARY KEY (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (playlist_id) REFERENCES playlists(id)\n);", "role": "user" }, { "content": "SELECT T1.first_name , T1.last_name FROM employees AS T1 JOIN customers AS T2 ON T1.id = T2.support_rep_id GROUP BY T1.id ORDER BY count(*) DESC LIMIT 1", "role": "assistant" } ]
store_1
[ { "content": "Translate the following question to SQL: What is the full name of the employee who has the most customers?\n\nSchema: CREATE TABLE artists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE albums (\n id INTEGER PRIMARY KEY,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (artist_id) REFERENCES artists(id)\n);\n\nCREATE TABLE employees (\n id INTEGER PRIMARY KEY,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n UNIQUE (id),\n FOREIGN KEY (reports_to) REFERENCES employees(id)\n);\n\nCREATE TABLE customers (\n id INTEGER PRIMARY KEY,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n UNIQUE (id),\n FOREIGN KEY (support_rep_id) REFERENCES employees(id)\n);\n\nCREATE TABLE genres (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE invoices (\n id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (customer_id) REFERENCES customers(id)\n);\n\nCREATE TABLE media_types (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE tracks (\n id INTEGER PRIMARY KEY,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (media_type_id) REFERENCES media_types(id),\n FOREIGN KEY (genre_id) REFERENCES genres(id),\n FOREIGN KEY (album_id) REFERENCES albums(id)\n);\n\nCREATE TABLE invoice_lines (\n id INTEGER PRIMARY KEY,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (invoice_id) REFERENCES invoices(id)\n);\n\nCREATE TABLE playlists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE playlist_tracks (\n playlist_id INTEGER NOT NULL PRIMARY KEY,\n track_id INTEGER NOT NULL PRIMARY KEY,\n PRIMARY KEY (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (playlist_id) REFERENCES playlists(id)\n);", "role": "user" }, { "content": "SELECT T1.first_name , T1.last_name FROM employees AS T1 JOIN customers AS T2 ON T1.id = T2.support_rep_id GROUP BY T1.id ORDER BY count(*) DESC LIMIT 1", "role": "assistant" } ]
store_1
[ { "content": "Translate the following question to SQL: How many employees are living in Canada?\n\nSchema: CREATE TABLE artists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE albums (\n id INTEGER PRIMARY KEY,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (artist_id) REFERENCES artists(id)\n);\n\nCREATE TABLE employees (\n id INTEGER PRIMARY KEY,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n UNIQUE (id),\n FOREIGN KEY (reports_to) REFERENCES employees(id)\n);\n\nCREATE TABLE customers (\n id INTEGER PRIMARY KEY,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n UNIQUE (id),\n FOREIGN KEY (support_rep_id) REFERENCES employees(id)\n);\n\nCREATE TABLE genres (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE invoices (\n id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (customer_id) REFERENCES customers(id)\n);\n\nCREATE TABLE media_types (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE tracks (\n id INTEGER PRIMARY KEY,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (media_type_id) REFERENCES media_types(id),\n FOREIGN KEY (genre_id) REFERENCES genres(id),\n FOREIGN KEY (album_id) REFERENCES albums(id)\n);\n\nCREATE TABLE invoice_lines (\n id INTEGER PRIMARY KEY,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (invoice_id) REFERENCES invoices(id)\n);\n\nCREATE TABLE playlists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE playlist_tracks (\n playlist_id INTEGER NOT NULL PRIMARY KEY,\n track_id INTEGER NOT NULL PRIMARY KEY,\n PRIMARY KEY (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (playlist_id) REFERENCES playlists(id)\n);", "role": "user" }, { "content": "SELECT count(*) FROM employees WHERE country = \"Canada\";", "role": "assistant" } ]
store_1
[ { "content": "Translate the following question to SQL: How many employees live in Canada?\n\nSchema: CREATE TABLE artists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE albums (\n id INTEGER PRIMARY KEY,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (artist_id) REFERENCES artists(id)\n);\n\nCREATE TABLE employees (\n id INTEGER PRIMARY KEY,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n UNIQUE (id),\n FOREIGN KEY (reports_to) REFERENCES employees(id)\n);\n\nCREATE TABLE customers (\n id INTEGER PRIMARY KEY,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n UNIQUE (id),\n FOREIGN KEY (support_rep_id) REFERENCES employees(id)\n);\n\nCREATE TABLE genres (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE invoices (\n id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (customer_id) REFERENCES customers(id)\n);\n\nCREATE TABLE media_types (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE tracks (\n id INTEGER PRIMARY KEY,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (media_type_id) REFERENCES media_types(id),\n FOREIGN KEY (genre_id) REFERENCES genres(id),\n FOREIGN KEY (album_id) REFERENCES albums(id)\n);\n\nCREATE TABLE invoice_lines (\n id INTEGER PRIMARY KEY,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (invoice_id) REFERENCES invoices(id)\n);\n\nCREATE TABLE playlists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE playlist_tracks (\n playlist_id INTEGER NOT NULL PRIMARY KEY,\n track_id INTEGER NOT NULL PRIMARY KEY,\n PRIMARY KEY (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (playlist_id) REFERENCES playlists(id)\n);", "role": "user" }, { "content": "SELECT count(*) FROM employees WHERE country = \"Canada\";", "role": "assistant" } ]
store_1
[ { "content": "Translate the following question to SQL: What is employee Nancy Edwards's phone number?\n\nSchema: CREATE TABLE artists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE albums (\n id INTEGER PRIMARY KEY,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (artist_id) REFERENCES artists(id)\n);\n\nCREATE TABLE employees (\n id INTEGER PRIMARY KEY,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n UNIQUE (id),\n FOREIGN KEY (reports_to) REFERENCES employees(id)\n);\n\nCREATE TABLE customers (\n id INTEGER PRIMARY KEY,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n UNIQUE (id),\n FOREIGN KEY (support_rep_id) REFERENCES employees(id)\n);\n\nCREATE TABLE genres (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE invoices (\n id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (customer_id) REFERENCES customers(id)\n);\n\nCREATE TABLE media_types (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE tracks (\n id INTEGER PRIMARY KEY,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (media_type_id) REFERENCES media_types(id),\n FOREIGN KEY (genre_id) REFERENCES genres(id),\n FOREIGN KEY (album_id) REFERENCES albums(id)\n);\n\nCREATE TABLE invoice_lines (\n id INTEGER PRIMARY KEY,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (invoice_id) REFERENCES invoices(id)\n);\n\nCREATE TABLE playlists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE playlist_tracks (\n playlist_id INTEGER NOT NULL PRIMARY KEY,\n track_id INTEGER NOT NULL PRIMARY KEY,\n PRIMARY KEY (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (playlist_id) REFERENCES playlists(id)\n);", "role": "user" }, { "content": "SELECT phone FROM employees WHERE first_name = \"Nancy\" AND last_name = \"Edwards\";", "role": "assistant" } ]
store_1
[ { "content": "Translate the following question to SQL: What is the the phone number of Nancy Edwards?\n\nSchema: CREATE TABLE artists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE albums (\n id INTEGER PRIMARY KEY,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (artist_id) REFERENCES artists(id)\n);\n\nCREATE TABLE employees (\n id INTEGER PRIMARY KEY,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n UNIQUE (id),\n FOREIGN KEY (reports_to) REFERENCES employees(id)\n);\n\nCREATE TABLE customers (\n id INTEGER PRIMARY KEY,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n UNIQUE (id),\n FOREIGN KEY (support_rep_id) REFERENCES employees(id)\n);\n\nCREATE TABLE genres (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE invoices (\n id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (customer_id) REFERENCES customers(id)\n);\n\nCREATE TABLE media_types (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE tracks (\n id INTEGER PRIMARY KEY,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (media_type_id) REFERENCES media_types(id),\n FOREIGN KEY (genre_id) REFERENCES genres(id),\n FOREIGN KEY (album_id) REFERENCES albums(id)\n);\n\nCREATE TABLE invoice_lines (\n id INTEGER PRIMARY KEY,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (invoice_id) REFERENCES invoices(id)\n);\n\nCREATE TABLE playlists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE playlist_tracks (\n playlist_id INTEGER NOT NULL PRIMARY KEY,\n track_id INTEGER NOT NULL PRIMARY KEY,\n PRIMARY KEY (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (playlist_id) REFERENCES playlists(id)\n);", "role": "user" }, { "content": "SELECT phone FROM employees WHERE first_name = \"Nancy\" AND last_name = \"Edwards\";", "role": "assistant" } ]
store_1
[ { "content": "Translate the following question to SQL: Who is the youngest employee in the company? List employee's first and last name.\n\nSchema: CREATE TABLE artists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE albums (\n id INTEGER PRIMARY KEY,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (artist_id) REFERENCES artists(id)\n);\n\nCREATE TABLE employees (\n id INTEGER PRIMARY KEY,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n UNIQUE (id),\n FOREIGN KEY (reports_to) REFERENCES employees(id)\n);\n\nCREATE TABLE customers (\n id INTEGER PRIMARY KEY,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n UNIQUE (id),\n FOREIGN KEY (support_rep_id) REFERENCES employees(id)\n);\n\nCREATE TABLE genres (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE invoices (\n id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (customer_id) REFERENCES customers(id)\n);\n\nCREATE TABLE media_types (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE tracks (\n id INTEGER PRIMARY KEY,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (media_type_id) REFERENCES media_types(id),\n FOREIGN KEY (genre_id) REFERENCES genres(id),\n FOREIGN KEY (album_id) REFERENCES albums(id)\n);\n\nCREATE TABLE invoice_lines (\n id INTEGER PRIMARY KEY,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n UNIQUE (id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (invoice_id) REFERENCES invoices(id)\n);\n\nCREATE TABLE playlists (\n id INTEGER PRIMARY KEY,\n name VARCHAR(120),\n UNIQUE (id)\n);\n\nCREATE TABLE playlist_tracks (\n playlist_id INTEGER NOT NULL PRIMARY KEY,\n track_id INTEGER NOT NULL PRIMARY KEY,\n PRIMARY KEY (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n UNIQUE (playlist_id, track_id),\n FOREIGN KEY (track_id) REFERENCES tracks(id),\n FOREIGN KEY (playlist_id) REFERENCES playlists(id)\n);", "role": "user" }, { "content": "SELECT first_name , last_name FROM employees ORDER BY birth_date DESC LIMIT 1;", "role": "assistant" } ]