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: What are the names of instructors who advise more than one student?
SQL: SELECT T1.name FROM instructor AS T1 JOIN advisor AS T2 ON T1.id  =  T2.i_id GROUP BY T2.i_id HAVING count(*)  >  1
-- 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 name of the students who have more than one advisor?
SQL: SELECT T1.name FROM student AS T1 JOIN advisor AS T2 ON T1.id  =  T2.s_id GROUP BY T2.s_id HAVING count(*)  >  1
-- 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 students who have more than one advisor?
SQL: SELECT T1.name FROM student AS T1 JOIN advisor AS T2 ON T1.id  =  T2.s_id GROUP BY T2.s_id HAVING count(*)  >  1
-- 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 number of rooms with more than 50 capacity for each building.
SQL: SELECT count(*) ,  building FROM classroom WHERE capacity  >  50 GROUP BY building
-- 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 rooms in each building have a capacity of over 50?
SQL: SELECT count(*) ,  building FROM classroom WHERE capacity  >  50 GROUP BY building
-- 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 maximum and average capacity among rooms in each building.
SQL: SELECT max(capacity) ,  avg(capacity) ,  building FROM classroom GROUP BY building
-- 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 greatest and average capacity for rooms in each building?
SQL: SELECT max(capacity) ,  avg(capacity) ,  building FROM classroom GROUP BY building
-- 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 title of the course that is offered by more than one department.
SQL: SELECT title FROM course GROUP BY title HAVING count(*)  >  1
-- 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 titles of courses that are offered in more than one department?
SQL: SELECT title FROM course GROUP BY title HAVING count(*)  >  1
-- 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 total credits of courses provided by different department.
SQL: SELECT sum(credits) ,  dept_name FROM course GROUP BY dept_name
-- 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 total credits are offered by each department?
SQL: SELECT sum(credits) ,  dept_name FROM course GROUP BY dept_name
-- 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 minimum salary for the departments whose average salary is above the average payment of all instructors.
SQL: SELECT min(salary) ,  dept_name FROM instructor GROUP BY dept_name HAVING avg(salary)  >  (SELECT avg(salary) FROM instructor)
-- 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 is the lowest salary in departments with average salary greater than the overall average.
SQL: SELECT min(salary) ,  dept_name FROM instructor GROUP BY dept_name HAVING avg(salary)  >  (SELECT avg(salary) FROM instructor)
-- 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 number of courses provided in each semester and year.
SQL: SELECT count(*) ,  semester ,  YEAR FROM SECTION GROUP BY semester ,  YEAR
-- 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 courses are provided in each semester and year?
SQL: SELECT count(*) ,  semester ,  YEAR FROM SECTION GROUP BY semester ,  YEAR
-- 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 year which offers the largest number of courses.
SQL: SELECT YEAR FROM SECTION GROUP BY YEAR ORDER BY count(*) DESC LIMIT 1
-- 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: Which year had the greatest number of courses?
SQL: SELECT YEAR FROM SECTION GROUP BY YEAR ORDER BY count(*) DESC LIMIT 1
-- 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 year and semester when offers the largest number of courses.
SQL: SELECT semester ,  YEAR FROM SECTION GROUP BY semester ,  YEAR ORDER BY count(*) DESC LIMIT 1
-- 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 is the year and semester with the most courses?
SQL: SELECT semester ,  YEAR FROM SECTION GROUP BY semester ,  YEAR ORDER BY count(*) DESC LIMIT 1
-- 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 name of department has the highest amount of students?
SQL: SELECT dept_name FROM student GROUP BY dept_name ORDER BY count(*) DESC LIMIT 1
-- 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 is the name of the deparment with the highest enrollment?
SQL: SELECT dept_name FROM student GROUP BY dept_name ORDER BY count(*) DESC LIMIT 1
-- 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 total number of students in each department.
SQL: SELECT count(*) ,  dept_name FROM student GROUP BY dept_name
-- 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 students are in each department?
SQL: SELECT count(*) ,  dept_name FROM student GROUP BY dept_name
-- 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 semester and year which has the least number of student taking any class.
SQL: SELECT semester ,  YEAR FROM takes GROUP BY semester ,  YEAR ORDER BY count(*) LIMIT 1