brief_instruction
stringlengths
16
224
instruction
stringlengths
687
8.77k
output
stringlengths
18
577
How many different types of sports do we offer?
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: video games columns : [['game id', 'number'], ['game name', 'text'], ['game type', 'text']] -- Table: plays games columns : [['student id', 'number'], ['game id', 'number'], ['hours played', 'number']] -- Table: sports info columns : [['student id', 'number'], ['sport name', 'text'], ['hours per week', 'number'], ['games played', 'number'], ['on scholarship', '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 different types of sports do we offer?` to a syntactically-correct PostgreSQL query.
SELECT count(DISTINCT sportname) FROM Sportsinfo
How many students play sports?
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: video games columns : [['game id', 'number'], ['game name', 'text'], ['game type', 'text']] -- Table: plays games columns : [['student id', 'number'], ['game id', 'number'], ['hours played', 'number']] -- Table: sports info columns : [['student id', 'number'], ['sport name', 'text'], ['hours per week', 'number'], ['games played', 'number'], ['on scholarship', '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 play sports?` to a syntactically-correct PostgreSQL query.
SELECT count(DISTINCT StuID) FROM Sportsinfo
How many different students are involved in sports?
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: video games columns : [['game id', 'number'], ['game name', 'text'], ['game type', 'text']] -- Table: plays games columns : [['student id', 'number'], ['game id', 'number'], ['hours played', 'number']] -- Table: sports info columns : [['student id', 'number'], ['sport name', 'text'], ['hours per week', 'number'], ['games played', 'number'], ['on scholarship', '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 different students are involved in sports?` to a syntactically-correct PostgreSQL query.
SELECT count(DISTINCT StuID) FROM Sportsinfo
List ids for all student who are on scholarship.
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: video games columns : [['game id', 'number'], ['game name', 'text'], ['game type', 'text']] -- Table: plays games columns : [['student id', 'number'], ['game id', 'number'], ['hours played', 'number']] -- Table: sports info columns : [['student id', 'number'], ['sport name', 'text'], ['hours per week', 'number'], ['games played', 'number'], ['on scholarship', '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 ids for all student who are on scholarship.` to a syntactically-correct PostgreSQL query.
SELECT StuID FROM Sportsinfo WHERE onscholarship = 'Y'
What are the ids for all sporty students who are on scholarship?
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: video games columns : [['game id', 'number'], ['game name', 'text'], ['game type', 'text']] -- Table: plays games columns : [['student id', 'number'], ['game id', 'number'], ['hours played', 'number']] -- Table: sports info columns : [['student id', 'number'], ['sport name', 'text'], ['hours per week', 'number'], ['games played', 'number'], ['on scholarship', '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 ids for all sporty students who are on scholarship?` to a syntactically-correct PostgreSQL query.
SELECT StuID FROM Sportsinfo WHERE onscholarship = 'Y'
Show last names for all student who are on scholarship.
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: video games columns : [['game id', 'number'], ['game name', 'text'], ['game type', 'text']] -- Table: plays games columns : [['student id', 'number'], ['game id', 'number'], ['hours played', 'number']] -- Table: sports info columns : [['student id', 'number'], ['sport name', 'text'], ['hours per week', 'number'], ['games played', 'number'], ['on scholarship', '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 last names for all student who are on scholarship.` to a syntactically-correct PostgreSQL query.
SELECT T2.Lname FROM Sportsinfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T1.onscholarship = 'Y'
What are the last names for all scholarship students?
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: video games columns : [['game id', 'number'], ['game name', 'text'], ['game type', 'text']] -- Table: plays games columns : [['student id', 'number'], ['game id', 'number'], ['hours played', 'number']] -- Table: sports info columns : [['student id', 'number'], ['sport name', 'text'], ['hours per week', 'number'], ['games played', 'number'], ['on scholarship', '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 for all scholarship students?` to a syntactically-correct PostgreSQL query.
SELECT T2.Lname FROM Sportsinfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T1.onscholarship = 'Y'
How many games are played for all students?
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: video games columns : [['game id', 'number'], ['game name', 'text'], ['game type', 'text']] -- Table: plays games columns : [['student id', 'number'], ['game id', 'number'], ['hours played', 'number']] -- Table: sports info columns : [['student id', 'number'], ['sport name', 'text'], ['hours per week', 'number'], ['games played', 'number'], ['on scholarship', '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 games are played for all students?` to a syntactically-correct PostgreSQL query.
SELECT sum(gamesplayed) FROM Sportsinfo
What is the total number of games played?
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: video games columns : [['game id', 'number'], ['game name', 'text'], ['game type', 'text']] -- Table: plays games columns : [['student id', 'number'], ['game id', 'number'], ['hours played', 'number']] -- Table: sports info columns : [['student id', 'number'], ['sport name', 'text'], ['hours per week', 'number'], ['games played', 'number'], ['on scholarship', '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 total number of games played?` to a syntactically-correct PostgreSQL query.
SELECT sum(gamesplayed) FROM Sportsinfo
How many games are played for all football games by students on scholarship?
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: video games columns : [['game id', 'number'], ['game name', 'text'], ['game type', 'text']] -- Table: plays games columns : [['student id', 'number'], ['game id', 'number'], ['hours played', 'number']] -- Table: sports info columns : [['student id', 'number'], ['sport name', 'text'], ['hours per week', 'number'], ['games played', 'number'], ['on scholarship', '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 games are played for all football games by students on scholarship?` to a syntactically-correct PostgreSQL query.
SELECT sum(gamesplayed) FROM Sportsinfo WHERE sportname = "Football" AND onscholarship = 'Y'
What is the total number of all football games played by scholarship students?
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: video games columns : [['game id', 'number'], ['game name', 'text'], ['game type', 'text']] -- Table: plays games columns : [['student id', 'number'], ['game id', 'number'], ['hours played', 'number']] -- Table: sports info columns : [['student id', 'number'], ['sport name', 'text'], ['hours per week', 'number'], ['games played', 'number'], ['on scholarship', '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 total number of all football games played by scholarship students?` to a syntactically-correct PostgreSQL query.
SELECT sum(gamesplayed) FROM Sportsinfo WHERE sportname = "Football" AND onscholarship = 'Y'
Show all sport name and the number of students.
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: video games columns : [['game id', 'number'], ['game name', 'text'], ['game type', 'text']] -- Table: plays games columns : [['student id', 'number'], ['game id', 'number'], ['hours played', 'number']] -- Table: sports info columns : [['student id', 'number'], ['sport name', 'text'], ['hours per week', 'number'], ['games played', 'number'], ['on scholarship', '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 sport name and the number of students.` to a syntactically-correct PostgreSQL query.
SELECT sportname , count(*) FROM Sportsinfo GROUP BY sportname
How many students play each sport?
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: video games columns : [['game id', 'number'], ['game name', 'text'], ['game type', 'text']] -- Table: plays games columns : [['student id', 'number'], ['game id', 'number'], ['hours played', 'number']] -- Table: sports info columns : [['student id', 'number'], ['sport name', 'text'], ['hours per week', 'number'], ['games played', 'number'], ['on scholarship', '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 play each sport?` to a syntactically-correct PostgreSQL query.
SELECT sportname , count(*) FROM Sportsinfo GROUP BY sportname
Show all student IDs with the number of sports and total number of games played
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: video games columns : [['game id', 'number'], ['game name', 'text'], ['game type', 'text']] -- Table: plays games columns : [['student id', 'number'], ['game id', 'number'], ['hours played', 'number']] -- Table: sports info columns : [['student id', 'number'], ['sport name', 'text'], ['hours per week', 'number'], ['games played', 'number'], ['on scholarship', '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 with the number of sports and total number of games played` to a syntactically-correct PostgreSQL query.
SELECT StuID , count(*) , sum(gamesplayed) FROM Sportsinfo GROUP BY StuID
What are the ids of all students along with how many sports and games did they play?
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: video games columns : [['game id', 'number'], ['game name', 'text'], ['game type', 'text']] -- Table: plays games columns : [['student id', 'number'], ['game id', 'number'], ['hours played', 'number']] -- Table: sports info columns : [['student id', 'number'], ['sport name', 'text'], ['hours per week', 'number'], ['games played', 'number'], ['on scholarship', '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 ids of all students along with how many sports and games did they play?` to a syntactically-correct PostgreSQL query.
SELECT StuID , count(*) , sum(gamesplayed) FROM Sportsinfo GROUP BY StuID
Show all student IDs with more than total 10 hours per week on all sports played.
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: video games columns : [['game id', 'number'], ['game name', 'text'], ['game type', 'text']] -- Table: plays games columns : [['student id', 'number'], ['game id', 'number'], ['hours played', 'number']] -- Table: sports info columns : [['student id', 'number'], ['sport name', 'text'], ['hours per week', 'number'], ['games played', 'number'], ['on scholarship', '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 with more than total 10 hours per week on all sports played.` to a syntactically-correct PostgreSQL query.
SELECT StuID FROM Sportsinfo GROUP BY StuID HAVING sum(hoursperweek) > 10
What are the student IDs for everybody who worked for more than 10 hours per week on all sports?
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: video games columns : [['game id', 'number'], ['game name', 'text'], ['game type', 'text']] -- Table: plays games columns : [['student id', 'number'], ['game id', 'number'], ['hours played', 'number']] -- Table: sports info columns : [['student id', 'number'], ['sport name', 'text'], ['hours per week', 'number'], ['games played', 'number'], ['on scholarship', '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 for everybody who worked for more than 10 hours per week on all sports?` to a syntactically-correct PostgreSQL query.
SELECT StuID FROM Sportsinfo GROUP BY StuID HAVING sum(hoursperweek) > 10
What is the first name and last name of the student who have most number of sports?
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: video games columns : [['game id', 'number'], ['game name', 'text'], ['game type', 'text']] -- Table: plays games columns : [['student id', 'number'], ['game id', 'number'], ['hours played', 'number']] -- Table: sports info columns : [['student id', 'number'], ['sport name', 'text'], ['hours per week', 'number'], ['games played', 'number'], ['on scholarship', '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 first name and last name of the student who have most number of sports?` to a syntactically-correct PostgreSQL query.
SELECT T2.Fname , T2.Lname FROM Sportsinfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID GROUP BY T1.StuID ORDER BY count(*) DESC LIMIT 1
What is the first and last name of the student who played the most sports?
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: video games columns : [['game id', 'number'], ['game name', 'text'], ['game type', 'text']] -- Table: plays games columns : [['student id', 'number'], ['game id', 'number'], ['hours played', 'number']] -- Table: sports info columns : [['student id', 'number'], ['sport name', 'text'], ['hours per week', 'number'], ['games played', 'number'], ['on scholarship', '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 first and last name of the student who played the most sports?` to a syntactically-correct PostgreSQL query.
SELECT T2.Fname , T2.Lname FROM Sportsinfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID GROUP BY T1.StuID ORDER BY count(*) DESC LIMIT 1
Which sport has most number of students on scholarship?
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: video games columns : [['game id', 'number'], ['game name', 'text'], ['game type', 'text']] -- Table: plays games columns : [['student id', 'number'], ['game id', 'number'], ['hours played', 'number']] -- Table: sports info columns : [['student id', 'number'], ['sport name', 'text'], ['hours per week', 'number'], ['games played', 'number'], ['on scholarship', '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 sport has most number of students on scholarship?` to a syntactically-correct PostgreSQL query.
SELECT sportname FROM Sportsinfo WHERE onscholarship = 'Y' GROUP BY sportname ORDER BY count(*) DESC LIMIT 1
What is the sport with the most scholarship students?
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: video games columns : [['game id', 'number'], ['game name', 'text'], ['game type', 'text']] -- Table: plays games columns : [['student id', 'number'], ['game id', 'number'], ['hours played', 'number']] -- Table: sports info columns : [['student id', 'number'], ['sport name', 'text'], ['hours per week', 'number'], ['games played', 'number'], ['on scholarship', '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 sport with the most scholarship students?` to a syntactically-correct PostgreSQL query.
SELECT sportname FROM Sportsinfo WHERE onscholarship = 'Y' GROUP BY sportname ORDER BY count(*) DESC LIMIT 1
Show student ids who don't have any sports.
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: video games columns : [['game id', 'number'], ['game name', 'text'], ['game type', 'text']] -- Table: plays games columns : [['student id', 'number'], ['game id', 'number'], ['hours played', 'number']] -- Table: sports info columns : [['student id', 'number'], ['sport name', 'text'], ['hours per week', 'number'], ['games played', 'number'], ['on scholarship', '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 student ids who don't have any sports.` to a syntactically-correct PostgreSQL query.
SELECT StuID FROM Student EXCEPT SELECT StuID FROM Sportsinfo
What are the ids of all students who don't play sports?
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: video games columns : [['game id', 'number'], ['game name', 'text'], ['game type', 'text']] -- Table: plays games columns : [['student id', 'number'], ['game id', 'number'], ['hours played', 'number']] -- Table: sports info columns : [['student id', 'number'], ['sport name', 'text'], ['hours per week', 'number'], ['games played', 'number'], ['on scholarship', '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 ids of all students who don't play sports?` to a syntactically-correct PostgreSQL query.
SELECT StuID FROM Student EXCEPT SELECT StuID FROM Sportsinfo
Show student ids who are on scholarship and have major 600.
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: video games columns : [['game id', 'number'], ['game name', 'text'], ['game type', 'text']] -- Table: plays games columns : [['student id', 'number'], ['game id', 'number'], ['hours played', 'number']] -- Table: sports info columns : [['student id', 'number'], ['sport name', 'text'], ['hours per week', 'number'], ['games played', 'number'], ['on scholarship', '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 student ids who are on scholarship and have major 600.` to a syntactically-correct PostgreSQL query.
SELECT StuID FROM Student WHERE major = 600 INTERSECT SELECT StuID FROM Sportsinfo WHERE onscholarship = 'Y'
What are the student ids for those on scholarship in major number 600?
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: video games columns : [['game id', 'number'], ['game name', 'text'], ['game type', 'text']] -- Table: plays games columns : [['student id', 'number'], ['game id', 'number'], ['hours played', 'number']] -- Table: sports info columns : [['student id', 'number'], ['sport name', 'text'], ['hours per week', 'number'], ['games played', 'number'], ['on scholarship', '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 for those on scholarship in major number 600?` to a syntactically-correct PostgreSQL query.
SELECT StuID FROM Student WHERE major = 600 INTERSECT SELECT StuID FROM Sportsinfo WHERE onscholarship = 'Y'
Show student ids who are female and play football.
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: video games columns : [['game id', 'number'], ['game name', 'text'], ['game type', 'text']] -- Table: plays games columns : [['student id', 'number'], ['game id', 'number'], ['hours played', 'number']] -- Table: sports info columns : [['student id', 'number'], ['sport name', 'text'], ['hours per week', 'number'], ['games played', 'number'], ['on scholarship', '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 student ids who are female and play football.` to a syntactically-correct PostgreSQL query.
SELECT StuID FROM Student WHERE sex = 'F' INTERSECT SELECT StuID FROM Sportsinfo WHERE sportname = "Football"
What are the ids of all female students who play football?
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: video games columns : [['game id', 'number'], ['game name', 'text'], ['game type', 'text']] -- Table: plays games columns : [['student id', 'number'], ['game id', 'number'], ['hours played', 'number']] -- Table: sports info columns : [['student id', 'number'], ['sport name', 'text'], ['hours per week', 'number'], ['games played', 'number'], ['on scholarship', '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 ids of all female students who play football?` to a syntactically-correct PostgreSQL query.
SELECT StuID FROM Student WHERE sex = 'F' INTERSECT SELECT StuID FROM Sportsinfo WHERE sportname = "Football"
Show all male student ids who don't play football.
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: video games columns : [['game id', 'number'], ['game name', 'text'], ['game type', 'text']] -- Table: plays games columns : [['student id', 'number'], ['game id', 'number'], ['hours played', 'number']] -- Table: sports info columns : [['student id', 'number'], ['sport name', 'text'], ['hours per week', 'number'], ['games played', 'number'], ['on scholarship', '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 male student ids who don't play football.` to a syntactically-correct PostgreSQL query.
SELECT StuID FROM Student WHERE sex = 'M' EXCEPT SELECT StuID FROM Sportsinfo WHERE sportname = "Football"
What are the ids of all male students who do not play football?
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: video games columns : [['game id', 'number'], ['game name', 'text'], ['game type', 'text']] -- Table: plays games columns : [['student id', 'number'], ['game id', 'number'], ['hours played', 'number']] -- Table: sports info columns : [['student id', 'number'], ['sport name', 'text'], ['hours per week', 'number'], ['games played', 'number'], ['on scholarship', '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 ids of all male students who do not play football?` to a syntactically-correct PostgreSQL query.
SELECT StuID FROM Student WHERE sex = 'M' EXCEPT SELECT StuID FROM Sportsinfo WHERE sportname = "Football"
Show total hours per week and number of games played for student David Shieber.
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: video games columns : [['game id', 'number'], ['game name', 'text'], ['game type', 'text']] -- Table: plays games columns : [['student id', 'number'], ['game id', 'number'], ['hours played', 'number']] -- Table: sports info columns : [['student id', 'number'], ['sport name', 'text'], ['hours per week', 'number'], ['games played', 'number'], ['on scholarship', '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 total hours per week and number of games played for student David Shieber.` to a syntactically-correct PostgreSQL query.
SELECT sum(hoursperweek) , sum(gamesplayed) FROM Sportsinfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T2.Fname = "David" AND T2.Lname = "Shieber"
What is the total number of hours per work and number of games played by David Shieber?
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: video games columns : [['game id', 'number'], ['game name', 'text'], ['game type', 'text']] -- Table: plays games columns : [['student id', 'number'], ['game id', 'number'], ['hours played', 'number']] -- Table: sports info columns : [['student id', 'number'], ['sport name', 'text'], ['hours per week', 'number'], ['games played', 'number'], ['on scholarship', '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 total number of hours per work and number of games played by David Shieber?` to a syntactically-correct PostgreSQL query.
SELECT sum(hoursperweek) , sum(gamesplayed) FROM Sportsinfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T2.Fname = "David" AND T2.Lname = "Shieber"
Show total hours per week and number of games played for students under 20.
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: video games columns : [['game id', 'number'], ['game name', 'text'], ['game type', 'text']] -- Table: plays games columns : [['student id', 'number'], ['game id', 'number'], ['hours played', 'number']] -- Table: sports info columns : [['student id', 'number'], ['sport name', 'text'], ['hours per week', 'number'], ['games played', 'number'], ['on scholarship', '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 total hours per week and number of games played for students under 20.` to a syntactically-correct PostgreSQL query.
SELECT sum(hoursperweek) , sum(gamesplayed) FROM Sportsinfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T2.age < 20
What is the total number of hours per week and number of games played by students under 20?
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: video games columns : [['game id', 'number'], ['game name', 'text'], ['game type', 'text']] -- Table: plays games columns : [['student id', 'number'], ['game id', 'number'], ['hours played', 'number']] -- Table: sports info columns : [['student id', 'number'], ['sport name', 'text'], ['hours per week', 'number'], ['games played', 'number'], ['on scholarship', '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 total number of hours per week and number of games played by students under 20?` to a syntactically-correct PostgreSQL query.
SELECT sum(hoursperweek) , sum(gamesplayed) FROM Sportsinfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T2.age < 20
How many students play video games?
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: video games columns : [['game id', 'number'], ['game name', 'text'], ['game type', 'text']] -- Table: plays games columns : [['student id', 'number'], ['game id', 'number'], ['hours played', 'number']] -- Table: sports info columns : [['student id', 'number'], ['sport name', 'text'], ['hours per week', 'number'], ['games played', 'number'], ['on scholarship', '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 play video games?` to a syntactically-correct PostgreSQL query.
SELECT count(DISTINCT StuID) FROM Plays_games
How many different students play games?
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: video games columns : [['game id', 'number'], ['game name', 'text'], ['game type', 'text']] -- Table: plays games columns : [['student id', 'number'], ['game id', 'number'], ['hours played', 'number']] -- Table: sports info columns : [['student id', 'number'], ['sport name', 'text'], ['hours per week', 'number'], ['games played', 'number'], ['on scholarship', '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 different students play games?` to a syntactically-correct PostgreSQL query.
SELECT count(DISTINCT StuID) FROM Plays_games
Show ids of students who don't play video game.
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: video games columns : [['game id', 'number'], ['game name', 'text'], ['game type', 'text']] -- Table: plays games columns : [['student id', 'number'], ['game id', 'number'], ['hours played', 'number']] -- Table: sports info columns : [['student id', 'number'], ['sport name', 'text'], ['hours per week', 'number'], ['games played', 'number'], ['on scholarship', '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 ids of students who don't play video game.` to a syntactically-correct PostgreSQL query.
SELECT StuID FROM Student EXCEPT SELECT StuID FROM Plays_games
What are the ids of all students who are not video game players?
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: video games columns : [['game id', 'number'], ['game name', 'text'], ['game type', 'text']] -- Table: plays games columns : [['student id', 'number'], ['game id', 'number'], ['hours played', 'number']] -- Table: sports info columns : [['student id', 'number'], ['sport name', 'text'], ['hours per week', 'number'], ['games played', 'number'], ['on scholarship', '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 ids of all students who are not video game players?` to a syntactically-correct PostgreSQL query.
SELECT StuID FROM Student EXCEPT SELECT StuID FROM Plays_games
Show ids of students who play video game and play sports.
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: video games columns : [['game id', 'number'], ['game name', 'text'], ['game type', 'text']] -- Table: plays games columns : [['student id', 'number'], ['game id', 'number'], ['hours played', 'number']] -- Table: sports info columns : [['student id', 'number'], ['sport name', 'text'], ['hours per week', 'number'], ['games played', 'number'], ['on scholarship', '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 ids of students who play video game and play sports.` to a syntactically-correct PostgreSQL query.
SELECT StuID FROM Sportsinfo INTERSECT SELECT StuID FROM Plays_games
What are the ids of all students who played video games and sports?
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: video games columns : [['game id', 'number'], ['game name', 'text'], ['game type', 'text']] -- Table: plays games columns : [['student id', 'number'], ['game id', 'number'], ['hours played', 'number']] -- Table: sports info columns : [['student id', 'number'], ['sport name', 'text'], ['hours per week', 'number'], ['games played', 'number'], ['on scholarship', '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 ids of all students who played video games and sports?` to a syntactically-correct PostgreSQL query.
SELECT StuID FROM Sportsinfo INTERSECT SELECT StuID FROM Plays_games
Show all game ids and the number of hours played.
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: video games columns : [['game id', 'number'], ['game name', 'text'], ['game type', 'text']] -- Table: plays games columns : [['student id', 'number'], ['game id', 'number'], ['hours played', 'number']] -- Table: sports info columns : [['student id', 'number'], ['sport name', 'text'], ['hours per week', 'number'], ['games played', 'number'], ['on scholarship', '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 game ids and the number of hours played.` to a syntactically-correct PostgreSQL query.
SELECT gameid , sum(hours_played) FROM Plays_games GROUP BY gameid
What are ids and total number of hours played for each game?
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: video games columns : [['game id', 'number'], ['game name', 'text'], ['game type', 'text']] -- Table: plays games columns : [['student id', 'number'], ['game id', 'number'], ['hours played', 'number']] -- Table: sports info columns : [['student id', 'number'], ['sport name', 'text'], ['hours per week', 'number'], ['games played', 'number'], ['on scholarship', '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 ids and total number of hours played for each game?` to a syntactically-correct PostgreSQL query.
SELECT gameid , sum(hours_played) FROM Plays_games GROUP BY gameid
Show all student ids and the number of hours played.
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: video games columns : [['game id', 'number'], ['game name', 'text'], ['game type', 'text']] -- Table: plays games columns : [['student id', 'number'], ['game id', 'number'], ['hours played', 'number']] -- Table: sports info columns : [['student id', 'number'], ['sport name', 'text'], ['hours per week', 'number'], ['games played', 'number'], ['on scholarship', '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 and the number of hours played.` to a syntactically-correct PostgreSQL query.
SELECT Stuid , sum(hours_played) FROM Plays_games GROUP BY Stuid
What are the ids of all students and number of hours played?
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: video games columns : [['game id', 'number'], ['game name', 'text'], ['game type', 'text']] -- Table: plays games columns : [['student id', 'number'], ['game id', 'number'], ['hours played', 'number']] -- Table: sports info columns : [['student id', 'number'], ['sport name', 'text'], ['hours per week', 'number'], ['games played', 'number'], ['on scholarship', '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 ids of all students and number of hours played?` to a syntactically-correct PostgreSQL query.
SELECT Stuid , sum(hours_played) FROM Plays_games GROUP BY Stuid
Show the game name that has most number of hours played.
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: video games columns : [['game id', 'number'], ['game name', 'text'], ['game type', 'text']] -- Table: plays games columns : [['student id', 'number'], ['game id', 'number'], ['hours played', 'number']] -- Table: sports info columns : [['student id', 'number'], ['sport name', 'text'], ['hours per week', 'number'], ['games played', 'number'], ['on scholarship', '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 the game name that has most number of hours played.` to a syntactically-correct PostgreSQL query.
SELECT gname FROM Plays_games AS T1 JOIN Video_games AS T2 ON T1.gameid = T2.gameid GROUP BY T1.gameid ORDER BY sum(hours_played) DESC LIMIT 1
What is the name of the game that has been played the most?
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: video games columns : [['game id', 'number'], ['game name', 'text'], ['game type', 'text']] -- Table: plays games columns : [['student id', 'number'], ['game id', 'number'], ['hours played', 'number']] -- Table: sports info columns : [['student id', 'number'], ['sport name', 'text'], ['hours per week', 'number'], ['games played', 'number'], ['on scholarship', '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 name of the game that has been played the most?` to a syntactically-correct PostgreSQL query.
SELECT gname FROM Plays_games AS T1 JOIN Video_games AS T2 ON T1.gameid = T2.gameid GROUP BY T1.gameid ORDER BY sum(hours_played) DESC LIMIT 1
Show all game names played by at least 1000 hours.
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: video games columns : [['game id', 'number'], ['game name', 'text'], ['game type', 'text']] -- Table: plays games columns : [['student id', 'number'], ['game id', 'number'], ['hours played', 'number']] -- Table: sports info columns : [['student id', 'number'], ['sport name', 'text'], ['hours per week', 'number'], ['games played', 'number'], ['on scholarship', '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 game names played by at least 1000 hours.` to a syntactically-correct PostgreSQL query.
SELECT gname FROM Plays_games AS T1 JOIN Video_games AS T2 ON T1.gameid = T2.gameid GROUP BY T1.gameid HAVING sum(hours_played) >= 1000
What are the names of all the games that have been played for at least 1000 hours?
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: video games columns : [['game id', 'number'], ['game name', 'text'], ['game type', 'text']] -- Table: plays games columns : [['student id', 'number'], ['game id', 'number'], ['hours played', 'number']] -- Table: sports info columns : [['student id', 'number'], ['sport name', 'text'], ['hours per week', 'number'], ['games played', 'number'], ['on scholarship', '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 names of all the games that have been played for at least 1000 hours?` to a syntactically-correct PostgreSQL query.
SELECT gname FROM Plays_games AS T1 JOIN Video_games AS T2 ON T1.gameid = T2.gameid GROUP BY T1.gameid HAVING sum(hours_played) >= 1000
Show all game names played by Linda Smith
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: video games columns : [['game id', 'number'], ['game name', 'text'], ['game type', 'text']] -- Table: plays games columns : [['student id', 'number'], ['game id', 'number'], ['hours played', 'number']] -- Table: sports info columns : [['student id', 'number'], ['sport name', 'text'], ['hours per week', 'number'], ['games played', 'number'], ['on scholarship', '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 game names played by Linda Smith` to a syntactically-correct PostgreSQL query.
SELECT Gname FROM Plays_games AS T1 JOIN Video_games AS T2 ON T1.gameid = T2.gameid JOIN Student AS T3 ON T3.Stuid = T1.Stuid WHERE T3.Lname = "Smith" AND T3.Fname = "Linda"
What are the names of all games played by Linda Smith?
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: video games columns : [['game id', 'number'], ['game name', 'text'], ['game type', 'text']] -- Table: plays games columns : [['student id', 'number'], ['game id', 'number'], ['hours played', 'number']] -- Table: sports info columns : [['student id', 'number'], ['sport name', 'text'], ['hours per week', 'number'], ['games played', 'number'], ['on scholarship', '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 names of all games played by Linda Smith?` to a syntactically-correct PostgreSQL query.
SELECT Gname FROM Plays_games AS T1 JOIN Video_games AS T2 ON T1.gameid = T2.gameid JOIN Student AS T3 ON T3.Stuid = T1.Stuid WHERE T3.Lname = "Smith" AND T3.Fname = "Linda"
Find the last and first name of students who are playing Football or Lacrosse.
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: video games columns : [['game id', 'number'], ['game name', 'text'], ['game type', 'text']] -- Table: plays games columns : [['student id', 'number'], ['game id', 'number'], ['hours played', 'number']] -- Table: sports info columns : [['student id', 'number'], ['sport name', 'text'], ['hours per week', 'number'], ['games played', 'number'], ['on scholarship', '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 and first name of students who are playing Football or Lacrosse.` to a syntactically-correct PostgreSQL query.
SELECT T2.lname , T2.fname FROM SportsInfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T1.SportName = "Football" OR T1.SportName = "Lacrosse"
What is the first and last name of all students who play Football or Lacrosse?
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: video games columns : [['game id', 'number'], ['game name', 'text'], ['game type', 'text']] -- Table: plays games columns : [['student id', 'number'], ['game id', 'number'], ['hours played', 'number']] -- Table: sports info columns : [['student id', 'number'], ['sport name', 'text'], ['hours per week', 'number'], ['games played', 'number'], ['on scholarship', '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 first and last name of all students who play Football or Lacrosse?` to a syntactically-correct PostgreSQL query.
SELECT T2.lname , T2.fname FROM SportsInfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T1.SportName = "Football" OR T1.SportName = "Lacrosse"
Find the first name and age of the students who are playing both Football and Lacrosse.
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: video games columns : [['game id', 'number'], ['game name', 'text'], ['game type', 'text']] -- Table: plays games columns : [['student id', 'number'], ['game id', 'number'], ['hours played', 'number']] -- Table: sports info columns : [['student id', 'number'], ['sport name', 'text'], ['hours per week', 'number'], ['games played', 'number'], ['on scholarship', '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 age of the students who are playing both Football and Lacrosse.` to a syntactically-correct PostgreSQL query.
SELECT fname , age FROM Student WHERE StuID IN (SELECT StuID FROM Sportsinfo WHERE SportName = "Football" INTERSECT SELECT StuID FROM Sportsinfo WHERE SportName = "Lacrosse")
What are the first names and ages of all students who are playing both Football and Lacrosse?
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: video games columns : [['game id', 'number'], ['game name', 'text'], ['game type', 'text']] -- Table: plays games columns : [['student id', 'number'], ['game id', 'number'], ['hours played', 'number']] -- Table: sports info columns : [['student id', 'number'], ['sport name', 'text'], ['hours per week', 'number'], ['games played', 'number'], ['on scholarship', '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 names and ages of all students who are playing both Football and Lacrosse?` to a syntactically-correct PostgreSQL query.
SELECT fname , age FROM Student WHERE StuID IN (SELECT StuID FROM Sportsinfo WHERE SportName = "Football" INTERSECT SELECT StuID FROM Sportsinfo WHERE SportName = "Lacrosse")
Find the last name and gender of the students who are playing both Call of Destiny and Works of Widenius games.
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: video games columns : [['game id', 'number'], ['game name', 'text'], ['game type', 'text']] -- Table: plays games columns : [['student id', 'number'], ['game id', 'number'], ['hours played', 'number']] -- Table: sports info columns : [['student id', 'number'], ['sport name', 'text'], ['hours per week', 'number'], ['games played', 'number'], ['on scholarship', '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 gender of the students who are playing both Call of Destiny and Works of Widenius games.` to a syntactically-correct PostgreSQL query.
SELECT lname , sex FROM Student WHERE StuID IN (SELECT T1.StuID FROM Plays_games AS T1 JOIN Video_games AS T2 ON T1.GameID = T2.GameID WHERE T2.Gname = "Call of Destiny" INTERSECT SELECT T1.StuID FROM Plays_games AS T1 JOIN Video_games AS T2 ON T1.GameID = T2.GameID WHERE T2.Gname = "Works of Widenius")
what is the last name and gender of all students who played both Call of Destiny and Works of Widenius?
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: video games columns : [['game id', 'number'], ['game name', 'text'], ['game type', 'text']] -- Table: plays games columns : [['student id', 'number'], ['game id', 'number'], ['hours played', 'number']] -- Table: sports info columns : [['student id', 'number'], ['sport name', 'text'], ['hours per week', 'number'], ['games played', 'number'], ['on scholarship', '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 last name and gender of all students who played both Call of Destiny and Works of Widenius?` to a syntactically-correct PostgreSQL query.
SELECT lname , sex FROM Student WHERE StuID IN (SELECT T1.StuID FROM Plays_games AS T1 JOIN Video_games AS T2 ON T1.GameID = T2.GameID WHERE T2.Gname = "Call of Destiny" INTERSECT SELECT T1.StuID FROM Plays_games AS T1 JOIN Video_games AS T2 ON T1.GameID = T2.GameID WHERE T2.Gname = "Works of Widenius")
Find the name of all customers.
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 name of all customers.` to a syntactically-correct PostgreSQL query.
SELECT customer_name FROM customers
What are the names of all the customers?
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 names of all the customers?` to a syntactically-correct PostgreSQL query.
SELECT customer_name FROM customers
How many customers are there?
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 customers are there?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM customers
Return the total number of distinct customers.
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 `Return the total number of distinct customers.` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM customers
What is the average amount of items ordered in each order?
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 average amount of items ordered in each order?` to a syntactically-correct PostgreSQL query.
SELECT avg(order_quantity) FROM order_items
Find the average order quantity per order.
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 order quantity per order.` to a syntactically-correct PostgreSQL query.
SELECT avg(order_quantity) FROM order_items
What are the names of customers who use payment method "Cash"?
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 names of customers who use payment method "Cash"?` to a syntactically-correct PostgreSQL query.
SELECT customer_name FROM customers WHERE payment_method = "Cash"
Which customers use "Cash" for payment method? Return the customer names.
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 customers use "Cash" for payment method? Return the customer names.` to a syntactically-correct PostgreSQL query.
SELECT customer_name FROM customers WHERE payment_method = "Cash"
Find the "date became customers" of the customers whose ID is between 10 and 20.
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 "date became customers" of the customers whose ID is between 10 and 20.` to a syntactically-correct PostgreSQL query.
SELECT date_became_customer FROM customers WHERE customer_id BETWEEN 10 AND 20
What are the dates when customers with ids between 10 and 20 became customers?
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 dates when customers with ids between 10 and 20 became customers?` to a syntactically-correct PostgreSQL query.
SELECT date_became_customer FROM customers WHERE customer_id BETWEEN 10 AND 20
Which payment method is used by most customers?
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 payment method is used by most customers?` to a syntactically-correct PostgreSQL query.
SELECT payment_method FROM customers GROUP BY payment_method ORDER BY count(*) DESC LIMIT 1
Find the payment method that is used most frequently.
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 payment method that is used most frequently.` to a syntactically-correct PostgreSQL query.
SELECT payment_method FROM customers GROUP BY payment_method ORDER BY count(*) DESC LIMIT 1
What are the names of customers using the most popular payment method?
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 names of customers using the most popular payment method?` to a syntactically-correct PostgreSQL query.
SELECT customer_name FROM customers WHERE payment_method = (SELECT payment_method FROM customers GROUP BY payment_method ORDER BY count(*) DESC LIMIT 1)
Find the name of the customers who use the most frequently used payment method.
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 name of the customers who use the most frequently used payment method.` to a syntactically-correct PostgreSQL query.
SELECT customer_name FROM customers WHERE payment_method = (SELECT payment_method FROM customers GROUP BY payment_method ORDER BY count(*) DESC LIMIT 1)
What are all the payment methods?
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 all the payment methods?` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT payment_method FROM customers
Return all the distinct payment methods used by customers.
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 `Return all the distinct payment methods used by customers.` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT payment_method FROM customers
What are the details of all products?
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 details of all products?` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT product_details FROM products
Return the the details of all products.
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 `Return the the details of all products.` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT product_details FROM products
Find the name of all customers whose name contains "Alex".
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 name of all customers whose name contains "Alex".` to a syntactically-correct PostgreSQL query.
SELECT customer_name FROM customers WHERE customer_name LIKE "%Alex%"
Which customer's name contains "Alex"? Find the full name.
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 customer's name contains "Alex"? Find the full name.` to a syntactically-correct PostgreSQL query.
SELECT customer_name FROM customers WHERE customer_name LIKE "%Alex%"
Find the detail of products whose detail contains the word "Latte" or the word "Americano"
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 detail of products whose detail contains the word "Latte" or the word "Americano"` to a syntactically-correct PostgreSQL query.
SELECT product_details FROM products WHERE product_details LIKE "%Latte%" OR product_details LIKE "%Americano%"
Which product's detail contains the word "Latte" or "Americano"? Return the full detail.
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 product's detail contains the word "Latte" or "Americano"? Return the full detail.` to a syntactically-correct PostgreSQL query.
SELECT product_details FROM products WHERE product_details LIKE "%Latte%" OR product_details LIKE "%Americano%"
What is the address content of the customer named "Maudie Kertzmann"?
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 address content of the customer named "Maudie Kertzmann"?` to a syntactically-correct PostgreSQL query.
SELECT t3.address_content FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id WHERE t1.customer_name = "Maudie Kertzmann"
Return the address content for the customer whose name is "Maudie Kertzmann".
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 `Return the address content for the customer whose name is "Maudie Kertzmann".` to a syntactically-correct PostgreSQL query.
SELECT t3.address_content FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id WHERE t1.customer_name = "Maudie Kertzmann"
How many customers are living in city "Lake Geovannyton"?
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 customers are living in city "Lake Geovannyton"?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id WHERE t3.city = "Lake Geovannyton"
Find the number of customers who live in the city called Lake Geovannyton.
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 customers who live in the city called Lake Geovannyton.` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id WHERE t3.city = "Lake Geovannyton"
Find the name of customers who are living in Colorado?
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 name of customers who are living in Colorado?` to a syntactically-correct PostgreSQL query.
SELECT t1.customer_name FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id WHERE t3.state_province_county = "Colorado"
What are the names of customers who live in Colorado state?
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 names of customers who live in Colorado state?` to a syntactically-correct PostgreSQL query.
SELECT t1.customer_name FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id WHERE t3.state_province_county = "Colorado"
Find the list of cities that no customer is living in.
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 list of cities that no customer is living in.` to a syntactically-correct PostgreSQL query.
SELECT city FROM addresses WHERE city NOT IN ( SELECT DISTINCT t3.city FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id)
What are the cities no customers live in?
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 cities no customers live in?` to a syntactically-correct PostgreSQL query.
SELECT city FROM addresses WHERE city NOT IN ( SELECT DISTINCT t3.city FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id)
Which city has the most customers living in?
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 city has the most customers living in?` to a syntactically-correct PostgreSQL query.
SELECT t3.city FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id GROUP BY t3.city ORDER BY count(*) DESC LIMIT 1
Find the city where the most customers live.
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 city where the most customers live.` to a syntactically-correct PostgreSQL query.
SELECT t3.city FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id GROUP BY t3.city ORDER BY count(*) DESC LIMIT 1
Retrieve the list of all cities.
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 `Retrieve the list of all cities.` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT city FROM addresses
List all the distinct cities
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 all the distinct cities` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT city FROM addresses
Find the city with post code 255.
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 city with post code 255.` to a syntactically-correct PostgreSQL query.
SELECT city FROM addresses WHERE zip_postcode = 255
Which city is post code 255 located in?
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 city is post code 255 located in?` to a syntactically-correct PostgreSQL query.
SELECT city FROM addresses WHERE zip_postcode = 255
Find the state and country of all cities with post code starting with 4.
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 state and country of all cities with post code starting with 4.` to a syntactically-correct PostgreSQL query.
SELECT state_province_county , country FROM addresses WHERE zip_postcode LIKE "4%"
What are the state and country of all the cities that have post codes starting with 4.\
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 state and country of all the cities that have post codes starting with 4.\` to a syntactically-correct PostgreSQL query.
SELECT state_province_county , country FROM addresses WHERE zip_postcode LIKE "4%"
List the countries having more than 4 addresses listed.
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 countries having more than 4 addresses listed.` to a syntactically-correct PostgreSQL query.
SELECT country FROM addresses GROUP BY country HAVING count(address_id) > 4
For which countries are there more than four distinct addresses listed?
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 `For which countries are there more than four distinct addresses listed?` to a syntactically-correct PostgreSQL query.
SELECT country FROM addresses GROUP BY country HAVING count(address_id) > 4
List all the contact channel codes that were used less than 5 times.
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 all the contact channel codes that were used less than 5 times.` to a syntactically-correct PostgreSQL query.
SELECT channel_code FROM customer_contact_channels GROUP BY channel_code HAVING count(customer_id) < 5
Which contact channel codes were used less than 5 times?
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 contact channel codes were used less than 5 times?` to a syntactically-correct PostgreSQL query.
SELECT channel_code FROM customer_contact_channels GROUP BY channel_code HAVING count(customer_id) < 5
Which contact channel has been used by the customer with name "Tillman Ernser"?
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 contact channel has been used by the customer with name "Tillman Ernser"?` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT channel_code FROM customers AS t1 JOIN customer_contact_channels AS t2 ON t1.customer_id = t2.customer_id WHERE t1.customer_name = "Tillman Ernser"
Find the contact channel code that was used by the customer named "Tillman Ernser".
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 contact channel code that was used by the customer named "Tillman Ernser".` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT channel_code FROM customers AS t1 JOIN customer_contact_channels AS t2 ON t1.customer_id = t2.customer_id WHERE t1.customer_name = "Tillman Ernser"
What is the "active to date" of the latest contact channel used by "Tillman Ernser"?
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 "active to date" of the latest contact channel used by "Tillman Ernser"?` to a syntactically-correct PostgreSQL query.
SELECT max(t2.active_to_date) FROM customers AS t1 JOIN customer_contact_channels AS t2 ON t1.customer_id = t2.customer_id WHERE t1.customer_name = "Tillman Ernser"