sert121/SpiderSQL huggingface dataset:
-- Language PostgreSQL
        -- Tables: 
             -- Table: classroom 
columns : [['building', 'text'], ['room number', 'text'], ['capacity', 'number']]

 -- Table: department 
columns : [['department name', 'text'], ['building', 'text'], ['budget', 'number']]

 -- Table: course 
columns : [['course id', 'text'], ['title', 'text'], ['department name', 'text'], ['credits', 'number']]

 -- Table: instructor 
columns : [['id', 'text'], ['name', 'text'], ['department name', 'text'], ['salary', 'number']]

 -- Table: section 
columns : [['course id', 'text'], ['section id', 'text'], ['semester', 'text'], ['year', 'number'], ['building', 'text'], ['room number', 'text'], ['time slot id', 'text']]

 -- Table: teaches 
columns : [['id', 'text'], ['course id', 'text'], ['section id', 'text'], ['semester', 'text'], ['year', 'number']]

 -- Table: student 
columns : [['id', 'text'], ['name', 'text'], ['department name', 'text'], ['total credits', 'number']]

 -- Table: takes classes 
columns : [['id', 'text'], ['course id', 'text'], ['section id', 'text'], ['semester', 'text'], ['year', 'number'], ['grade', 'text']]

 -- Table: advisor 
columns : [['student id', 'text'], ['instructor id', 'text']]

 -- Table: time slot 
columns : [['time slot id', 'text'], ['day', 'text'], ['start hour', 'number'], ['start minute', 'number'], ['end hour', 'number'], ['end minute', 'number']]

 -- Table: prerequisite 
