brief_instruction
stringlengths
16
224
instruction
stringlengths
687
8.77k
output
stringlengths
18
577
How many students does each advisor have?
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many students does each advisor have?` to a syntactically-correct PostgreSQL query.
SELECT advisor , count(*) FROM Student GROUP BY advisor
Which advisor has most number of students?
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Which advisor has most number of students?` to a syntactically-correct PostgreSQL query.
SELECT advisor FROM Student GROUP BY advisor ORDER BY count(*) DESC LIMIT 1
Give the advisor with the most students.
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Give the advisor with the most students.` to a syntactically-correct PostgreSQL query.
SELECT advisor FROM Student GROUP BY advisor ORDER BY count(*) DESC LIMIT 1
How many students have cat allergies?
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many students have cat allergies?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM Has_allergy WHERE Allergy = "Cat"
How many students are affected by cat allergies?
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many students are affected by cat allergies?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM Has_allergy WHERE Allergy = "Cat"
Show all student IDs who have at least two allergies.
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show all student IDs who have at least two allergies.` to a syntactically-correct PostgreSQL query.
SELECT StuID FROM Has_allergy GROUP BY StuID HAVING count(*) >= 2
What are the students ids of students who have more than one allergy?
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the students ids of students who have more than one allergy?` to a syntactically-correct PostgreSQL query.
SELECT StuID FROM Has_allergy GROUP BY StuID HAVING count(*) >= 2
What are the student ids of students who don't have any allergies?
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the student ids of students who don't have any allergies?` to a syntactically-correct PostgreSQL query.
SELECT StuID FROM Student EXCEPT SELECT StuID FROM Has_allergy
Which students are unaffected by allergies?
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Which students are unaffected by allergies?` to a syntactically-correct PostgreSQL query.
SELECT StuID FROM Student EXCEPT SELECT StuID FROM Has_allergy
How many female students have milk or egg allergies?
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many female students have milk or egg allergies?` to a syntactically-correct PostgreSQL query.
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"
How many students who are female are allergic to milk or eggs?
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many students who are female are allergic to milk or eggs?` to a syntactically-correct PostgreSQL query.
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"
How many students have a food allergy?
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many students have a food allergy?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM Has_allergy AS T1 JOIN Allergy_type AS T2 ON T1.allergy = T2.allergy WHERE T2.allergytype = "food"
How many students are affected by food related allergies?
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many students are affected by food related allergies?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM Has_allergy AS T1 JOIN Allergy_type AS T2 ON T1.allergy = T2.allergy WHERE T2.allergytype = "food"
Which allergy has most number of students affected?
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Which allergy has most number of students affected?` to a syntactically-correct PostgreSQL query.
SELECT Allergy FROM Has_allergy GROUP BY Allergy ORDER BY count(*) DESC LIMIT 1
Which allergy is the most common?
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Which allergy is the most common?` to a syntactically-correct PostgreSQL query.
SELECT Allergy FROM Has_allergy GROUP BY Allergy ORDER BY count(*) DESC LIMIT 1
Show all allergies with number of students affected.
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show all allergies with number of students affected.` to a syntactically-correct PostgreSQL query.
SELECT Allergy , count(*) FROM Has_allergy GROUP BY Allergy
How many students have each different allergy?
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many students have each different allergy?` to a syntactically-correct PostgreSQL query.
SELECT Allergy , count(*) FROM Has_allergy GROUP BY Allergy
Show all allergy type with number of students affected.
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show all allergy type with number of students affected.` to a syntactically-correct PostgreSQL query.
SELECT T2.allergytype , count(*) FROM Has_allergy AS T1 JOIN Allergy_type AS T2 ON T1.allergy = T2.allergy GROUP BY T2.allergytype
How many students are affected by each allergy type?
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many students are affected by each allergy type?` to a syntactically-correct PostgreSQL query.
SELECT T2.allergytype , count(*) FROM Has_allergy AS T1 JOIN Allergy_type AS T2 ON T1.allergy = T2.allergy GROUP BY T2.allergytype
Find the last name and age of the student who has allergy to both milk and cat.
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Find the last name and age of the student who has allergy to both milk and cat.` to a syntactically-correct PostgreSQL query.
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")
What are the last names and ages of the students who are allergic to milk and cat?
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the last names and ages of the students who are allergic to milk and cat?` to a syntactically-correct PostgreSQL query.
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")
What are the allergies and their types that the student with first name Lisa has? And order the result by name of allergies.
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the allergies and their types that the student with first name Lisa has? And order the result by name of allergies.` to a syntactically-correct PostgreSQL query.
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
What are the allergies the girl named Lisa has? And what are the types of them? Order the result by allergy names.
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the allergies the girl named Lisa has? And what are the types of them? Order the result by allergy names.` to a syntactically-correct PostgreSQL query.
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
Find the first name and gender of the student who has allergy to milk but not cat.
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Find the first name and gender of the student who has allergy to milk but not cat.` to a syntactically-correct PostgreSQL query.
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")
What are the first name and gender of the students who have allergy to milk but can put up with cats?
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the first name and gender of the students who have allergy to milk but can put up with cats?` to a syntactically-correct PostgreSQL query.
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")
Find the average age of the students who have allergies with food and animal types.
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Find the average age of the students who have allergies with food and animal types.` to a syntactically-correct PostgreSQL query.
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")
How old are the students with allergies to food and animal types on average?
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How old are the students with allergies to food and animal types on average?` to a syntactically-correct PostgreSQL query.
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")
List the first and last name of the students who do not have any food type allergy.
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `List the first and last name of the students who do not have any food type allergy.` to a syntactically-correct PostgreSQL query.
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")
What is the full name of each student who is not allergic to any type of food.
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the full name of each student who is not allergic to any type of food.` to a syntactically-correct PostgreSQL query.
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")
Find the number of male (sex is 'M') students who have some food type allery.
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Find the number of male (sex is 'M') students who have some food type allery.` to a syntactically-correct PostgreSQL query.
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")
How many male students (sex is 'M') are allergic to any type of food?
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many male students (sex is 'M') are allergic to any type of food?` to a syntactically-correct PostgreSQL query.
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")
Find the different first names and cities of the students who have allergy to milk or cat.
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Find the different first names and cities of the students who have allergy to milk or cat.` to a syntactically-correct PostgreSQL query.
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"
What are the distinct first names and cities of the students who have allergy either to milk or to cat?
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the distinct first names and cities of the students who have allergy either to milk or to cat?` to a syntactically-correct PostgreSQL query.
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"
Find the number of students who are older than 18 and do not have allergy to either food or animal.
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Find the number of students who are older than 18 and do not have allergy to either food or animal.` to a syntactically-correct PostgreSQL query.
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")
How many students are over 18 and do not have allergy to food type or animal type?
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many students are over 18 and do not have allergy to food type or animal type?` to a syntactically-correct PostgreSQL query.
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")
Find the first name and major of the students who are not allegry to soy.
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Find the first name and major of the students who are not allegry to soy.` to a syntactically-correct PostgreSQL query.
SELECT fname , major FROM Student WHERE StuID NOT IN (SELECT StuID FROM Has_allergy WHERE Allergy = "Soy")
What are the first name and major of the students who are able to consume soy?
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the first name and major of the students who are able to consume soy?` to a syntactically-correct PostgreSQL query.
SELECT fname , major FROM Student WHERE StuID NOT IN (SELECT StuID FROM Has_allergy WHERE Allergy = "Soy")
A list of the top 5 countries by number of invoices. List country name and number of invoices.
-- Language PostgreSQL -- Tables: -- Table: sqlite sequence columns : [['name', 'number'], ['seq', 'text']] -- Table: artists columns : [['id', 'text'], ['name', 'text']] -- Table: albums columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']] -- Table: employees columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']] -- Table: customers columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']] -- Table: genres columns : [['id', 'number'], ['name', 'text']] -- Table: invoices columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']] -- Table: media types columns : [['id', 'number'], ['name', 'text']] -- Table: tracks columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']] -- Table: invoice lines columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']] -- Table: playlists columns : [['id', 'number'], ['name', 'text']] -- Table: playlist tracks columns : [['playlist id', 'number'], ['track id', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `A list of the top 5 countries by number of invoices. List country name and number of invoices.` to a syntactically-correct PostgreSQL query.
SELECT billing_country , COUNT(*) FROM invoices GROUP BY billing_country ORDER BY count(*) DESC LIMIT 5;
What are the top 5 countries by number of invoices and how many do they have?
-- Language PostgreSQL -- Tables: -- Table: sqlite sequence columns : [['name', 'number'], ['seq', 'text']] -- Table: artists columns : [['id', 'text'], ['name', 'text']] -- Table: albums columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']] -- Table: employees columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']] -- Table: customers columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']] -- Table: genres columns : [['id', 'number'], ['name', 'text']] -- Table: invoices columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']] -- Table: media types columns : [['id', 'number'], ['name', 'text']] -- Table: tracks columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']] -- Table: invoice lines columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']] -- Table: playlists columns : [['id', 'number'], ['name', 'text']] -- Table: playlist tracks columns : [['playlist id', 'number'], ['track id', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the top 5 countries by number of invoices and how many do they have?` to a syntactically-correct PostgreSQL query.
SELECT billing_country , COUNT(*) FROM invoices GROUP BY billing_country ORDER BY count(*) DESC LIMIT 5;
A list of the top 8 countries by gross/total invoice size. List country name and gross invoice size.
-- Language PostgreSQL -- Tables: -- Table: sqlite sequence columns : [['name', 'number'], ['seq', 'text']] -- Table: artists columns : [['id', 'text'], ['name', 'text']] -- Table: albums columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']] -- Table: employees columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']] -- Table: customers columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']] -- Table: genres columns : [['id', 'number'], ['name', 'text']] -- Table: invoices columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']] -- Table: media types columns : [['id', 'number'], ['name', 'text']] -- Table: tracks columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']] -- Table: invoice lines columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']] -- Table: playlists columns : [['id', 'number'], ['name', 'text']] -- Table: playlist tracks columns : [['playlist id', 'number'], ['track id', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `A list of the top 8 countries by gross/total invoice size. List country name and gross invoice size.` to a syntactically-correct PostgreSQL query.
SELECT billing_country , SUM(total) FROM invoices GROUP BY billing_country ORDER BY SUM(total) DESC LIMIT 8;
What are the names of the top 8 countries by total invoice size and what are those sizes?
-- Language PostgreSQL -- Tables: -- Table: sqlite sequence columns : [['name', 'number'], ['seq', 'text']] -- Table: artists columns : [['id', 'text'], ['name', 'text']] -- Table: albums columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']] -- Table: employees columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']] -- Table: customers columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']] -- Table: genres columns : [['id', 'number'], ['name', 'text']] -- Table: invoices columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']] -- Table: media types columns : [['id', 'number'], ['name', 'text']] -- Table: tracks columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']] -- Table: invoice lines columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']] -- Table: playlists columns : [['id', 'number'], ['name', 'text']] -- Table: playlist tracks columns : [['playlist id', 'number'], ['track id', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the names of the top 8 countries by total invoice size and what are those sizes?` to a syntactically-correct PostgreSQL query.
SELECT billing_country , SUM(total) FROM invoices GROUP BY billing_country ORDER BY SUM(total) DESC LIMIT 8;
A list of the top 10 countries by average invoice size. List country name and average invoice size.
-- Language PostgreSQL -- Tables: -- Table: sqlite sequence columns : [['name', 'number'], ['seq', 'text']] -- Table: artists columns : [['id', 'text'], ['name', 'text']] -- Table: albums columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']] -- Table: employees columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']] -- Table: customers columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']] -- Table: genres columns : [['id', 'number'], ['name', 'text']] -- Table: invoices columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']] -- Table: media types columns : [['id', 'number'], ['name', 'text']] -- Table: tracks columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']] -- Table: invoice lines columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']] -- Table: playlists columns : [['id', 'number'], ['name', 'text']] -- Table: playlist tracks columns : [['playlist id', 'number'], ['track id', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `A list of the top 10 countries by average invoice size. List country name and average invoice size.` to a syntactically-correct PostgreSQL query.
SELECT billing_country , AVG(total) FROM invoices GROUP BY billing_country ORDER BY AVG(total) DESC LIMIT 10;
What are the names of the countries and average invoice size of the top countries by size?
-- Language PostgreSQL -- Tables: -- Table: sqlite sequence columns : [['name', 'number'], ['seq', 'text']] -- Table: artists columns : [['id', 'text'], ['name', 'text']] -- Table: albums columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']] -- Table: employees columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']] -- Table: customers columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']] -- Table: genres columns : [['id', 'number'], ['name', 'text']] -- Table: invoices columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']] -- Table: media types columns : [['id', 'number'], ['name', 'text']] -- Table: tracks columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']] -- Table: invoice lines columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']] -- Table: playlists columns : [['id', 'number'], ['name', 'text']] -- Table: playlist tracks columns : [['playlist id', 'number'], ['track id', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the names of the countries and average invoice size of the top countries by size?` to a syntactically-correct PostgreSQL query.
SELECT billing_country , AVG(total) FROM invoices GROUP BY billing_country ORDER BY AVG(total) DESC LIMIT 10;
Find out 5 customers who most recently purchased something. List customers' first and last name.
-- Language PostgreSQL -- Tables: -- Table: sqlite sequence columns : [['name', 'number'], ['seq', 'text']] -- Table: artists columns : [['id', 'text'], ['name', 'text']] -- Table: albums columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']] -- Table: employees columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']] -- Table: customers columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']] -- Table: genres columns : [['id', 'number'], ['name', 'text']] -- Table: invoices columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']] -- Table: media types columns : [['id', 'number'], ['name', 'text']] -- Table: tracks columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']] -- Table: invoice lines columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']] -- Table: playlists columns : [['id', 'number'], ['name', 'text']] -- Table: playlist tracks columns : [['playlist id', 'number'], ['track id', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Find out 5 customers who most recently purchased something. List customers' first and last name.` to a syntactically-correct PostgreSQL query.
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;
What are the first and last names of the 5 customers who purchased something most recently?
-- Language PostgreSQL -- Tables: -- Table: sqlite sequence columns : [['name', 'number'], ['seq', 'text']] -- Table: artists columns : [['id', 'text'], ['name', 'text']] -- Table: albums columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']] -- Table: employees columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']] -- Table: customers columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']] -- Table: genres columns : [['id', 'number'], ['name', 'text']] -- Table: invoices columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']] -- Table: media types columns : [['id', 'number'], ['name', 'text']] -- Table: tracks columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']] -- Table: invoice lines columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']] -- Table: playlists columns : [['id', 'number'], ['name', 'text']] -- Table: playlist tracks columns : [['playlist id', 'number'], ['track id', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the first and last names of the 5 customers who purchased something most recently?` to a syntactically-correct PostgreSQL query.
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;
Find out the top 10 customers by total number of orders. List customers' first and last name and the number of total orders.
-- Language PostgreSQL -- Tables: -- Table: sqlite sequence columns : [['name', 'number'], ['seq', 'text']] -- Table: artists columns : [['id', 'text'], ['name', 'text']] -- Table: albums columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']] -- Table: employees columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']] -- Table: customers columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']] -- Table: genres columns : [['id', 'number'], ['name', 'text']] -- Table: invoices columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']] -- Table: media types columns : [['id', 'number'], ['name', 'text']] -- Table: tracks columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']] -- Table: invoice lines columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']] -- Table: playlists columns : [['id', 'number'], ['name', 'text']] -- Table: playlist tracks columns : [['playlist id', 'number'], ['track id', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Find out the top 10 customers by total number of orders. List customers' first and last name and the number of total orders.` to a syntactically-correct PostgreSQL query.
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;
What are the top 10 customers' first and last names by total number of orders and how many orders did they make?
-- Language PostgreSQL -- Tables: -- Table: sqlite sequence columns : [['name', 'number'], ['seq', 'text']] -- Table: artists columns : [['id', 'text'], ['name', 'text']] -- Table: albums columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']] -- Table: employees columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']] -- Table: customers columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']] -- Table: genres columns : [['id', 'number'], ['name', 'text']] -- Table: invoices columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']] -- Table: media types columns : [['id', 'number'], ['name', 'text']] -- Table: tracks columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']] -- Table: invoice lines columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']] -- Table: playlists columns : [['id', 'number'], ['name', 'text']] -- Table: playlist tracks columns : [['playlist id', 'number'], ['track id', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the top 10 customers' first and last names by total number of orders and how many orders did they make?` to a syntactically-correct PostgreSQL query.
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;
List the top 10 customers by total gross sales. List customers' first and last name and total gross sales.
-- Language PostgreSQL -- Tables: -- Table: sqlite sequence columns : [['name', 'number'], ['seq', 'text']] -- Table: artists columns : [['id', 'text'], ['name', 'text']] -- Table: albums columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']] -- Table: employees columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']] -- Table: customers columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']] -- Table: genres columns : [['id', 'number'], ['name', 'text']] -- Table: invoices columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']] -- Table: media types columns : [['id', 'number'], ['name', 'text']] -- Table: tracks columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']] -- Table: invoice lines columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']] -- Table: playlists columns : [['id', 'number'], ['name', 'text']] -- Table: playlist tracks columns : [['playlist id', 'number'], ['track id', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `List the top 10 customers by total gross sales. List customers' first and last name and total gross sales.` to a syntactically-correct PostgreSQL query.
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;
What are the top 10 customers' first and last names with the highest gross sales, and also what are the sales?
-- Language PostgreSQL -- Tables: -- Table: sqlite sequence columns : [['name', 'number'], ['seq', 'text']] -- Table: artists columns : [['id', 'text'], ['name', 'text']] -- Table: albums columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']] -- Table: employees columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']] -- Table: customers columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']] -- Table: genres columns : [['id', 'number'], ['name', 'text']] -- Table: invoices columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']] -- Table: media types columns : [['id', 'number'], ['name', 'text']] -- Table: tracks columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']] -- Table: invoice lines columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']] -- Table: playlists columns : [['id', 'number'], ['name', 'text']] -- Table: playlist tracks columns : [['playlist id', 'number'], ['track id', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the top 10 customers' first and last names with the highest gross sales, and also what are the sales?` to a syntactically-correct PostgreSQL query.
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;
List the top 5 genres by number of tracks. List genres name and total tracks.
-- Language PostgreSQL -- Tables: -- Table: sqlite sequence columns : [['name', 'number'], ['seq', 'text']] -- Table: artists columns : [['id', 'text'], ['name', 'text']] -- Table: albums columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']] -- Table: employees columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']] -- Table: customers columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']] -- Table: genres columns : [['id', 'number'], ['name', 'text']] -- Table: invoices columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']] -- Table: media types columns : [['id', 'number'], ['name', 'text']] -- Table: tracks columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']] -- Table: invoice lines columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']] -- Table: playlists columns : [['id', 'number'], ['name', 'text']] -- Table: playlist tracks columns : [['playlist id', 'number'], ['track id', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `List the top 5 genres by number of tracks. List genres name and total tracks.` to a syntactically-correct PostgreSQL query.
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;
How many tracks does each genre have and what are the names of the top 5?
-- Language PostgreSQL -- Tables: -- Table: sqlite sequence columns : [['name', 'number'], ['seq', 'text']] -- Table: artists columns : [['id', 'text'], ['name', 'text']] -- Table: albums columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']] -- Table: employees columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']] -- Table: customers columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']] -- Table: genres columns : [['id', 'number'], ['name', 'text']] -- Table: invoices columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']] -- Table: media types columns : [['id', 'number'], ['name', 'text']] -- Table: tracks columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']] -- Table: invoice lines columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']] -- Table: playlists columns : [['id', 'number'], ['name', 'text']] -- Table: playlist tracks columns : [['playlist id', 'number'], ['track id', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many tracks does each genre have and what are the names of the top 5?` to a syntactically-correct PostgreSQL query.
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;
List every album's title.
-- Language PostgreSQL -- Tables: -- Table: sqlite sequence columns : [['name', 'number'], ['seq', 'text']] -- Table: artists columns : [['id', 'text'], ['name', 'text']] -- Table: albums columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']] -- Table: employees columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']] -- Table: customers columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']] -- Table: genres columns : [['id', 'number'], ['name', 'text']] -- Table: invoices columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']] -- Table: media types columns : [['id', 'number'], ['name', 'text']] -- Table: tracks columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']] -- Table: invoice lines columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']] -- Table: playlists columns : [['id', 'number'], ['name', 'text']] -- Table: playlist tracks columns : [['playlist id', 'number'], ['track id', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `List every album's title.` to a syntactically-correct PostgreSQL query.
SELECT title FROM albums;
What are the titles of all the albums?
-- Language PostgreSQL -- Tables: -- Table: sqlite sequence columns : [['name', 'number'], ['seq', 'text']] -- Table: artists columns : [['id', 'text'], ['name', 'text']] -- Table: albums columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']] -- Table: employees columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']] -- Table: customers columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']] -- Table: genres columns : [['id', 'number'], ['name', 'text']] -- Table: invoices columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']] -- Table: media types columns : [['id', 'number'], ['name', 'text']] -- Table: tracks columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']] -- Table: invoice lines columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']] -- Table: playlists columns : [['id', 'number'], ['name', 'text']] -- Table: playlist tracks columns : [['playlist id', 'number'], ['track id', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the titles of all the albums?` to a syntactically-correct PostgreSQL query.
SELECT title FROM albums;
List every album ordered by album title in ascending order.
-- Language PostgreSQL -- Tables: -- Table: sqlite sequence columns : [['name', 'number'], ['seq', 'text']] -- Table: artists columns : [['id', 'text'], ['name', 'text']] -- Table: albums columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']] -- Table: employees columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']] -- Table: customers columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']] -- Table: genres columns : [['id', 'number'], ['name', 'text']] -- Table: invoices columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']] -- Table: media types columns : [['id', 'number'], ['name', 'text']] -- Table: tracks columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']] -- Table: invoice lines columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']] -- Table: playlists columns : [['id', 'number'], ['name', 'text']] -- Table: playlist tracks columns : [['playlist id', 'number'], ['track id', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `List every album ordered by album title in ascending order.` to a syntactically-correct PostgreSQL query.
SELECT title FROM albums ORDER BY title;
What are the titles of all the albums alphabetically ascending?
-- Language PostgreSQL -- Tables: -- Table: sqlite sequence columns : [['name', 'number'], ['seq', 'text']] -- Table: artists columns : [['id', 'text'], ['name', 'text']] -- Table: albums columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']] -- Table: employees columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']] -- Table: customers columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']] -- Table: genres columns : [['id', 'number'], ['name', 'text']] -- Table: invoices columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']] -- Table: media types columns : [['id', 'number'], ['name', 'text']] -- Table: tracks columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']] -- Table: invoice lines columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']] -- Table: playlists columns : [['id', 'number'], ['name', 'text']] -- Table: playlist tracks columns : [['playlist id', 'number'], ['track id', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the titles of all the albums alphabetically ascending?` to a syntactically-correct PostgreSQL query.
SELECT title FROM albums ORDER BY title;
List every album whose title starts with A in alphabetical order.
-- Language PostgreSQL -- Tables: -- Table: sqlite sequence columns : [['name', 'number'], ['seq', 'text']] -- Table: artists columns : [['id', 'text'], ['name', 'text']] -- Table: albums columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']] -- Table: employees columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']] -- Table: customers columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']] -- Table: genres columns : [['id', 'number'], ['name', 'text']] -- Table: invoices columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']] -- Table: media types columns : [['id', 'number'], ['name', 'text']] -- Table: tracks columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']] -- Table: invoice lines columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']] -- Table: playlists columns : [['id', 'number'], ['name', 'text']] -- Table: playlist tracks columns : [['playlist id', 'number'], ['track id', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `List every album whose title starts with A in alphabetical order.` to a syntactically-correct PostgreSQL query.
SELECT title FROM albums WHERE title LIKE 'A%' ORDER BY title;
What are the titles of all albums that start with A in alphabetical order?
-- Language PostgreSQL -- Tables: -- Table: sqlite sequence columns : [['name', 'number'], ['seq', 'text']] -- Table: artists columns : [['id', 'text'], ['name', 'text']] -- Table: albums columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']] -- Table: employees columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']] -- Table: customers columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']] -- Table: genres columns : [['id', 'number'], ['name', 'text']] -- Table: invoices columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']] -- Table: media types columns : [['id', 'number'], ['name', 'text']] -- Table: tracks columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']] -- Table: invoice lines columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']] -- Table: playlists columns : [['id', 'number'], ['name', 'text']] -- Table: playlist tracks columns : [['playlist id', 'number'], ['track id', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the titles of all albums that start with A in alphabetical order?` to a syntactically-correct PostgreSQL query.
SELECT title FROM albums WHERE title LIKE 'A%' ORDER BY title;
List the customers first and last name of 10 least expensive invoices.
-- Language PostgreSQL -- Tables: -- Table: sqlite sequence columns : [['name', 'number'], ['seq', 'text']] -- Table: artists columns : [['id', 'text'], ['name', 'text']] -- Table: albums columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']] -- Table: employees columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']] -- Table: customers columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']] -- Table: genres columns : [['id', 'number'], ['name', 'text']] -- Table: invoices columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']] -- Table: media types columns : [['id', 'number'], ['name', 'text']] -- Table: tracks columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']] -- Table: invoice lines columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']] -- Table: playlists columns : [['id', 'number'], ['name', 'text']] -- Table: playlist tracks columns : [['playlist id', 'number'], ['track id', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `List the customers first and last name of 10 least expensive invoices.` to a syntactically-correct PostgreSQL query.
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;
What are the first and last names of the customers with the 10 cheapest invoices?
-- Language PostgreSQL -- Tables: -- Table: sqlite sequence columns : [['name', 'number'], ['seq', 'text']] -- Table: artists columns : [['id', 'text'], ['name', 'text']] -- Table: albums columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']] -- Table: employees columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']] -- Table: customers columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']] -- Table: genres columns : [['id', 'number'], ['name', 'text']] -- Table: invoices columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']] -- Table: media types columns : [['id', 'number'], ['name', 'text']] -- Table: tracks columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']] -- Table: invoice lines columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']] -- Table: playlists columns : [['id', 'number'], ['name', 'text']] -- Table: playlist tracks columns : [['playlist id', 'number'], ['track id', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the first and last names of the customers with the 10 cheapest invoices?` to a syntactically-correct PostgreSQL query.
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;
List total amount of invoice from Chicago, IL.
-- Language PostgreSQL -- Tables: -- Table: sqlite sequence columns : [['name', 'number'], ['seq', 'text']] -- Table: artists columns : [['id', 'text'], ['name', 'text']] -- Table: albums columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']] -- Table: employees columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']] -- Table: customers columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']] -- Table: genres columns : [['id', 'number'], ['name', 'text']] -- Table: invoices columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']] -- Table: media types columns : [['id', 'number'], ['name', 'text']] -- Table: tracks columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']] -- Table: invoice lines columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']] -- Table: playlists columns : [['id', 'number'], ['name', 'text']] -- Table: playlist tracks columns : [['playlist id', 'number'], ['track id', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `List total amount of invoice from Chicago, IL.` to a syntactically-correct PostgreSQL query.
SELECT sum(total) FROM invoices WHERE billing_city = "Chicago" AND billing_state = "IL";
What are the total amount of money in the invoices billed from Chicago, Illinois?
-- Language PostgreSQL -- Tables: -- Table: sqlite sequence columns : [['name', 'number'], ['seq', 'text']] -- Table: artists columns : [['id', 'text'], ['name', 'text']] -- Table: albums columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']] -- Table: employees columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']] -- Table: customers columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']] -- Table: genres columns : [['id', 'number'], ['name', 'text']] -- Table: invoices columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']] -- Table: media types columns : [['id', 'number'], ['name', 'text']] -- Table: tracks columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']] -- Table: invoice lines columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']] -- Table: playlists columns : [['id', 'number'], ['name', 'text']] -- Table: playlist tracks columns : [['playlist id', 'number'], ['track id', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the total amount of money in the invoices billed from Chicago, Illinois?` to a syntactically-correct PostgreSQL query.
SELECT sum(total) FROM invoices WHERE billing_city = "Chicago" AND billing_state = "IL";
List the number of invoices from Chicago, IL.
-- Language PostgreSQL -- Tables: -- Table: sqlite sequence columns : [['name', 'number'], ['seq', 'text']] -- Table: artists columns : [['id', 'text'], ['name', 'text']] -- Table: albums columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']] -- Table: employees columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']] -- Table: customers columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']] -- Table: genres columns : [['id', 'number'], ['name', 'text']] -- Table: invoices columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']] -- Table: media types columns : [['id', 'number'], ['name', 'text']] -- Table: tracks columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']] -- Table: invoice lines columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']] -- Table: playlists columns : [['id', 'number'], ['name', 'text']] -- Table: playlist tracks columns : [['playlist id', 'number'], ['track id', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `List the number of invoices from Chicago, IL.` to a syntactically-correct PostgreSQL query.
SELECT COUNT(*) FROM invoices WHERE billing_city = "Chicago" AND billing_state = "IL";
How many invoices were billed from Chicago, IL?
-- Language PostgreSQL -- Tables: -- Table: sqlite sequence columns : [['name', 'number'], ['seq', 'text']] -- Table: artists columns : [['id', 'text'], ['name', 'text']] -- Table: albums columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']] -- Table: employees columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']] -- Table: customers columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']] -- Table: genres columns : [['id', 'number'], ['name', 'text']] -- Table: invoices columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']] -- Table: media types columns : [['id', 'number'], ['name', 'text']] -- Table: tracks columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']] -- Table: invoice lines columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']] -- Table: playlists columns : [['id', 'number'], ['name', 'text']] -- Table: playlist tracks columns : [['playlist id', 'number'], ['track id', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many invoices were billed from Chicago, IL?` to a syntactically-correct PostgreSQL query.
SELECT COUNT(*) FROM invoices WHERE billing_city = "Chicago" AND billing_state = "IL";
List the number of invoices from the US, grouped by state.
-- Language PostgreSQL -- Tables: -- Table: sqlite sequence columns : [['name', 'number'], ['seq', 'text']] -- Table: artists columns : [['id', 'text'], ['name', 'text']] -- Table: albums columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']] -- Table: employees columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']] -- Table: customers columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']] -- Table: genres columns : [['id', 'number'], ['name', 'text']] -- Table: invoices columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']] -- Table: media types columns : [['id', 'number'], ['name', 'text']] -- Table: tracks columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']] -- Table: invoice lines columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']] -- Table: playlists columns : [['id', 'number'], ['name', 'text']] -- Table: playlist tracks columns : [['playlist id', 'number'], ['track id', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `List the number of invoices from the US, grouped by state.` to a syntactically-correct PostgreSQL query.
SELECT billing_state , COUNT(*) FROM invoices WHERE billing_country = "USA" GROUP BY billing_state;
How many invoices were billed from each state?
-- Language PostgreSQL -- Tables: -- Table: sqlite sequence columns : [['name', 'number'], ['seq', 'text']] -- Table: artists columns : [['id', 'text'], ['name', 'text']] -- Table: albums columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']] -- Table: employees columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']] -- Table: customers columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']] -- Table: genres columns : [['id', 'number'], ['name', 'text']] -- Table: invoices columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']] -- Table: media types columns : [['id', 'number'], ['name', 'text']] -- Table: tracks columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']] -- Table: invoice lines columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']] -- Table: playlists columns : [['id', 'number'], ['name', 'text']] -- Table: playlist tracks columns : [['playlist id', 'number'], ['track id', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many invoices were billed from each state?` to a syntactically-correct PostgreSQL query.
SELECT billing_state , COUNT(*) FROM invoices WHERE billing_country = "USA" GROUP BY billing_state;
List the state in the US with the most invoices.
-- Language PostgreSQL -- Tables: -- Table: sqlite sequence columns : [['name', 'number'], ['seq', 'text']] -- Table: artists columns : [['id', 'text'], ['name', 'text']] -- Table: albums columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']] -- Table: employees columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']] -- Table: customers columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']] -- Table: genres columns : [['id', 'number'], ['name', 'text']] -- Table: invoices columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']] -- Table: media types columns : [['id', 'number'], ['name', 'text']] -- Table: tracks columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']] -- Table: invoice lines columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']] -- Table: playlists columns : [['id', 'number'], ['name', 'text']] -- Table: playlist tracks columns : [['playlist id', 'number'], ['track id', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `List the state in the US with the most invoices.` to a syntactically-correct PostgreSQL query.
SELECT billing_state , COUNT(*) FROM invoices WHERE billing_country = "USA" GROUP BY billing_state ORDER BY COUNT(*) DESC LIMIT 1;
What are the states with the most invoices?
-- Language PostgreSQL -- Tables: -- Table: sqlite sequence columns : [['name', 'number'], ['seq', 'text']] -- Table: artists columns : [['id', 'text'], ['name', 'text']] -- Table: albums columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']] -- Table: employees columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']] -- Table: customers columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']] -- Table: genres columns : [['id', 'number'], ['name', 'text']] -- Table: invoices columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']] -- Table: media types columns : [['id', 'number'], ['name', 'text']] -- Table: tracks columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']] -- Table: invoice lines columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']] -- Table: playlists columns : [['id', 'number'], ['name', 'text']] -- Table: playlist tracks columns : [['playlist id', 'number'], ['track id', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the states with the most invoices?` to a syntactically-correct PostgreSQL query.
SELECT billing_state , COUNT(*) FROM invoices WHERE billing_country = "USA" GROUP BY billing_state ORDER BY COUNT(*) DESC LIMIT 1;
List the number of invoices and the invoice total from California.
-- Language PostgreSQL -- Tables: -- Table: sqlite sequence columns : [['name', 'number'], ['seq', 'text']] -- Table: artists columns : [['id', 'text'], ['name', 'text']] -- Table: albums columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']] -- Table: employees columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']] -- Table: customers columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']] -- Table: genres columns : [['id', 'number'], ['name', 'text']] -- Table: invoices columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']] -- Table: media types columns : [['id', 'number'], ['name', 'text']] -- Table: tracks columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']] -- Table: invoice lines columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']] -- Table: playlists columns : [['id', 'number'], ['name', 'text']] -- Table: playlist tracks columns : [['playlist id', 'number'], ['track id', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `List the number of invoices and the invoice total from California.` to a syntactically-correct PostgreSQL query.
SELECT billing_state , COUNT(*) , SUM(total) FROM invoices WHERE billing_state = "CA";
What is the number of invoices and total money billed in them from CA?
-- Language PostgreSQL -- Tables: -- Table: sqlite sequence columns : [['name', 'number'], ['seq', 'text']] -- Table: artists columns : [['id', 'text'], ['name', 'text']] -- Table: albums columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']] -- Table: employees columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']] -- Table: customers columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']] -- Table: genres columns : [['id', 'number'], ['name', 'text']] -- Table: invoices columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']] -- Table: media types columns : [['id', 'number'], ['name', 'text']] -- Table: tracks columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']] -- Table: invoice lines columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']] -- Table: playlists columns : [['id', 'number'], ['name', 'text']] -- Table: playlist tracks columns : [['playlist id', 'number'], ['track id', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the number of invoices and total money billed in them from CA?` to a syntactically-correct PostgreSQL query.
SELECT billing_state , COUNT(*) , SUM(total) FROM invoices WHERE billing_state = "CA";
List Aerosmith's albums.
-- Language PostgreSQL -- Tables: -- Table: sqlite sequence columns : [['name', 'number'], ['seq', 'text']] -- Table: artists columns : [['id', 'text'], ['name', 'text']] -- Table: albums columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']] -- Table: employees columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']] -- Table: customers columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']] -- Table: genres columns : [['id', 'number'], ['name', 'text']] -- Table: invoices columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']] -- Table: media types columns : [['id', 'number'], ['name', 'text']] -- Table: tracks columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']] -- Table: invoice lines columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']] -- Table: playlists columns : [['id', 'number'], ['name', 'text']] -- Table: playlist tracks columns : [['playlist id', 'number'], ['track id', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `List Aerosmith's albums.` to a syntactically-correct PostgreSQL query.
SELECT T1.title FROM albums AS T1 JOIN artists AS T2 ON T1.artist_id = T2.id WHERE T2.name = "Aerosmith";
What are the titles of all the Aerosmith albums?
-- Language PostgreSQL -- Tables: -- Table: sqlite sequence columns : [['name', 'number'], ['seq', 'text']] -- Table: artists columns : [['id', 'text'], ['name', 'text']] -- Table: albums columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']] -- Table: employees columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']] -- Table: customers columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']] -- Table: genres columns : [['id', 'number'], ['name', 'text']] -- Table: invoices columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']] -- Table: media types columns : [['id', 'number'], ['name', 'text']] -- Table: tracks columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']] -- Table: invoice lines columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']] -- Table: playlists columns : [['id', 'number'], ['name', 'text']] -- Table: playlist tracks columns : [['playlist id', 'number'], ['track id', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the titles of all the Aerosmith albums?` to a syntactically-correct PostgreSQL query.
SELECT T1.title FROM albums AS T1 JOIN artists AS T2 ON T1.artist_id = T2.id WHERE T2.name = "Aerosmith";
How many albums does Billy Cobham has?
-- Language PostgreSQL -- Tables: -- Table: sqlite sequence columns : [['name', 'number'], ['seq', 'text']] -- Table: artists columns : [['id', 'text'], ['name', 'text']] -- Table: albums columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']] -- Table: employees columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']] -- Table: customers columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']] -- Table: genres columns : [['id', 'number'], ['name', 'text']] -- Table: invoices columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']] -- Table: media types columns : [['id', 'number'], ['name', 'text']] -- Table: tracks columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']] -- Table: invoice lines columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']] -- Table: playlists columns : [['id', 'number'], ['name', 'text']] -- Table: playlist tracks columns : [['playlist id', 'number'], ['track id', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many albums does Billy Cobham has?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM albums AS T1 JOIN artists AS T2 ON T1.artist_id = T2.id WHERE T2.name = "Billy Cobham";
How many albums has Billy Cobam released?
-- Language PostgreSQL -- Tables: -- Table: sqlite sequence columns : [['name', 'number'], ['seq', 'text']] -- Table: artists columns : [['id', 'text'], ['name', 'text']] -- Table: albums columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']] -- Table: employees columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']] -- Table: customers columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']] -- Table: genres columns : [['id', 'number'], ['name', 'text']] -- Table: invoices columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']] -- Table: media types columns : [['id', 'number'], ['name', 'text']] -- Table: tracks columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']] -- Table: invoice lines columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']] -- Table: playlists columns : [['id', 'number'], ['name', 'text']] -- Table: playlist tracks columns : [['playlist id', 'number'], ['track id', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many albums has Billy Cobam released?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM albums AS T1 JOIN artists AS T2 ON T1.artist_id = T2.id WHERE T2.name = "Billy Cobham";
Eduardo Martins is a customer at which company?
-- Language PostgreSQL -- Tables: -- Table: sqlite sequence columns : [['name', 'number'], ['seq', 'text']] -- Table: artists columns : [['id', 'text'], ['name', 'text']] -- Table: albums columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']] -- Table: employees columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']] -- Table: customers columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']] -- Table: genres columns : [['id', 'number'], ['name', 'text']] -- Table: invoices columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']] -- Table: media types columns : [['id', 'number'], ['name', 'text']] -- Table: tracks columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']] -- Table: invoice lines columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']] -- Table: playlists columns : [['id', 'number'], ['name', 'text']] -- Table: playlist tracks columns : [['playlist id', 'number'], ['track id', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Eduardo Martins is a customer at which company?` to a syntactically-correct PostgreSQL query.
SELECT company FROM customers WHERE first_name = "Eduardo" AND last_name = "Martins";
What is the company where Eduardo Martins is a customer?
-- Language PostgreSQL -- Tables: -- Table: sqlite sequence columns : [['name', 'number'], ['seq', 'text']] -- Table: artists columns : [['id', 'text'], ['name', 'text']] -- Table: albums columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']] -- Table: employees columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']] -- Table: customers columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']] -- Table: genres columns : [['id', 'number'], ['name', 'text']] -- Table: invoices columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']] -- Table: media types columns : [['id', 'number'], ['name', 'text']] -- Table: tracks columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']] -- Table: invoice lines columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']] -- Table: playlists columns : [['id', 'number'], ['name', 'text']] -- Table: playlist tracks columns : [['playlist id', 'number'], ['track id', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the company where Eduardo Martins is a customer?` to a syntactically-correct PostgreSQL query.
SELECT company FROM customers WHERE first_name = "Eduardo" AND last_name = "Martins";
What is Astrid Gruber's email and phone number?
-- Language PostgreSQL -- Tables: -- Table: sqlite sequence columns : [['name', 'number'], ['seq', 'text']] -- Table: artists columns : [['id', 'text'], ['name', 'text']] -- Table: albums columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']] -- Table: employees columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']] -- Table: customers columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']] -- Table: genres columns : [['id', 'number'], ['name', 'text']] -- Table: invoices columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']] -- Table: media types columns : [['id', 'number'], ['name', 'text']] -- Table: tracks columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']] -- Table: invoice lines columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']] -- Table: playlists columns : [['id', 'number'], ['name', 'text']] -- Table: playlist tracks columns : [['playlist id', 'number'], ['track id', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is Astrid Gruber's email and phone number?` to a syntactically-correct PostgreSQL query.
SELECT email , phone FROM customers WHERE first_name = "Astrid" AND last_name = "Gruber";
What is the email and phone number of Astrid Gruber the customer?
-- Language PostgreSQL -- Tables: -- Table: sqlite sequence columns : [['name', 'number'], ['seq', 'text']] -- Table: artists columns : [['id', 'text'], ['name', 'text']] -- Table: albums columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']] -- Table: employees columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']] -- Table: customers columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']] -- Table: genres columns : [['id', 'number'], ['name', 'text']] -- Table: invoices columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']] -- Table: media types columns : [['id', 'number'], ['name', 'text']] -- Table: tracks columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']] -- Table: invoice lines columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']] -- Table: playlists columns : [['id', 'number'], ['name', 'text']] -- Table: playlist tracks columns : [['playlist id', 'number'], ['track id', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the email and phone number of Astrid Gruber the customer?` to a syntactically-correct PostgreSQL query.
SELECT email , phone FROM customers WHERE first_name = "Astrid" AND last_name = "Gruber";
How many customers live in Prague city?
-- Language PostgreSQL -- Tables: -- Table: sqlite sequence columns : [['name', 'number'], ['seq', 'text']] -- Table: artists columns : [['id', 'text'], ['name', 'text']] -- Table: albums columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']] -- Table: employees columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']] -- Table: customers columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']] -- Table: genres columns : [['id', 'number'], ['name', 'text']] -- Table: invoices columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']] -- Table: media types columns : [['id', 'number'], ['name', 'text']] -- Table: tracks columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']] -- Table: invoice lines columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']] -- Table: playlists columns : [['id', 'number'], ['name', 'text']] -- Table: playlist tracks columns : [['playlist id', 'number'], ['track id', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many customers live in Prague city?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM customers WHERE city = "Prague";
How many customers live in the city of Prague?
-- Language PostgreSQL -- Tables: -- Table: sqlite sequence columns : [['name', 'number'], ['seq', 'text']] -- Table: artists columns : [['id', 'text'], ['name', 'text']] -- Table: albums columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']] -- Table: employees columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']] -- Table: customers columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']] -- Table: genres columns : [['id', 'number'], ['name', 'text']] -- Table: invoices columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']] -- Table: media types columns : [['id', 'number'], ['name', 'text']] -- Table: tracks columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']] -- Table: invoice lines columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']] -- Table: playlists columns : [['id', 'number'], ['name', 'text']] -- Table: playlist tracks columns : [['playlist id', 'number'], ['track id', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many customers live in the city of Prague?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM customers WHERE city = "Prague";
How many customers in state of CA?
-- Language PostgreSQL -- Tables: -- Table: sqlite sequence columns : [['name', 'number'], ['seq', 'text']] -- Table: artists columns : [['id', 'text'], ['name', 'text']] -- Table: albums columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']] -- Table: employees columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']] -- Table: customers columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']] -- Table: genres columns : [['id', 'number'], ['name', 'text']] -- Table: invoices columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']] -- Table: media types columns : [['id', 'number'], ['name', 'text']] -- Table: tracks columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']] -- Table: invoice lines columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']] -- Table: playlists columns : [['id', 'number'], ['name', 'text']] -- Table: playlist tracks columns : [['playlist id', 'number'], ['track id', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many customers in state of CA?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM customers WHERE state = "CA";
How many customers are from California?
-- Language PostgreSQL -- Tables: -- Table: sqlite sequence columns : [['name', 'number'], ['seq', 'text']] -- Table: artists columns : [['id', 'text'], ['name', 'text']] -- Table: albums columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']] -- Table: employees columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']] -- Table: customers columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']] -- Table: genres columns : [['id', 'number'], ['name', 'text']] -- Table: invoices columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']] -- Table: media types columns : [['id', 'number'], ['name', 'text']] -- Table: tracks columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']] -- Table: invoice lines columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']] -- Table: playlists columns : [['id', 'number'], ['name', 'text']] -- Table: playlist tracks columns : [['playlist id', 'number'], ['track id', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many customers are from California?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM customers WHERE state = "CA";
What country does Roberto Almeida live?
-- Language PostgreSQL -- Tables: -- Table: sqlite sequence columns : [['name', 'number'], ['seq', 'text']] -- Table: artists columns : [['id', 'text'], ['name', 'text']] -- Table: albums columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']] -- Table: employees columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']] -- Table: customers columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']] -- Table: genres columns : [['id', 'number'], ['name', 'text']] -- Table: invoices columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']] -- Table: media types columns : [['id', 'number'], ['name', 'text']] -- Table: tracks columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']] -- Table: invoice lines columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']] -- Table: playlists columns : [['id', 'number'], ['name', 'text']] -- Table: playlist tracks columns : [['playlist id', 'number'], ['track id', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What country does Roberto Almeida live?` to a syntactically-correct PostgreSQL query.
SELECT country FROM customers WHERE first_name = "Roberto" AND last_name = "Almeida";
In which country does Roberto Almeida?
-- Language PostgreSQL -- Tables: -- Table: sqlite sequence columns : [['name', 'number'], ['seq', 'text']] -- Table: artists columns : [['id', 'text'], ['name', 'text']] -- Table: albums columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']] -- Table: employees columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']] -- Table: customers columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']] -- Table: genres columns : [['id', 'number'], ['name', 'text']] -- Table: invoices columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']] -- Table: media types columns : [['id', 'number'], ['name', 'text']] -- Table: tracks columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']] -- Table: invoice lines columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']] -- Table: playlists columns : [['id', 'number'], ['name', 'text']] -- Table: playlist tracks columns : [['playlist id', 'number'], ['track id', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `In which country does Roberto Almeida?` to a syntactically-correct PostgreSQL query.
SELECT country FROM customers WHERE first_name = "Roberto" AND last_name = "Almeida";
List the name of albums that are released by aritist whose name has 'Led'
-- Language PostgreSQL -- Tables: -- Table: sqlite sequence columns : [['name', 'number'], ['seq', 'text']] -- Table: artists columns : [['id', 'text'], ['name', 'text']] -- Table: albums columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']] -- Table: employees columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']] -- Table: customers columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']] -- Table: genres columns : [['id', 'number'], ['name', 'text']] -- Table: invoices columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']] -- Table: media types columns : [['id', 'number'], ['name', 'text']] -- Table: tracks columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']] -- Table: invoice lines columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']] -- Table: playlists columns : [['id', 'number'], ['name', 'text']] -- Table: playlist tracks columns : [['playlist id', 'number'], ['track id', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `List the name of albums that are released by aritist whose name has 'Led'` to a syntactically-correct PostgreSQL query.
SELECT T2.title FROM artists AS T1 JOIN albums AS T2 ON T1.id = T2.artist_id WHERE T1.name LIKE '%Led%'
What is the title of the album that was released by the artist whose name has the phrase 'Led'?
-- Language PostgreSQL -- Tables: -- Table: sqlite sequence columns : [['name', 'number'], ['seq', 'text']] -- Table: artists columns : [['id', 'text'], ['name', 'text']] -- Table: albums columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']] -- Table: employees columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']] -- Table: customers columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']] -- Table: genres columns : [['id', 'number'], ['name', 'text']] -- Table: invoices columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']] -- Table: media types columns : [['id', 'number'], ['name', 'text']] -- Table: tracks columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']] -- Table: invoice lines columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']] -- Table: playlists columns : [['id', 'number'], ['name', 'text']] -- Table: playlist tracks columns : [['playlist id', 'number'], ['track id', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the title of the album that was released by the artist whose name has the phrase 'Led'?` to a syntactically-correct PostgreSQL query.
SELECT T2.title FROM artists AS T1 JOIN albums AS T2 ON T1.id = T2.artist_id WHERE T1.name LIKE '%Led%'
How many customers does Steve Johnson support?
-- Language PostgreSQL -- Tables: -- Table: sqlite sequence columns : [['name', 'number'], ['seq', 'text']] -- Table: artists columns : [['id', 'text'], ['name', 'text']] -- Table: albums columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']] -- Table: employees columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']] -- Table: customers columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']] -- Table: genres columns : [['id', 'number'], ['name', 'text']] -- Table: invoices columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']] -- Table: media types columns : [['id', 'number'], ['name', 'text']] -- Table: tracks columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']] -- Table: invoice lines columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']] -- Table: playlists columns : [['id', 'number'], ['name', 'text']] -- Table: playlist tracks columns : [['playlist id', 'number'], ['track id', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many customers does Steve Johnson support?` to a syntactically-correct PostgreSQL query.
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";
What is the count of customers that Steve Johnson supports?
-- Language PostgreSQL -- Tables: -- Table: sqlite sequence columns : [['name', 'number'], ['seq', 'text']] -- Table: artists columns : [['id', 'text'], ['name', 'text']] -- Table: albums columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']] -- Table: employees columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']] -- Table: customers columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']] -- Table: genres columns : [['id', 'number'], ['name', 'text']] -- Table: invoices columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']] -- Table: media types columns : [['id', 'number'], ['name', 'text']] -- Table: tracks columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']] -- Table: invoice lines columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']] -- Table: playlists columns : [['id', 'number'], ['name', 'text']] -- Table: playlist tracks columns : [['playlist id', 'number'], ['track id', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the count of customers that Steve Johnson supports?` to a syntactically-correct PostgreSQL query.
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";
What is the title, phone and hire date of Nancy Edwards?
-- Language PostgreSQL -- Tables: -- Table: sqlite sequence columns : [['name', 'number'], ['seq', 'text']] -- Table: artists columns : [['id', 'text'], ['name', 'text']] -- Table: albums columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']] -- Table: employees columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']] -- Table: customers columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']] -- Table: genres columns : [['id', 'number'], ['name', 'text']] -- Table: invoices columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']] -- Table: media types columns : [['id', 'number'], ['name', 'text']] -- Table: tracks columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']] -- Table: invoice lines columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']] -- Table: playlists columns : [['id', 'number'], ['name', 'text']] -- Table: playlist tracks columns : [['playlist id', 'number'], ['track id', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the title, phone and hire date of Nancy Edwards?` to a syntactically-correct PostgreSQL query.
SELECT title , phone , hire_date FROM employees WHERE first_name = "Nancy" AND last_name = "Edwards";
What is the title, phone number and hire date for the employee named Nancy Edwards?
-- Language PostgreSQL -- Tables: -- Table: sqlite sequence columns : [['name', 'number'], ['seq', 'text']] -- Table: artists columns : [['id', 'text'], ['name', 'text']] -- Table: albums columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']] -- Table: employees columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']] -- Table: customers columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']] -- Table: genres columns : [['id', 'number'], ['name', 'text']] -- Table: invoices columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']] -- Table: media types columns : [['id', 'number'], ['name', 'text']] -- Table: tracks columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']] -- Table: invoice lines columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']] -- Table: playlists columns : [['id', 'number'], ['name', 'text']] -- Table: playlist tracks columns : [['playlist id', 'number'], ['track id', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the title, phone number and hire date for the employee named Nancy Edwards?` to a syntactically-correct PostgreSQL query.
SELECT title , phone , hire_date FROM employees WHERE first_name = "Nancy" AND last_name = "Edwards";
find the full name of employees who report to Nancy Edwards?
-- Language PostgreSQL -- Tables: -- Table: sqlite sequence columns : [['name', 'number'], ['seq', 'text']] -- Table: artists columns : [['id', 'text'], ['name', 'text']] -- Table: albums columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']] -- Table: employees columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']] -- Table: customers columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']] -- Table: genres columns : [['id', 'number'], ['name', 'text']] -- Table: invoices columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']] -- Table: media types columns : [['id', 'number'], ['name', 'text']] -- Table: tracks columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']] -- Table: invoice lines columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']] -- Table: playlists columns : [['id', 'number'], ['name', 'text']] -- Table: playlist tracks columns : [['playlist id', 'number'], ['track id', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `find the full name of employees who report to Nancy Edwards?` to a syntactically-correct PostgreSQL query.
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";
What is the first and last name of the employee who reports to Nancy Edwards?
-- Language PostgreSQL -- Tables: -- Table: sqlite sequence columns : [['name', 'number'], ['seq', 'text']] -- Table: artists columns : [['id', 'text'], ['name', 'text']] -- Table: albums columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']] -- Table: employees columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']] -- Table: customers columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']] -- Table: genres columns : [['id', 'number'], ['name', 'text']] -- Table: invoices columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']] -- Table: media types columns : [['id', 'number'], ['name', 'text']] -- Table: tracks columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']] -- Table: invoice lines columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']] -- Table: playlists columns : [['id', 'number'], ['name', 'text']] -- Table: playlist tracks columns : [['playlist id', 'number'], ['track id', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the first and last name of the employee who reports to Nancy Edwards?` to a syntactically-correct PostgreSQL query.
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";
What is the address of employee Nancy Edwards?
-- Language PostgreSQL -- Tables: -- Table: sqlite sequence columns : [['name', 'number'], ['seq', 'text']] -- Table: artists columns : [['id', 'text'], ['name', 'text']] -- Table: albums columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']] -- Table: employees columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']] -- Table: customers columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']] -- Table: genres columns : [['id', 'number'], ['name', 'text']] -- Table: invoices columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']] -- Table: media types columns : [['id', 'number'], ['name', 'text']] -- Table: tracks columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']] -- Table: invoice lines columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']] -- Table: playlists columns : [['id', 'number'], ['name', 'text']] -- Table: playlist tracks columns : [['playlist id', 'number'], ['track id', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the address of employee Nancy Edwards?` to a syntactically-correct PostgreSQL query.
SELECT address FROM employees WHERE first_name = "Nancy" AND last_name = "Edwards";
What is Nancy Edwards's address?
-- Language PostgreSQL -- Tables: -- Table: sqlite sequence columns : [['name', 'number'], ['seq', 'text']] -- Table: artists columns : [['id', 'text'], ['name', 'text']] -- Table: albums columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']] -- Table: employees columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']] -- Table: customers columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']] -- Table: genres columns : [['id', 'number'], ['name', 'text']] -- Table: invoices columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']] -- Table: media types columns : [['id', 'number'], ['name', 'text']] -- Table: tracks columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']] -- Table: invoice lines columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']] -- Table: playlists columns : [['id', 'number'], ['name', 'text']] -- Table: playlist tracks columns : [['playlist id', 'number'], ['track id', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is Nancy Edwards's address?` to a syntactically-correct PostgreSQL query.
SELECT address FROM employees WHERE first_name = "Nancy" AND last_name = "Edwards";
Find the full name of employee who supported the most number of customers.
-- Language PostgreSQL -- Tables: -- Table: sqlite sequence columns : [['name', 'number'], ['seq', 'text']] -- Table: artists columns : [['id', 'text'], ['name', 'text']] -- Table: albums columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']] -- Table: employees columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']] -- Table: customers columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']] -- Table: genres columns : [['id', 'number'], ['name', 'text']] -- Table: invoices columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']] -- Table: media types columns : [['id', 'number'], ['name', 'text']] -- Table: tracks columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']] -- Table: invoice lines columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']] -- Table: playlists columns : [['id', 'number'], ['name', 'text']] -- Table: playlist tracks columns : [['playlist id', 'number'], ['track id', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Find the full name of employee who supported the most number of customers.` to a syntactically-correct PostgreSQL query.
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
What is the full name of the employee who has the most customers?
-- Language PostgreSQL -- Tables: -- Table: sqlite sequence columns : [['name', 'number'], ['seq', 'text']] -- Table: artists columns : [['id', 'text'], ['name', 'text']] -- Table: albums columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']] -- Table: employees columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']] -- Table: customers columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']] -- Table: genres columns : [['id', 'number'], ['name', 'text']] -- Table: invoices columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']] -- Table: media types columns : [['id', 'number'], ['name', 'text']] -- Table: tracks columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']] -- Table: invoice lines columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']] -- Table: playlists columns : [['id', 'number'], ['name', 'text']] -- Table: playlist tracks columns : [['playlist id', 'number'], ['track id', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the full name of the employee who has the most customers?` to a syntactically-correct PostgreSQL query.
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
How many employees are living in Canada?
-- Language PostgreSQL -- Tables: -- Table: sqlite sequence columns : [['name', 'number'], ['seq', 'text']] -- Table: artists columns : [['id', 'text'], ['name', 'text']] -- Table: albums columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']] -- Table: employees columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']] -- Table: customers columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']] -- Table: genres columns : [['id', 'number'], ['name', 'text']] -- Table: invoices columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']] -- Table: media types columns : [['id', 'number'], ['name', 'text']] -- Table: tracks columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']] -- Table: invoice lines columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']] -- Table: playlists columns : [['id', 'number'], ['name', 'text']] -- Table: playlist tracks columns : [['playlist id', 'number'], ['track id', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many employees are living in Canada?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM employees WHERE country = "Canada";
How many employees live in Canada?
-- Language PostgreSQL -- Tables: -- Table: sqlite sequence columns : [['name', 'number'], ['seq', 'text']] -- Table: artists columns : [['id', 'text'], ['name', 'text']] -- Table: albums columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']] -- Table: employees columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']] -- Table: customers columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']] -- Table: genres columns : [['id', 'number'], ['name', 'text']] -- Table: invoices columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']] -- Table: media types columns : [['id', 'number'], ['name', 'text']] -- Table: tracks columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']] -- Table: invoice lines columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']] -- Table: playlists columns : [['id', 'number'], ['name', 'text']] -- Table: playlist tracks columns : [['playlist id', 'number'], ['track id', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many employees live in Canada?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM employees WHERE country = "Canada";
What is employee Nancy Edwards's phone number?
-- Language PostgreSQL -- Tables: -- Table: sqlite sequence columns : [['name', 'number'], ['seq', 'text']] -- Table: artists columns : [['id', 'text'], ['name', 'text']] -- Table: albums columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']] -- Table: employees columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']] -- Table: customers columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']] -- Table: genres columns : [['id', 'number'], ['name', 'text']] -- Table: invoices columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']] -- Table: media types columns : [['id', 'number'], ['name', 'text']] -- Table: tracks columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']] -- Table: invoice lines columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']] -- Table: playlists columns : [['id', 'number'], ['name', 'text']] -- Table: playlist tracks columns : [['playlist id', 'number'], ['track id', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is employee Nancy Edwards's phone number?` to a syntactically-correct PostgreSQL query.
SELECT phone FROM employees WHERE first_name = "Nancy" AND last_name = "Edwards";
What is the the phone number of Nancy Edwards?
-- Language PostgreSQL -- Tables: -- Table: sqlite sequence columns : [['name', 'number'], ['seq', 'text']] -- Table: artists columns : [['id', 'text'], ['name', 'text']] -- Table: albums columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']] -- Table: employees columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']] -- Table: customers columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']] -- Table: genres columns : [['id', 'number'], ['name', 'text']] -- Table: invoices columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']] -- Table: media types columns : [['id', 'number'], ['name', 'text']] -- Table: tracks columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']] -- Table: invoice lines columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']] -- Table: playlists columns : [['id', 'number'], ['name', 'text']] -- Table: playlist tracks columns : [['playlist id', 'number'], ['track id', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the the phone number of Nancy Edwards?` to a syntactically-correct PostgreSQL query.
SELECT phone FROM employees WHERE first_name = "Nancy" AND last_name = "Edwards";
Who is the youngest employee in the company? List employee's first and last name.
-- Language PostgreSQL -- Tables: -- Table: sqlite sequence columns : [['name', 'number'], ['seq', 'text']] -- Table: artists columns : [['id', 'text'], ['name', 'text']] -- Table: albums columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']] -- Table: employees columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']] -- Table: customers columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']] -- Table: genres columns : [['id', 'number'], ['name', 'text']] -- Table: invoices columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']] -- Table: media types columns : [['id', 'number'], ['name', 'text']] -- Table: tracks columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']] -- Table: invoice lines columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']] -- Table: playlists columns : [['id', 'number'], ['name', 'text']] -- Table: playlist tracks columns : [['playlist id', 'number'], ['track id', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Who is the youngest employee in the company? List employee's first and last name.` to a syntactically-correct PostgreSQL query.
SELECT first_name , last_name FROM employees ORDER BY birth_date DESC LIMIT 1;