brief_instruction stringlengths 16 224 | instruction stringlengths 687 8.77k | output stringlengths 18 577 |
|---|---|---|
Find the minimum salary for the departments whose average salary is above the average payment of all instructors. |
-- 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.
Translate `Find the minimum salary for the departments whose average salary is above the average payment of all instructors.` to a syntactically-correct PostgreSQL query.
| SELECT min(salary) , dept_name FROM instructor GROUP BY dept_name HAVING avg(salary) > (SELECT avg(salary) FROM instructor) |
What is the lowest salary in departments with average salary greater than the overall average. |
-- 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.
Translate `What is the lowest salary in departments with average salary greater than the overall average.` to a syntactically-correct PostgreSQL query.
| SELECT min(salary) , dept_name FROM instructor GROUP BY dept_name HAVING avg(salary) > (SELECT avg(salary) FROM instructor) |
Find the number of courses provided in each semester and 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.
Translate `Find the number of courses provided in each semester and year.` to a syntactically-correct PostgreSQL query.
| SELECT count(*) , semester , YEAR FROM SECTION GROUP BY semester , YEAR |
How many courses are provided in each semester and 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.
Translate `How many courses are provided in each semester and year?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) , semester , YEAR FROM SECTION GROUP BY semester , YEAR |
Find the year which offers the largest number of courses. |
-- 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.
Translate `Find the year which offers the largest number of courses.` to a syntactically-correct PostgreSQL query.
| SELECT YEAR FROM SECTION GROUP BY YEAR ORDER BY count(*) DESC LIMIT 1 |
Which year had the greatest number of courses? |
-- 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.
Translate `Which year had the greatest number of courses?` to a syntactically-correct PostgreSQL query.
| SELECT YEAR FROM SECTION GROUP BY YEAR ORDER BY count(*) DESC LIMIT 1 |
Find the year and semester when offers the largest number of courses. |
-- 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.
Translate `Find the year and semester when offers the largest number of courses.` to a syntactically-correct PostgreSQL query.
| SELECT semester , YEAR FROM SECTION GROUP BY semester , YEAR ORDER BY count(*) DESC LIMIT 1 |
What is the year and semester with the most courses? |
-- 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.
Translate `What is the year and semester with the most courses?` to a syntactically-correct PostgreSQL query.
| SELECT semester , YEAR FROM SECTION GROUP BY semester , YEAR ORDER BY count(*) DESC LIMIT 1 |
Find the name of department has the highest amount of students? |
-- 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.
Translate `Find the name of department has the highest amount of students?` to a syntactically-correct PostgreSQL query.
| SELECT dept_name FROM student GROUP BY dept_name ORDER BY count(*) DESC LIMIT 1 |
What is the name of the deparment with the highest enrollment? |
-- 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.
Translate `What is the name of the deparment with the highest enrollment?` to a syntactically-correct PostgreSQL query.
| SELECT dept_name FROM student GROUP BY dept_name ORDER BY count(*) DESC LIMIT 1 |
Find the total number of students in each department. |
-- 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.
Translate `Find the total number of students in each department.` to a syntactically-correct PostgreSQL query.
| SELECT count(*) , dept_name FROM student GROUP BY dept_name |
How many students are in each department? |
-- 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.
Translate `How many students are in each department?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) , dept_name FROM student GROUP BY dept_name |
Find the semester and year which has the least number of student taking any class. |
-- 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.
Translate `Find the semester and year which has the least number of student taking any class.` to a syntactically-correct PostgreSQL query.
| SELECT semester , YEAR FROM takes GROUP BY semester , YEAR ORDER BY count(*) LIMIT 1 |
Which semeseter and year had the fewest students? |
-- 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.
Translate `Which semeseter and year had the fewest students?` to a syntactically-correct PostgreSQL query.
| SELECT semester , YEAR FROM takes GROUP BY semester , YEAR ORDER BY count(*) LIMIT 1 |
What is the id of the instructor who advises of all students from History department? |
-- 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.
Translate `What is the id of the instructor who advises of all students from History department?` to a syntactically-correct PostgreSQL query.
| SELECT i_id FROM advisor AS T1 JOIN student AS T2 ON T1.s_id = T2.id WHERE T2.dept_name = 'History' |
Give id of the instructor who advises students in the History department. |
-- 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.
Translate `Give id of the instructor who advises students in the History department.` to a syntactically-correct PostgreSQL query.
| SELECT i_id FROM advisor AS T1 JOIN student AS T2 ON T1.s_id = T2.id WHERE T2.dept_name = 'History' |
Find the name and salary of the instructors who are advisors of any student from History department? |
-- 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.
Translate `Find the name and salary of the instructors who are advisors of any student from History department?` to a syntactically-correct PostgreSQL query.
| SELECT T2.name , T2.salary FROM advisor AS T1 JOIN instructor AS T2 ON T1.i_id = T2.id JOIN student AS T3 ON T1.s_id = T3.id WHERE T3.dept_name = 'History' |
What are the names and salaries of instructors who advises students in the History department? |
-- 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.
Translate `What are the names and salaries of instructors who advises students in the History department?` to a syntactically-correct PostgreSQL query.
| SELECT T2.name , T2.salary FROM advisor AS T1 JOIN instructor AS T2 ON T1.i_id = T2.id JOIN student AS T3 ON T1.s_id = T3.id WHERE T3.dept_name = 'History' |
Find the id of the courses that do not have any prerequisite? |
-- 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.
Translate `Find the id of the courses that do not have any prerequisite?` to a syntactically-correct PostgreSQL query.
| SELECT course_id FROM course EXCEPT SELECT course_id FROM prereq |
What are the ids of courses without prerequisites? |
-- 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.
Translate `What are the ids of courses without prerequisites?` to a syntactically-correct PostgreSQL query.
| SELECT course_id FROM course EXCEPT SELECT course_id FROM prereq |
Find the name of the courses that do not have any prerequisite? |
-- 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.
Translate `Find the name of the courses that do not have any prerequisite?` to a syntactically-correct PostgreSQL query.
| SELECT title FROM course WHERE course_id NOT IN (SELECT course_id FROM prereq) |
What are the names of courses without prerequisites? |
-- 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.
Translate `What are the names of courses without prerequisites?` to a syntactically-correct PostgreSQL query.
| SELECT title FROM course WHERE course_id NOT IN (SELECT course_id FROM prereq) |
What is the title of the prerequisite class of International Finance course? |
-- 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.
Translate `What is the title of the prerequisite class of International Finance course?` to a syntactically-correct PostgreSQL query.
| SELECT title FROM course WHERE course_id IN (SELECT T1.prereq_id FROM prereq AS T1 JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T2.title = 'International Finance') |
Give the title of the prerequisite to the course International Finance. |
-- 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.
Translate `Give the title of the prerequisite to the course International Finance.` to a syntactically-correct PostgreSQL query.
| SELECT title FROM course WHERE course_id IN (SELECT T1.prereq_id FROM prereq AS T1 JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T2.title = 'International Finance') |
Find the title of course whose prerequisite is course Differential Geometry. |
-- 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.
Translate `Find the title of course whose prerequisite is course Differential Geometry.` to a syntactically-correct PostgreSQL query.
| SELECT title FROM course WHERE course_id IN (SELECT T1.course_id FROM prereq AS T1 JOIN course AS T2 ON T1.prereq_id = T2.course_id WHERE T2.title = 'Differential Geometry') |
What is the title of the course with Differential Geometry as a prerequisite? |
-- 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.
Translate `What is the title of the course with Differential Geometry as a prerequisite?` to a syntactically-correct PostgreSQL query.
| SELECT title FROM course WHERE course_id IN (SELECT T1.course_id FROM prereq AS T1 JOIN course AS T2 ON T1.prereq_id = T2.course_id WHERE T2.title = 'Differential Geometry') |
Find the names of students who have taken any course in the fall semester of year 2003. |
-- 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.
Translate `Find the names of students who have taken any course in the fall semester of year 2003.` to a syntactically-correct PostgreSQL query.
| SELECT name FROM student WHERE id IN (SELECT id FROM takes WHERE semester = 'Fall' AND YEAR = 2003) |
What are the names of students who took a course in the Fall of 2003? |
-- 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.
Translate `What are the names of students who took a course in the Fall of 2003?` to a syntactically-correct PostgreSQL query.
| SELECT name FROM student WHERE id IN (SELECT id FROM takes WHERE semester = 'Fall' AND YEAR = 2003) |
What is the title of the course that was offered at building Chandler during the fall semester in the year of 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.
Translate `What is the title of the course that was offered at building Chandler during the fall semester in the year of 2010?` to a syntactically-correct PostgreSQL query.
| SELECT T1.title FROM course AS T1 JOIN SECTION AS T2 ON T1.course_id = T2.course_id WHERE building = 'Chandler' AND semester = 'Fall' AND YEAR = 2010 |
Give the title of the course offered in Chandler during the Fall of 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.
Translate `Give the title of the course offered in Chandler during the Fall of 2010.` to a syntactically-correct PostgreSQL query.
| SELECT T1.title FROM course AS T1 JOIN SECTION AS T2 ON T1.course_id = T2.course_id WHERE building = 'Chandler' AND semester = 'Fall' AND YEAR = 2010 |
Find the name of the instructors who taught C Programming course before. |
-- 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.
Translate `Find the name of the instructors who taught C Programming course before.` to a syntactically-correct PostgreSQL query.
| SELECT T1.name FROM instructor AS T1 JOIN teaches AS T2 ON T1.id = T2.id JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T3.title = 'C Programming' |
What are the names of instructors who have taught C Programming courses? |
-- 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.
Translate `What are the names of instructors who have taught C Programming courses?` to a syntactically-correct PostgreSQL query.
| SELECT T1.name FROM instructor AS T1 JOIN teaches AS T2 ON T1.id = T2.id JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T3.title = 'C Programming' |
Find the name and salary of instructors who are advisors of the students from the Math department. |
-- 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.
Translate `Find the name and salary of instructors who are advisors of the students from the Math department.` to a syntactically-correct PostgreSQL query.
| SELECT T2.name , T2.salary FROM advisor AS T1 JOIN instructor AS T2 ON T1.i_id = T2.id JOIN student AS T3 ON T1.s_id = T3.id WHERE T3.dept_name = 'Math' |
What are the names and salaries of instructors who advise students in the Math department? |
-- 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.
Translate `What are the names and salaries of instructors who advise students in the Math department?` to a syntactically-correct PostgreSQL query.
| SELECT T2.name , T2.salary FROM advisor AS T1 JOIN instructor AS T2 ON T1.i_id = T2.id JOIN student AS T3 ON T1.s_id = T3.id WHERE T3.dept_name = 'Math' |
Find the name of instructors who are advisors of the students from the Math department, and sort the results by students' total credit. |
-- 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.
Translate `Find the name of instructors who are advisors of the students from the Math department, and sort the results by students' total credit.` to a syntactically-correct PostgreSQL query.
| SELECT T2.name FROM advisor AS T1 JOIN instructor AS T2 ON T1.i_id = T2.id JOIN student AS T3 ON T1.s_id = T3.id WHERE T3.dept_name = 'Math' ORDER BY T3.tot_cred |
What are the names of all instructors who advise students in the math depart sorted by total credits of the student. |
-- 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.
Translate `What are the names of all instructors who advise students in the math depart sorted by total credits of the student.` to a syntactically-correct PostgreSQL query.
| SELECT T2.name FROM advisor AS T1 JOIN instructor AS T2 ON T1.i_id = T2.id JOIN student AS T3 ON T1.s_id = T3.id WHERE T3.dept_name = 'Math' ORDER BY T3.tot_cred |
What is the course title of the prerequisite of course Mobile Computing? |
-- 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.
Translate `What is the course title of the prerequisite of course Mobile Computing?` to a syntactically-correct PostgreSQL query.
| SELECT title FROM course WHERE course_id IN (SELECT T1.prereq_id FROM prereq AS T1 JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T2.title = 'Mobile Computing') |
What is the title of the course that is a prerequisite for Mobile Computing? |
-- 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.
Translate `What is the title of the course that is a prerequisite for Mobile Computing?` to a syntactically-correct PostgreSQL query.
| SELECT title FROM course WHERE course_id IN (SELECT T1.prereq_id FROM prereq AS T1 JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T2.title = 'Mobile Computing') |
Find the name of instructor who is the advisor of the student who has the highest number of total credits. |
-- 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.
Translate `Find the name of instructor who is the advisor of the student who has the highest number of total credits.` to a syntactically-correct PostgreSQL query.
| SELECT T2.name FROM advisor AS T1 JOIN instructor AS T2 ON T1.i_id = T2.id JOIN student AS T3 ON T1.s_id = T3.id ORDER BY T3.tot_cred DESC LIMIT 1 |
What is the name of the instructor who advises the student with the greatest number of total credits? |
-- 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.
Translate `What is the name of the instructor who advises the student with the greatest number of total credits?` to a syntactically-correct PostgreSQL query.
| SELECT T2.name FROM advisor AS T1 JOIN instructor AS T2 ON T1.i_id = T2.id JOIN student AS T3 ON T1.s_id = T3.id ORDER BY T3.tot_cred DESC LIMIT 1 |
Find the name of instructors who didn't teach any courses? |
-- 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.
Translate `Find the name of instructors who didn't teach any courses?` to a syntactically-correct PostgreSQL query.
| SELECT name FROM instructor WHERE id NOT IN (SELECT id FROM teaches) |
What are the names of instructors who didn't teach? |
-- 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.
Translate `What are the names of instructors who didn't teach?` to a syntactically-correct PostgreSQL query.
| SELECT name FROM instructor WHERE id NOT IN (SELECT id FROM teaches) |
Find the id of instructors who didn't teach any courses? |
-- 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.
Translate `Find the id of instructors who didn't teach any courses?` to a syntactically-correct PostgreSQL query.
| SELECT id FROM instructor EXCEPT SELECT id FROM teaches |
What are the ids of instructors who didnt' teach? |
-- 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.
Translate `What are the ids of instructors who didnt' teach?` to a syntactically-correct PostgreSQL query.
| SELECT id FROM instructor EXCEPT SELECT id FROM teaches |
Find the names of instructors who didn't each any courses in any Spring semester. |
-- 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.
Translate `Find the names of instructors who didn't each any courses in any Spring semester.` to a syntactically-correct PostgreSQL query.
| SELECT name FROM instructor WHERE id NOT IN (SELECT id FROM teaches WHERE semester = 'Spring') |
What are the names of instructors who didn't teach courses in the Spring? |
-- 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.
Translate `What are the names of instructors who didn't teach courses in the Spring?` to a syntactically-correct PostgreSQL query.
| SELECT name FROM instructor WHERE id NOT IN (SELECT id FROM teaches WHERE semester = 'Spring') |
Find the name of the department which has the highest average salary of professors. |
-- 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.
Translate `Find the name of the department which has the highest average salary of professors.` to a syntactically-correct PostgreSQL query.
| SELECT dept_name FROM instructor GROUP BY dept_name ORDER BY avg(salary) DESC LIMIT 1 |
Which department has the highest average instructor salary? |
-- 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.
Translate `Which department has the highest average instructor salary?` to a syntactically-correct PostgreSQL query.
| SELECT dept_name FROM instructor GROUP BY dept_name ORDER BY avg(salary) DESC LIMIT 1 |
Find the number and averaged salary of all instructors who are in the department with the highest budget. |
-- 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.
Translate `Find the number and averaged salary of all instructors who are in the department with the highest budget.` to a syntactically-correct PostgreSQL query.
| SELECT avg(T1.salary) , count(*) FROM instructor AS T1 JOIN department AS T2 ON T1.dept_name = T2.dept_name ORDER BY T2.budget DESC LIMIT 1 |
How many instructors are in the department with the highest budget, and what is their average salary? |
-- 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.
Translate `How many instructors are in the department with the highest budget, and what is their average salary?` to a syntactically-correct PostgreSQL query.
| SELECT avg(T1.salary) , count(*) FROM instructor AS T1 JOIN department AS T2 ON T1.dept_name = T2.dept_name ORDER BY T2.budget DESC LIMIT 1 |
What is the title and credits of the course that is taught in the largest classroom (with the highest capacity)? |
-- 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.
Translate `What is the title and credits of the course that is taught in the largest classroom (with the highest capacity)?` to a syntactically-correct PostgreSQL query.
| SELECT T3.title , T3.credits FROM classroom AS T1 JOIN SECTION AS T2 ON T1.building = T2.building AND T1.room_number = T2.room_number JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T1.capacity = (SELECT max(capacity) FROM classroom) |
Give the title and credits for the course that is taught in the classroom with the greatest capacity. |
-- 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.
Translate `Give the title and credits for the course that is taught in the classroom with the greatest capacity.` to a syntactically-correct PostgreSQL query.
| SELECT T3.title , T3.credits FROM classroom AS T1 JOIN SECTION AS T2 ON T1.building = T2.building AND T1.room_number = T2.room_number JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T1.capacity = (SELECT max(capacity) FROM classroom) |
Find the name of students who didn't take any course from Biology department. |
-- 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.
Translate `Find the name of students who didn't take any course from Biology department.` to a syntactically-correct PostgreSQL query.
| SELECT name FROM student WHERE id NOT IN (SELECT T1.id FROM takes AS T1 JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T2.dept_name = 'Biology') |
What are the names of students who haven't taken any Biology courses? |
-- 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.
Translate `What are the names of students who haven't taken any Biology courses?` to a syntactically-correct PostgreSQL query.
| SELECT name FROM student WHERE id NOT IN (SELECT T1.id FROM takes AS T1 JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T2.dept_name = 'Biology') |
Find the total number of students and total number of instructors for each department. |
-- 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.
Translate `Find the total number of students and total number of instructors for each department.` to a syntactically-correct PostgreSQL query.
| SELECT count(DISTINCT T2.id) , count(DISTINCT T3.id) , T3.dept_name FROM department AS T1 JOIN student AS T2 ON T1.dept_name = T2.dept_name JOIN instructor AS T3 ON T1.dept_name = T3.dept_name GROUP BY T3.dept_name |
How many students and instructors are in each department? |
-- 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.
Translate `How many students and instructors are in each department?` to a syntactically-correct PostgreSQL query.
| SELECT count(DISTINCT T2.id) , count(DISTINCT T3.id) , T3.dept_name FROM department AS T1 JOIN student AS T2 ON T1.dept_name = T2.dept_name JOIN instructor AS T3 ON T1.dept_name = T3.dept_name GROUP BY T3.dept_name |
Find the name of students who have taken the prerequisite course of the course with title International Finance. |
-- 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.
Translate `Find the name of students who have taken the prerequisite course of the course with title International Finance.` to a syntactically-correct PostgreSQL query.
| SELECT T1.name FROM student AS T1 JOIN takes AS T2 ON T1.id = T2.id WHERE T2.course_id IN (SELECT T4.prereq_id FROM course AS T3 JOIN prereq AS T4 ON T3.course_id = T4.course_id WHERE T3.title = 'International Finance') |
What are the names of students who have taken the prerequisite for the course International Finance? |
-- 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.
Translate `What are the names of students who have taken the prerequisite for the course International Finance?` to a syntactically-correct PostgreSQL query.
| SELECT T1.name FROM student AS T1 JOIN takes AS T2 ON T1.id = T2.id WHERE T2.course_id IN (SELECT T4.prereq_id FROM course AS T3 JOIN prereq AS T4 ON T3.course_id = T4.course_id WHERE T3.title = 'International Finance') |
Find the name and salary of instructors whose salary is below the average salary of the instructors in the Physics department. |
-- 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.
Translate `Find the name and salary of instructors whose salary is below the average salary of the instructors in the Physics department.` to a syntactically-correct PostgreSQL query.
| SELECT name , salary FROM instructor WHERE salary < (SELECT avg(salary) FROM instructor WHERE dept_name = 'Physics') |
What are the names and salaries for instructors who earn less than the average salary of instructors in the Physics department? |
-- 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.
Translate `What are the names and salaries for instructors who earn less than the average salary of instructors in the Physics department?` to a syntactically-correct PostgreSQL query.
| SELECT name , salary FROM instructor WHERE salary < (SELECT avg(salary) FROM instructor WHERE dept_name = 'Physics') |
Find the name of students who took some course offered by Statistics department. |
-- 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.
Translate `Find the name of students who took some course offered by Statistics department.` to a syntactically-correct PostgreSQL query.
| SELECT T3.name FROM course AS T1 JOIN takes AS T2 ON T1.course_id = T2.course_id JOIN student AS T3 ON T2.id = T3.id WHERE T1.dept_name = 'Statistics' |
What are the names of students who have taken Statistics courses? |
-- 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.
Translate `What are the names of students who have taken Statistics courses?` to a syntactically-correct PostgreSQL query.
| SELECT T3.name FROM course AS T1 JOIN takes AS T2 ON T1.course_id = T2.course_id JOIN student AS T3 ON T2.id = T3.id WHERE T1.dept_name = 'Statistics' |
Find the building, room number, semester and year of all courses offered by Psychology department sorted by course titles. |
-- 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.
Translate `Find the building, room number, semester and year of all courses offered by Psychology department sorted by course titles.` to a syntactically-correct PostgreSQL query.
| SELECT T2.building , T2.room_number , T2.semester , T2.year FROM course AS T1 JOIN SECTION AS T2 ON T1.course_id = T2.course_id WHERE T1.dept_name = 'Psychology' ORDER BY T1.title |
What are the building, room number, semester and year of courses in the Psychology department, sorted using course title? |
-- 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.
Translate `What are the building, room number, semester and year of courses in the Psychology department, sorted using course title?` to a syntactically-correct PostgreSQL query.
| SELECT T2.building , T2.room_number , T2.semester , T2.year FROM course AS T1 JOIN SECTION AS T2 ON T1.course_id = T2.course_id WHERE T1.dept_name = 'Psychology' ORDER BY T1.title |
Find the names of all instructors in computer science department |
-- 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.
Translate `Find the names of all instructors in computer science department` to a syntactically-correct PostgreSQL query.
| SELECT name FROM instructor WHERE dept_name = 'Comp. Sci.' |
What are the names of all instructors in the Comp. Sci. department? |
-- 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.
Translate `What are the names of all instructors in the Comp. Sci. department?` to a syntactically-correct PostgreSQL query.
| SELECT name FROM instructor WHERE dept_name = 'Comp. Sci.' |
Find the names of all instructors in Comp. Sci. department with salary > 80000. |
-- 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.
Translate `Find the names of all instructors in Comp. Sci. department with salary > 80000.` to a syntactically-correct PostgreSQL query.
| SELECT name FROM instructor WHERE dept_name = 'Comp. Sci.' AND salary > 80000 |
What are the names of the instructors in the Comp. Sci. department who earn more than 80000? |
-- 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.
Translate `What are the names of the instructors in the Comp. Sci. department who earn more than 80000?` to a syntactically-correct PostgreSQL query.
| SELECT name FROM instructor WHERE dept_name = 'Comp. Sci.' AND salary > 80000 |
Find the names of all instructors who have taught some course and the course_id. |
-- 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.
Translate `Find the names of all instructors who have taught some course and the course_id.` to a syntactically-correct PostgreSQL query.
| SELECT name , course_id FROM instructor AS T1 JOIN teaches AS T2 ON T1.ID = T2.ID |
What are the names of all instructors who have taught a course, as well as the corresponding course id? |
-- 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.
Translate `What are the names of all instructors who have taught a course, as well as the corresponding course id?` to a syntactically-correct PostgreSQL query.
| SELECT name , course_id FROM instructor AS T1 JOIN teaches AS T2 ON T1.ID = T2.ID |
Find the names of all instructors in the Art department who have taught some course and the course_id. |
-- 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.
Translate `Find the names of all instructors in the Art department who have taught some course and the course_id.` to a syntactically-correct PostgreSQL query.
| SELECT name , course_id FROM instructor AS T1 JOIN teaches AS T2 ON T1.ID = T2.ID WHERE T1.dept_name = 'Art' |
What are the names of Art instructors who have taught a course, and the corresponding course id? |
-- 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.
Translate `What are the names of Art instructors who have taught a course, and the corresponding course id?` to a syntactically-correct PostgreSQL query.
| SELECT name , course_id FROM instructor AS T1 JOIN teaches AS T2 ON T1.ID = T2.ID WHERE T1.dept_name = 'Art' |
Find the names of all instructors whose name includes the substring “dar”. |
-- 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.
Translate `Find the names of all instructors whose name includes the substring “dar”.` to a syntactically-correct PostgreSQL query.
| SELECT name FROM instructor WHERE name LIKE '%dar%' |
What are the names of all instructors with names that include "dar"? |
-- 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.
Translate `What are the names of all instructors with names that include "dar"?` to a syntactically-correct PostgreSQL query.
| SELECT name FROM instructor WHERE name LIKE '%dar%' |
List in alphabetic order the names of all distinct instructors. |
-- 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.
Translate `List in alphabetic order the names of all distinct instructors.` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT name FROM instructor ORDER BY name |
List the distinct names of the instructors, ordered by 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.
Translate `List the distinct names of the instructors, ordered by name.` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT name FROM instructor ORDER BY name |
Find courses that ran in Fall 2009 or in Spring 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.
Translate `Find courses that ran in Fall 2009 or in Spring 2010.` to a syntactically-correct PostgreSQL query.
| SELECT course_id FROM SECTION WHERE semester = 'Fall' AND YEAR = 2009 UNION SELECT course_id FROM SECTION WHERE semester = 'Spring' AND YEAR = 2010 |
What are the ids for courses in the Fall of 2009 or the Spring of 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.
Translate `What are the ids for courses in the Fall of 2009 or the Spring of 2010?` to a syntactically-correct PostgreSQL query.
| SELECT course_id FROM SECTION WHERE semester = 'Fall' AND YEAR = 2009 UNION SELECT course_id FROM SECTION WHERE semester = 'Spring' AND YEAR = 2010 |
Find courses that ran in Fall 2009 and in Spring 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.
Translate `Find courses that ran in Fall 2009 and in Spring 2010.` to a syntactically-correct PostgreSQL query.
| SELECT course_id FROM SECTION WHERE semester = 'Fall' AND YEAR = 2009 INTERSECT SELECT course_id FROM SECTION WHERE semester = 'Spring' AND YEAR = 2010 |
What are the ids for courses that were offered in both Fall of 2009 and Spring of 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.
Translate `What are the ids for courses that were offered in both Fall of 2009 and Spring of 2010?` to a syntactically-correct PostgreSQL query.
| SELECT course_id FROM SECTION WHERE semester = 'Fall' AND YEAR = 2009 INTERSECT SELECT course_id FROM SECTION WHERE semester = 'Spring' AND YEAR = 2010 |
Find courses that ran in Fall 2009 but not in Spring 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.
Translate `Find courses that ran in Fall 2009 but not in Spring 2010.` to a syntactically-correct PostgreSQL query.
| SELECT course_id FROM SECTION WHERE semester = 'Fall' AND YEAR = 2009 EXCEPT SELECT course_id FROM SECTION WHERE semester = 'Spring' AND YEAR = 2010 |
What are the ids of courses offered in Fall of 2009 but not in Spring of 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.
Translate `What are the ids of courses offered in Fall of 2009 but not in Spring of 2010?` to a syntactically-correct PostgreSQL query.
| SELECT course_id FROM SECTION WHERE semester = 'Fall' AND YEAR = 2009 EXCEPT SELECT course_id FROM SECTION WHERE semester = 'Spring' AND YEAR = 2010 |
Find the salaries of all distinct instructors that are less than the largest salary. |
-- 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.
Translate `Find the salaries of all distinct instructors that are less than the largest salary.` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT salary FROM instructor WHERE salary < (SELECT max(salary) FROM instructor) |
What are the distinct salaries of all instructors who earned less than the maximum salary? |
-- 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.
Translate `What are the distinct salaries of all instructors who earned less than the maximum salary?` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT salary FROM instructor WHERE salary < (SELECT max(salary) FROM instructor) |
Find the total number of instructors who teach a course in the Spring 2010 semester. |
-- 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.
Translate `Find the total number of instructors who teach a course in the Spring 2010 semester.` to a syntactically-correct PostgreSQL query.
| SELECT COUNT (DISTINCT ID) FROM teaches WHERE semester = 'Spring' AND YEAR = 2010 |
How many instructors teach a course in the Spring of 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.
Translate `How many instructors teach a course in the Spring of 2010?` to a syntactically-correct PostgreSQL query.
| SELECT COUNT (DISTINCT ID) FROM teaches WHERE semester = 'Spring' AND YEAR = 2010 |
Find the names and average salaries of all departments whose average salary is greater than 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.
Translate `Find the names and average salaries of all departments whose average salary is greater than 42000.` to a syntactically-correct PostgreSQL query.
| SELECT dept_name , AVG (salary) FROM instructor GROUP BY dept_name HAVING AVG (salary) > 42000 |
What are the names and average salaries for departments with average salary higher than 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.
Translate `What are the names and average salaries for departments with average salary higher than 42000?` to a syntactically-correct PostgreSQL query.
| SELECT dept_name , AVG (salary) FROM instructor GROUP BY dept_name HAVING AVG (salary) > 42000 |
Find names of instructors with salary greater than that of some (at least one) instructor in the Biology department. |
-- 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.
Translate `Find names of instructors with salary greater than that of some (at least one) instructor in the Biology department.` to a syntactically-correct PostgreSQL query.
| SELECT name FROM instructor WHERE salary > (SELECT min(salary) FROM instructor WHERE dept_name = 'Biology') |
What are the names of instructors who earn more than at least one instructor from the Biology department? |
-- 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.
Translate `What are the names of instructors who earn more than at least one instructor from the Biology department?` to a syntactically-correct PostgreSQL query.
| SELECT name FROM instructor WHERE salary > (SELECT min(salary) FROM instructor WHERE dept_name = 'Biology') |
Find the names of all instructors whose salary is greater than the salary of all instructors in the Biology department. |
-- 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.
Translate `Find the names of all instructors whose salary is greater than the salary of all instructors in the Biology department.` to a syntactically-correct PostgreSQL query.
| SELECT name FROM instructor WHERE salary > (SELECT max(salary) FROM instructor WHERE dept_name = 'Biology') |
What are the names of all instructors with a higher salary than any of the instructors in the Biology department? |
-- 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.
Translate `What are the names of all instructors with a higher salary than any of the instructors in the Biology department?` to a syntactically-correct PostgreSQL query.
| SELECT name FROM instructor WHERE salary > (SELECT max(salary) FROM instructor WHERE dept_name = 'Biology') |
How many debates are there? |
-- 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.
Translate `How many debates are there?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM debate |
List the venues of debates in ascending order of the number of audience. |
-- 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.
Translate `List the venues of debates in ascending order of the number of audience.` to a syntactically-correct PostgreSQL query.
| SELECT Venue FROM debate ORDER BY Num_of_Audience ASC |
What are the date and venue of each 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.
Translate `What are the date and venue of each debate?` to a syntactically-correct PostgreSQL query.
| SELECT Date , Venue FROM debate |
List the dates of debates with number of audience bigger than 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.
Translate `List the dates of debates with number of audience bigger than 150` to a syntactically-correct PostgreSQL query.
| SELECT Date FROM debate WHERE Num_of_Audience > 150 |
Show the names of people aged either 35 or 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.
Translate `Show the names of people aged either 35 or 36.` to a syntactically-correct PostgreSQL query.
| SELECT Name FROM people WHERE Age = 35 OR Age = 36 |
What is the party of the youngest people? |
-- 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.
Translate `What is the party of the youngest people?` to a syntactically-correct PostgreSQL query.
| SELECT Party FROM people ORDER BY Age ASC LIMIT 1 |
Show different parties of people along with the number of people in each 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.
Translate `Show different parties of people along with the number of people in each party.` to a syntactically-correct PostgreSQL query.
| SELECT Party , COUNT(*) FROM people GROUP BY Party |
Show the party that has the most people. |
-- 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.
Translate `Show the party that has the most people.` to a syntactically-correct PostgreSQL query.
| SELECT Party FROM people GROUP BY Party ORDER BY COUNT(*) DESC LIMIT 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.