columns : [['course id', 'text'], ['prerequisite id', '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.



Question: How many instructors teach a course in the Spring of 2010?
SQL: SELECT COUNT (DISTINCT ID) FROM teaches WHERE semester  =  'Spring' AND YEAR  =  2010
-- Language PostgreSQL
        -- Tables: 
             -- Table: classroom 
columns : [['building', 'text'], ['room number', 'text'], ['capacity', 'number']]

 -- Table: department 
columns : [['department name', 'text'], ['building', 'text'], ['budget', 'number']]

 -- Table: course 
columns : [['course id', 'text'], ['title', 'text'], ['department name', 'text'], ['credits', 'number']]

 -- Table: instructor 
columns : [['id', 'text'], ['name', 'text'], ['department name', 'text'], ['salary', 'number']]

 -- Table: section 
columns : [['course id', 'text'], ['section id', 'text'], ['semester', 'text'], ['year', 'number'], ['building', 'text'], ['room number', 'text'], ['time slot id', 'text']]

 -- Table: teaches 
columns : [['id', 'text'], ['course id', 'text'], ['section id', 'text'], ['semester', 'text'], ['year', 'number']]

 -- Table: student 
columns : [['id', 'text'], ['name', 'text'], ['department name', 'text'], ['total credits', 'number']]

 -- Table: takes classes 
columns : [['id', 'text'], ['course id', 'text'], ['section id', 'text'], ['semester', 'text'], ['year', 'number'], ['grade', 'text']]

 -- Table: advisor 
columns : [['student id', 'text'], ['instructor id', 'text']]

 -- Table: time slot 
columns : [['time slot id', 'text'], ['day', 'text'], ['start hour', 'number'], ['start minute', 'number'], ['end hour', 'number'], ['end minute', 'number']]

 -- Table: prerequisite 
columns : [['course id', 'text'], ['prerequisite id', '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.



Question: Find the names and average salaries of all departments whose average salary is greater than 42000.
SQL: SELECT dept_name ,  AVG (salary) FROM instructor GROUP BY dept_name HAVING AVG (salary)  >  42000
-- Language PostgreSQL
        -- Tables: 
             -- Table: classroom 
columns : [['building', 'text'], ['room number', 'text'], ['capacity', 'number']]

 -- Table: department 
columns : [['department name', 'text'], ['building', 'text'], ['budget', 'number']]

 -- Table: course 
columns : [['course id', 'text'], ['title', 'text'], ['department name', 'text'], ['credits', 'number']]

 -- Table: instructor 
columns : [['id', 'text'], ['name', 'text'], ['department name', 'text'], ['salary', 'number']]

 -- Table: section 
columns : [['course id', 'text'], ['section id', 'text'], ['semester', 'text'], ['year', 'number'], ['building', 'text'], ['room number', 'text'], ['time slot id', 'text']]

 -- Table: teaches 
columns : [['id', 'text'], ['course id', 'text'], ['section id', 'text'], ['semester', 'text'], ['year', 'number']]

 -- Table: student 
columns : [['id', 'text'], ['name', 'text'], ['department name', 'text'], ['total credits', 'number']]

 -- Table: takes classes 
columns : [['id', 'text'], ['course id', 'text'], ['section id', 'text'], ['semester', 'text'], ['year', 'number'], ['grade', 'text']]

 -- Table: advisor 
columns : [['student id', 'text'], ['instructor id', 'text']]

 -- Table: time slot 
columns : [['time slot id', 'text'], ['day', 'text'], ['start hour', 'number'], ['start minute', 'number'], ['end hour', 'number'], ['end minute', 'number']]

 -- Table: prerequisite 
columns : [['course id', 'text'], ['prerequisite id', '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.



Question: What are the names and average salaries for departments with average salary higher than 42000?
SQL: SELECT dept_name ,  AVG (salary) FROM instructor GROUP BY dept_name HAVING AVG (salary)  >  42000
-- Language PostgreSQL
        -- Tables: 
             -- Table: classroom 
columns : [['building', 'text'], ['room number', 'text'], ['capacity', 'number']]

 -- Table: department 
columns : [['department name', 'text'], ['building', 'text'], ['budget', 'number']]

 -- Table: course 
columns : [['course id', 'text'], ['title', 'text'], ['department name', 'text'], ['credits', 'number']]

 -- Table: instructor 
columns : [['id', 'text'], ['name', 'text'], ['department name', 'text'], ['salary', 'number']]

 -- Table: section 
columns : [['course id', 'text'], ['section id', 'text'], ['semester', 'text'], ['year', 'number'], ['building', 'text'], ['room number', 'text'], ['time slot id', 'text']]

 -- Table: teaches 
columns : [['id', 'text'], ['course id', 'text'], ['section id', 'text'], ['semester', 'text'], ['year', 'number']]

 -- Table: student 
columns : [['id', 'text'], ['name', 'text'], ['department name', 'text'], ['total credits', 'number']]

 -- Table: takes classes 
columns : [['id', 'text'], ['course id', 'text'], ['section id', 'text'], ['semester', 'text'], ['year', 'number'], ['grade', 'text']]

 -- Table: advisor 
columns : [['student id', 'text'], ['instructor id', 'text']]

 -- Table: time slot 
columns : [['time slot id', 'text'], ['day', 'text'], ['start hour', 'number'], ['start minute', 'number'], ['end hour', 'number'], ['end minute', 'number']]

 -- Table: prerequisite 
columns : [['course id', 'text'], ['prerequisite id', '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.



Question: Find names of instructors with salary greater than that of some (at least one) instructor in the Biology department.
SQL: SELECT name FROM instructor WHERE salary  >  (SELECT min(salary) FROM instructor WHERE dept_name  =  'Biology')
-- Language PostgreSQL
        -- Tables: 
             -- Table: classroom 
columns : [['building', 'text'], ['room number', 'text'], ['capacity', 'number']]

 -- Table: department 
columns : [['department name', 'text'], ['building', 'text'], ['budget', 'number']]

 -- Table: course 
columns : [['course id', 'text'], ['title', 'text'], ['department name', 'text'], ['credits', 'number']]

 -- Table: instructor 
columns : [['id', 'text'], ['name', 'text'], ['department name', 'text'], ['salary', 'number']]

 -- Table: section 
columns : [['course id', 'text'], ['section id', 'text'], ['semester', 'text'], ['year', 'number'], ['building', 'text'], ['room number', 'text'], ['time slot id', 'text']]

 -- Table: teaches 
columns : [['id', 'text'], ['course id', 'text'], ['section id', 'text'], ['semester', 'text'], ['year', 'number']]

 -- Table: student 
columns : [['id', 'text'], ['name', 'text'], ['department name', 'text'], ['total credits', 'number']]

 -- Table: takes classes 
columns : [['id', 'text'], ['course id', 'text'], ['section id', 'text'], ['semester', 'text'], ['year', 'number'], ['grade', 'text']]

 -- Table: advisor 
columns : [['student id', 'text'], ['instructor id', 'text']]

 -- Table: time slot 
columns : [['time slot id', 'text'], ['day', 'text'], ['start hour', 'number'], ['start minute', 'number'], ['end hour', 'number'], ['end minute', 'number']]

 -- Table: prerequisite 
columns : [['course id', 'text'], ['prerequisite id', '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.



Question: What are the names of instructors who earn more than at least one instructor from the Biology department?
SQL: SELECT name FROM instructor WHERE salary  >  (SELECT min(salary) FROM instructor WHERE dept_name  =  'Biology')
-- Language PostgreSQL
        -- Tables: 
             -- Table: classroom 
columns : [['building', 'text'], ['room number', 'text'], ['capacity', 'number']]

 -- Table: department 
columns : [['department name', 'text'], ['building', 'text'], ['budget', 'number']]

 -- Table: course 
columns : [['course id', 'text'], ['title', 'text'], ['department name', 'text'], ['credits', 'number']]

 -- Table: instructor 
columns : [['id', 'text'], ['name', 'text'], ['department name', 'text'], ['salary', 'number']]

 -- Table: section 
columns : [['course id', 'text'], ['section id', 'text'], ['semester', 'text'], ['year', 'number'], ['building', 'text'], ['room number', 'text'], ['time slot id', 'text']]

 -- Table: teaches 
columns : [['id', 'text'], ['course id', 'text'], ['section id', 'text'], ['semester', 'text'], ['year', 'number']]

 -- Table: student 
columns : [['id', 'text'], ['name', 'text'], ['department name', 'text'], ['total credits', 'number']]

 -- Table: takes classes 
columns : [['id', 'text'], ['course id', 'text'], ['section id', 'text'], ['semester', 'text'], ['year', 'number'], ['grade', 'text']]

 -- Table: advisor 
columns : [['student id', 'text'], ['instructor id', 'text']]

 -- Table: time slot 
columns : [['time slot id', 'text'], ['day', 'text'], ['start hour', 'number'], ['start minute', 'number'], ['end hour', 'number'], ['end minute', 'number']]

 -- Table: prerequisite 
columns : [['course id', 'text'], ['prerequisite id', '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.



Question: Find the names of all instructors whose salary is greater than the salary of all instructors in the Biology department.
SQL: SELECT name FROM instructor WHERE salary  >  (SELECT max(salary) FROM instructor WHERE dept_name  =  'Biology')
-- Language PostgreSQL
        -- Tables: 
             -- Table: classroom 
columns : [['building', 'text'], ['room number', 'text'], ['capacity', 'number']]

 -- Table: department 
columns : [['department name', 'text'], ['building', 'text'], ['budget', 'number']]

 -- Table: course 
columns : [['course id', 'text'], ['title', 'text'], ['department name', 'text'], ['credits', 'number']]

 -- Table: instructor 
columns : [['id', 'text'], ['name', 'text'], ['department name', 'text'], ['salary', 'number']]

 -- Table: section 
columns : [['course id', 'text'], ['section id', 'text'], ['semester', 'text'], ['year', 'number'], ['building', 'text'], ['room number', 'text'], ['time slot id', 'text']]

 -- Table: teaches 
columns : [['id', 'text'], ['course id', 'text'], ['section id', 'text'], ['semester', 'text'], ['year', 'number']]

 -- Table: student 
columns : [['id', 'text'], ['name', 'text'], ['department name', 'text'], ['total credits', 'number']]

 -- Table: takes classes 
columns : [['id', 'text'], ['course id', 'text'], ['section id', 'text'], ['semester', 'text'], ['year', 'number'], ['grade', 'text']]

 -- Table: advisor 
columns : [['student id', 'text'], ['instructor id', 'text']]

 -- Table: time slot 
columns : [['time slot id', 'text'], ['day', 'text'], ['start hour', 'number'], ['start minute', 'number'], ['end hour', 'number'], ['end minute', 'number']]

 -- Table: prerequisite 
columns : [['course id', 'text'], ['prerequisite id', '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.



Question: What are the names of all instructors with a higher salary than any of the instructors in the Biology department?
SQL: SELECT name FROM instructor WHERE salary  >  (SELECT max(salary) FROM instructor WHERE dept_name  =  'Biology')
-- Language PostgreSQL
        -- Tables: 
             -- Table: people 
columns : [['people id', 'number'], ['district', 'text'], ['name', 'text'], ['party', 'text'], ['age', 'number']]

 -- Table: debate 
columns : [['debate id', 'number'], ['date', 'text'], ['venue', 'text'], ['num of audience', 'number']]

 -- Table: debate people 
columns : [['debate id', 'number'], ['affirmative', 'number'], ['negative', 'number'], ['if affirmative win', 'others']]

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.



Question: How many debates are there?
SQL: SELECT count(*) FROM debate
-- Language PostgreSQL
        -- Tables: 
             -- Table: people 
columns : [['people id', 'number'], ['district', 'text'], ['name', 'text'], ['party', 'text'], ['age', 'number']]

 -- Table: debate 
columns : [['debate id', 'number'], ['date', 'text'], ['venue', 'text'], ['num of audience', 'number']]

 -- Table: debate people 
columns : [['debate id', 'number'], ['affirmative', 'number'], ['negative', 'number'], ['if affirmative win', 'others']]

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.



Question: List the venues of debates in ascending order of the number of audience.
SQL: SELECT Venue FROM debate ORDER BY Num_of_Audience ASC
-- Language PostgreSQL
        -- Tables: 
             -- Table: people 
columns : [['people id', 'number'], ['district', 'text'], ['name', 'text'], ['party', 'text'], ['age', 'number']]

 -- Table: debate 
columns : [['debate id', 'number'], ['date', 'text'], ['venue', 'text'], ['num of audience', 'number']]

 -- Table: debate people 
columns : [['debate id', 'number'], ['affirmative', 'number'], ['negative', 'number'], ['if affirmative win', 'others']]

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.



Question: What are the date and venue of each debate?
SQL: SELECT Date ,  Venue FROM debate
-- Language PostgreSQL
        -- Tables: 
             -- Table: people 
columns : [['people id', 'number'], ['district', 'text'], ['name', 'text'], ['party', 'text'], ['age', 'number']]

 -- Table: debate 
columns : [['debate id', 'number'], ['date', 'text'], ['venue', 'text'], ['num of audience', 'number']]

 -- Table: debate people 
columns : [['debate id', 'number'], ['affirmative', 'number'], ['negative', 'number'], ['if affirmative win', 'others']]

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.



Question: List the dates of debates with number of audience bigger than 150
SQL: SELECT Date FROM debate WHERE Num_of_Audience  >  150
-- Language PostgreSQL
        -- Tables: 
             -- Table: people 
columns : [['people id', 'number'], ['district', 'text'], ['name', 'text'], ['party', 'text'], ['age', 'number']]

 -- Table: debate 
columns : [['debate id', 'number'], ['date', 'text'], ['venue', 'text'], ['num of audience', 'number']]

 -- Table: debate people 
columns : [['debate id', 'number'], ['affirmative', 'number'], ['negative', 'number'], ['if affirmative win', 'others']]

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.



Question: Show the names of people aged either 35 or 36.
SQL: SELECT Name FROM  people WHERE Age  =  35 OR Age  =  36
-- Language PostgreSQL
        -- Tables: 
             -- Table: people 
columns : [['people id', 'number'], ['district', 'text'], ['name', 'text'], ['party', 'text'], ['age', 'number']]

 -- Table: debate 
columns : [['debate id', 'number'], ['date', 'text'], ['venue', 'text'], ['num of audience', 'number']]

 -- Table: debate people 
columns : [['debate id', 'number'], ['affirmative', 'number'], ['negative', 'number'], ['if affirmative win', 'others']]

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.



Question: What is the party of the youngest people?
SQL: SELECT Party FROM people ORDER BY Age ASC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: people 
columns : [['people id', 'number'], ['district', 'text'], ['name', 'text'], ['party', 'text'], ['age', 'number']]

 -- Table: debate 
columns : [['debate id', 'number'], ['date', 'text'], ['venue', 'text'], ['num of audience', 'number']]

 -- Table: debate people 
columns : [['debate id', 'number'], ['affirmative', 'number'], ['negative', 'number'], ['if affirmative win', 'others']]

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.



Question: Show different parties of people along with the number of people in each party.
SQL: SELECT Party ,  COUNT(*) FROM people GROUP BY Party
-- Language PostgreSQL
        -- Tables: 
             -- Table: people 
columns : [['people id', 'number'], ['district', 'text'], ['name', 'text'], ['party', 'text'], ['age', 'number']]

 -- Table: debate 
columns : [['debate id', 'number'], ['date', 'text'], ['venue', 'text'], ['num of audience', 'number']]

 -- Table: debate people 
columns : [['debate id', 'number'], ['affirmative', 'number'], ['negative', 'number'], ['if affirmative win', 'others']]

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.



Question: Show the party that has the most people.
SQL: SELECT Party FROM people GROUP BY Party ORDER BY COUNT(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: people 
columns : [['people id', 'number'], ['district', 'text'], ['name', 'text'], ['party', 'text'], ['age', 'number']]

 -- Table: debate 
columns : [['debate id', 'number'], ['date', 'text'], ['venue', 'text'], ['num of audience', 'number']]

 -- Table: debate people 
columns : [['debate id', 'number'], ['affirmative', 'number'], ['negative', 'number'], ['if affirmative win', 'others']]

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.



Question: Show the distinct venues of debates
SQL: SELECT DISTINCT Venue FROM debate
-- Language PostgreSQL
        -- Tables: 
             -- Table: people 
columns : [['people id', 'number'], ['district', 'text'], ['name', 'text'], ['party', 'text'], ['age', 'number']]

 -- Table: debate 
columns : [['debate id', 'number'], ['date', 'text'], ['venue', 'text'], ['num of audience', 'number']]

 -- Table: debate people 
columns : [['debate id', 'number'], ['affirmative', 'number'], ['negative', 'number'], ['if affirmative win', 'others']]

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.



Question: Show the names of people, and dates and venues of debates they are on the affirmative side.
SQL: SELECT T3.Name ,  T2.Date ,  T2.Venue FROM debate_people AS T1 JOIN debate AS T2 ON T1.Debate_ID  =  T2.Debate_ID JOIN people AS T3 ON T1.Affirmative  =  T3.People_ID
-- Language PostgreSQL
        -- Tables: 
             -- Table: people 
columns : [['people id', 'number'], ['district', 'text'], ['name', 'text'], ['party', 'text'], ['age', 'number']]

 -- Table: debate 
columns : [['debate id', 'number'], ['date', 'text'], ['venue', 'text'], ['num of audience', 'number']]

 -- Table: debate people 
columns : [['debate id', 'number'], ['affirmative', 'number'], ['negative', 'number'], ['if affirmative win', 'others']]

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.



Question: Show the names of people, and dates and venues of debates they are on the negative side, ordered in ascending alphabetical order of name.
SQL: SELECT T3.Name ,  T2.Date ,  T2.Venue FROM debate_people AS T1 JOIN debate AS T2 ON T1.Debate_ID  =  T2.Debate_ID JOIN people AS T3 ON T1.Negative  =  T3.People_ID ORDER BY T3.Name ASC
-- Language PostgreSQL
        -- Tables: 
             -- Table: people 
columns : [['people id', 'number'], ['district', 'text'], ['name', 'text'], ['party', 'text'], ['age', 'number']]

 -- Table: debate 
columns : [['debate id', 'number'], ['date', 'text'], ['venue', 'text'], ['num of audience', 'number']]

 -- Table: debate people 
columns : [['debate id', 'number'], ['affirmative', 'number'], ['negative', 'number'], ['if affirmative win', 'others']]

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.



Question: Show the names of people that are on affirmative side of debates with number of audience bigger than 200.
SQL: SELECT T3.Name FROM debate_people AS T1 JOIN debate AS T2 ON T1.Debate_ID  =  T2.Debate_ID JOIN people AS T3 ON T1.Affirmative  =  T3.People_ID WHERE T2.Num_of_Audience  >  200
-- Language PostgreSQL
        -- Tables: 
             -- Table: people 
columns : [['people id', 'number'], ['district', 'text'], ['name', 'text'], ['party', 'text'], ['age', 'number']]

 -- Table: debate 
columns : [['debate id', 'number'], ['date', 'text'], ['venue', 'text'], ['num of audience', 'number']]

 -- Table: debate people 
columns : [['debate id', 'number'], ['affirmative', 'number'], ['negative', 'number'], ['if affirmative win', 'others']]

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.



Question: Show the names of people and the number of times they have been on the affirmative side of debates.
SQL: SELECT T2.Name ,  COUNT(*) FROM debate_people AS T1 JOIN people AS T2 ON T1.Affirmative  =  T2.People_ID GROUP BY T2.Name
-- Language PostgreSQL
        -- Tables: 
             -- Table: people 
columns : [['people id', 'number'], ['district', 'text'], ['name', 'text'], ['party', 'text'], ['age', 'number']]

 -- Table: debate 
columns : [['debate id', 'number'], ['date', 'text'], ['venue', 'text'], ['num of audience', 'number']]

 -- Table: debate people 
columns : [['debate id', 'number'], ['affirmative', 'number'], ['negative', 'number'], ['if affirmative win', 'others']]

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.



Question: Show the names of people who have been on the negative side of debates at least twice.
SQL: SELECT T2.Name FROM debate_people AS T1 JOIN people AS T2 ON T1.Negative  =  T2.People_ID GROUP BY T2.Name HAVING COUNT(*)  >=  2
-- Language PostgreSQL
        -- Tables: 
             -- Table: people 
columns : [['people id', 'number'], ['district', 'text'], ['name', 'text'], ['party', 'text'], ['age', 'number']]

 -- Table: debate 
columns : [['debate id', 'number'], ['date', 'text'], ['venue', 'text'], ['num of audience', 'number']]

 -- Table: debate people 
columns : [['debate id', 'number'], ['affirmative', 'number'], ['negative', 'number'], ['if affirmative win', 'others']]

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.



Question: List the names of people that have not been on the affirmative side of debates.
SQL: SELECT Name FROM people WHERE People_id NOT IN (SELECT Affirmative FROM debate_people)
-- Language PostgreSQL
        -- Tables: 
             -- Table: customers 
columns : [['customer id', 'number'], ['customer details', 'text']]

 -- Table: staff 
columns : [['staff id', 'number'], ['staff details', 'text']]

 -- Table: policies 
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]

 -- Table: claim headers 
columns : [['claim header id', 'number'], ['claim status code', 'text'], ['claim type code', 'text'], ['policy id', 'number'], ['date of claim', 'time'], ['date of settlement', 'time'], ['amount claimed', 'number'], ['amount piad', 'number']]

 -- Table: claims documents 
columns : [['claim id', 'number'], ['document type code', 'text'], ['created by staff id', 'number'], ['created date', 'number']]

 -- Table: claims processing stages 
columns : [['claim stage id', 'number'], ['next claim stage id', 'number'], ['claim status name', 'text'], ['claim status description', 'text']]

 -- Table: claims processing 
columns : [['claim processing id', 'number'], ['claim id', 'number'], ['claim outcome code', 'text'], ['claim stage id', 'number'], ['staff id', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: List the names of all the customers in alphabetical order.
SQL: SELECT customer_details FROM customers ORDER BY customer_details
-- Language PostgreSQL
        -- Tables: 
             -- Table: customers 
columns : [['customer id', 'number'], ['customer details', 'text']]

 -- Table: staff 
columns : [['staff id', 'number'], ['staff details', 'text']]

 -- Table: policies 
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]

 -- Table: claim headers 
columns : [['claim header id', 'number'], ['claim status code', 'text'], ['claim type code', 'text'], ['policy id', 'number'], ['date of claim', 'time'], ['date of settlement', 'time'], ['amount claimed', 'number'], ['amount piad', 'number']]

 -- Table: claims documents 
columns : [['claim id', 'number'], ['document type code', 'text'], ['created by staff id', 'number'], ['created date', 'number']]

 -- Table: claims processing stages 
columns : [['claim stage id', 'number'], ['next claim stage id', 'number'], ['claim status name', 'text'], ['claim status description', 'text']]

 -- Table: claims processing 
columns : [['claim processing id', 'number'], ['claim id', 'number'], ['claim outcome code', 'text'], ['claim stage id', 'number'], ['staff id', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Sort the customer names in alphabetical order.
SQL: SELECT customer_details FROM customers ORDER BY customer_details
-- Language PostgreSQL
        -- Tables: 
             -- Table: customers 
columns : [['customer id', 'number'], ['customer details', 'text']]

 -- Table: staff 
columns : [['staff id', 'number'], ['staff details', 'text']]

 -- Table: policies 
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]

 -- Table: claim headers 
columns : [['claim header id', 'number'], ['claim status code', 'text'], ['claim type code', 'text'], ['policy id', 'number'], ['date of claim', 'time'], ['date of settlement', 'time'], ['amount claimed', 'number'], ['amount piad', 'number']]

 -- Table: claims documents 
columns : [['claim id', 'number'], ['document type code', 'text'], ['created by staff id', 'number'], ['created date', 'number']]

 -- Table: claims processing stages 
columns : [['claim stage id', 'number'], ['next claim stage id', 'number'], ['claim status name', 'text'], ['claim status description', 'text']]

 -- Table: claims processing 
columns : [['claim processing id', 'number'], ['claim id', 'number'], ['claim outcome code', 'text'], ['claim stage id', 'number'], ['staff id', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Find all the policy type codes associated with the customer "Dayana Robel"
SQL: SELECT policy_type_code FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id  =  t2.customer_id WHERE t2.customer_details  =  "Dayana Robel"
-- Language PostgreSQL
        -- Tables: 
             -- Table: customers 
columns : [['customer id', 'number'], ['customer details', 'text']]

 -- Table: staff 
columns : [['staff id', 'number'], ['staff details', 'text']]

 -- Table: policies 
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]

 -- Table: claim headers 
columns : [['claim header id', 'number'], ['claim status code', 'text'], ['claim type code', 'text'], ['policy id', 'number'], ['date of claim', 'time'], ['date of settlement', 'time'], ['amount claimed', 'number'], ['amount piad', 'number']]

 -- Table: claims documents 
columns : [['claim id', 'number'], ['document type code', 'text'], ['created by staff id', 'number'], ['created date', 'number']]

 -- Table: claims processing stages 
columns : [['claim stage id', 'number'], ['next claim stage id', 'number'], ['claim status name', 'text'], ['claim status description', 'text']]

 -- Table: claims processing 
columns : [['claim processing id', 'number'], ['claim id', 'number'], ['claim outcome code', 'text'], ['claim stage id', 'number'], ['staff id', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What are the type codes of the policies used by the customer "Dayana Robel"?
SQL: SELECT policy_type_code FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id  =  t2.customer_id WHERE t2.customer_details  =  "Dayana Robel"
-- Language PostgreSQL
        -- Tables: 
             -- Table: customers 
columns : [['customer id', 'number'], ['customer details', 'text']]

 -- Table: staff 
columns : [['staff id', 'number'], ['staff details', 'text']]

 -- Table: policies 
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]

 -- Table: claim headers 
columns : [['claim header id', 'number'], ['claim status code', 'text'], ['claim type code', 'text'], ['policy id', 'number'], ['date of claim', 'time'], ['date of settlement', 'time'], ['amount claimed', 'number'], ['amount piad', 'number']]

 -- Table: claims documents 
columns : [['claim id', 'number'], ['document type code', 'text'], ['created by staff id', 'number'], ['created date', 'number']]

 -- Table: claims processing stages 
columns : [['claim stage id', 'number'], ['next claim stage id', 'number'], ['claim status name', 'text'], ['claim status description', 'text']]

 -- Table: claims processing 
columns : [['claim processing id', 'number'], ['claim id', 'number'], ['claim outcome code', 'text'], ['claim stage id', 'number'], ['staff id', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Which type of policy is most frequently used? Give me the policy type code.
SQL: SELECT policy_type_code FROM policies GROUP BY policy_type_code ORDER BY count(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: customers 
columns : [['customer id', 'number'], ['customer details', 'text']]

 -- Table: staff 
columns : [['staff id', 'number'], ['staff details', 'text']]

 -- Table: policies 
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]

 -- Table: claim headers 
columns : [['claim header id', 'number'], ['claim status code', 'text'], ['claim type code', 'text'], ['policy id', 'number'], ['date of claim', 'time'], ['date of settlement', 'time'], ['amount claimed', 'number'], ['amount piad', 'number']]

 -- Table: claims documents 
columns : [['claim id', 'number'], ['document type code', 'text'], ['created by staff id', 'number'], ['created date', 'number']]

 -- Table: claims processing stages 
columns : [['claim stage id', 'number'], ['next claim stage id', 'number'], ['claim status name', 'text'], ['claim status description', 'text']]

 -- Table: claims processing 
columns : [['claim processing id', 'number'], ['claim id', 'number'], ['claim outcome code', 'text'], ['claim stage id', 'number'], ['staff id', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Find the type code of the most frequently used policy.
SQL: SELECT policy_type_code FROM policies GROUP BY policy_type_code ORDER BY count(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: customers 
columns : [['customer id', 'number'], ['customer details', 'text']]

 -- Table: staff 
columns : [['staff id', 'number'], ['staff details', 'text']]

 -- Table: policies 
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]

 -- Table: claim headers 
columns : [['claim header id', 'number'], ['claim status code', 'text'], ['claim type code', 'text'], ['policy id', 'number'], ['date of claim', 'time'], ['date of settlement', 'time'], ['amount claimed', 'number'], ['amount piad', 'number']]

 -- Table: claims documents 
columns : [['claim id', 'number'], ['document type code', 'text'], ['created by staff id', 'number'], ['created date', 'number']]

 -- Table: claims processing stages 
columns : [['claim stage id', 'number'], ['next claim stage id', 'number'], ['claim status name', 'text'], ['claim status description', 'text']]

 -- Table: claims processing 
columns : [['claim processing id', 'number'], ['claim id', 'number'], ['claim outcome code', 'text'], ['claim stage id', 'number'], ['staff id', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Find all the policy types that are used by more than 2 customers.
SQL: SELECT policy_type_code FROM policies GROUP BY policy_type_code HAVING count(*)  >  2
-- Language PostgreSQL
        -- Tables: 
             -- Table: customers 
columns : [['customer id', 'number'], ['customer details', 'text']]

 -- Table: staff 
columns : [['staff id', 'number'], ['staff details', 'text']]

 -- Table: policies 
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]

 -- Table: claim headers 
columns : [['claim header id', 'number'], ['claim status code', 'text'], ['claim type code', 'text'], ['policy id', 'number'], ['date of claim', 'time'], ['date of settlement', 'time'], ['amount claimed', 'number'], ['amount piad', 'number']]

 -- Table: claims documents 
columns : [['claim id', 'number'], ['document type code', 'text'], ['created by staff id', 'number'], ['created date', 'number']]

 -- Table: claims processing stages 
columns : [['claim stage id', 'number'], ['next claim stage id', 'number'], ['claim status name', 'text'], ['claim status description', 'text']]

 -- Table: claims processing 
columns : [['claim processing id', 'number'], ['claim id', 'number'], ['claim outcome code', 'text'], ['claim stage id', 'number'], ['staff id', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Which types of policy are chosen by more than 2 customers? Give me the policy type codes.
SQL: SELECT policy_type_code FROM policies GROUP BY policy_type_code HAVING count(*)  >  2
-- Language PostgreSQL
        -- Tables: 
             -- Table: customers 
columns : [['customer id', 'number'], ['customer details', 'text']]

 -- Table: staff 
columns : [['staff id', 'number'], ['staff details', 'text']]

 -- Table: policies 
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]

 -- Table: claim headers 
columns : [['claim header id', 'number'], ['claim status code', 'text'], ['claim type code', 'text'], ['policy id', 'number'], ['date of claim', 'time'], ['date of settlement', 'time'], ['amount claimed', 'number'], ['amount piad', 'number']]

 -- Table: claims documents 
columns : [['claim id', 'number'], ['document type code', 'text'], ['created by staff id', 'number'], ['created date', 'number']]

 -- Table: claims processing stages 
columns : [['claim stage id', 'number'], ['next claim stage id', 'number'], ['claim status name', 'text'], ['claim status description', 'text']]

 -- Table: claims processing 
columns : [['claim processing id', 'number'], ['claim id', 'number'], ['claim outcome code', 'text'], ['claim stage id', 'number'], ['staff id', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Find the total and average amount paid in claim headers.
SQL: SELECT sum(amount_piad) ,  avg(amount_piad) FROM claim_headers
-- Language PostgreSQL
        -- Tables: 
             -- Table: customers 
columns : [['customer id', 'number'], ['customer details', 'text']]

 -- Table: staff 
columns : [['staff id', 'number'], ['staff details', 'text']]

 -- Table: policies 
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]

 -- Table: claim headers 
columns : [['claim header id', 'number'], ['claim status code', 'text'], ['claim type code', 'text'], ['policy id', 'number'], ['date of claim', 'time'], ['date of settlement', 'time'], ['amount claimed', 'number'], ['amount piad', 'number']]

 -- Table: claims documents 
columns : [['claim id', 'number'], ['document type code', 'text'], ['created by staff id', 'number'], ['created date', 'number']]

 -- Table: claims processing stages 
columns : [['claim stage id', 'number'], ['next claim stage id', 'number'], ['claim status name', 'text'], ['claim status description', 'text']]

 -- Table: claims processing 
columns : [['claim processing id', 'number'], ['claim id', 'number'], ['claim outcome code', 'text'], ['claim stage id', 'number'], ['staff id', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What are the total amount and average amount paid in claim headers?
SQL: SELECT sum(amount_piad) ,  avg(amount_piad) FROM claim_headers
-- Language PostgreSQL
        -- Tables: 
             -- Table: customers 
columns : [['customer id', 'number'], ['customer details', 'text']]

 -- Table: staff 
columns : [['staff id', 'number'], ['staff details', 'text']]

 -- Table: policies 
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]

 -- Table: claim headers 
columns : [['claim header id', 'number'], ['claim status code', 'text'], ['claim type code', 'text'], ['policy id', 'number'], ['date of claim', 'time'], ['date of settlement', 'time'], ['amount claimed', 'number'], ['amount piad', 'number']]

 -- Table: claims documents 
columns : [['claim id', 'number'], ['document type code', 'text'], ['created by staff id', 'number'], ['created date', 'number']]

 -- Table: claims processing stages 
columns : [['claim stage id', 'number'], ['next claim stage id', 'number'], ['claim status name', 'text'], ['claim status description', 'text']]

 -- Table: claims processing 
columns : [['claim processing id', 'number'], ['claim id', 'number'], ['claim outcome code', 'text'], ['claim stage id', 'number'], ['staff id', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Find the total amount claimed in the most recently created document.
SQL: SELECT sum(t1.amount_claimed) FROM claim_headers AS t1 JOIN claims_documents AS t2 ON t1.claim_header_id  =  t2.claim_id WHERE t2.created_date  =  (SELECT created_date FROM claims_documents ORDER BY created_date LIMIT 1)
-- Language PostgreSQL
        -- Tables: 
             -- Table: customers 
columns : [['customer id', 'number'], ['customer details', 'text']]

 -- Table: staff 
columns : [['staff id', 'number'], ['staff details', 'text']]

 -- Table: policies 
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]

 -- Table: claim headers 
columns : [['claim header id', 'number'], ['claim status code', 'text'], ['claim type code', 'text'], ['policy id', 'number'], ['date of claim', 'time'], ['date of settlement', 'time'], ['amount claimed', 'number'], ['amount piad', 'number']]

 -- Table: claims documents 
columns : [['claim id', 'number'], ['document type code', 'text'], ['created by staff id', 'number'], ['created date', 'number']]

 -- Table: claims processing stages 
columns : [['claim stage id', 'number'], ['next claim stage id', 'number'], ['claim status name', 'text'], ['claim status description', 'text']]

 -- Table: claims processing 
columns : [['claim processing id', 'number'], ['claim id', 'number'], ['claim outcome code', 'text'], ['claim stage id', 'number'], ['staff id', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: How much amount in total were claimed in the most recently created document?
SQL: SELECT sum(t1.amount_claimed) FROM claim_headers AS t1 JOIN claims_documents AS t2 ON t1.claim_header_id  =  t2.claim_id WHERE t2.created_date  =  (SELECT created_date FROM claims_documents ORDER BY created_date LIMIT 1)