brief_instruction
stringlengths
16
224
instruction
stringlengths
687
8.77k
output
stringlengths
18
577
List the names of all left-footed players who have overall rating between 85 and 90.
-- Language PostgreSQL -- Tables: -- Table: player attributes columns : [['id', 'number'], ['player fifa api id', 'number'], ['player api id', 'number'], ['date', 'text'], ['overall rating', 'number'], ['potential', 'number'], ['preferred foot', 'text'], ['attacking work rate', 'text'], ['defensive work rate', 'text'], ['crossing', 'number'], ['finishing', 'number'], ['heading accuracy', 'number'], ['short passing', 'number'], ['volleys', 'number'], ['dribbling', 'number'], ['curve', 'number'], ['free kick accuracy', 'number'], ['long passing', 'number'], ['ball control', 'number'], ['acceleration', 'number'], ['sprint speed', 'number'], ['agility', 'number'], ['reactions', 'number'], ['balance', 'number'], ['shot power', 'number'], ['jumping', 'number'], ['stamina', 'number'], ['strength', 'number'], ['long shots', 'number'], ['aggression', 'number'], ['interceptions', 'number'], ['positioning', 'number'], ['vision', 'number'], ['penalties', 'number'], ['marking', 'number'], ['standing tackle', 'number'], ['sliding tackle', 'number'], ['gk diving', 'number'], ['gk handling', 'number'], ['gk kicking', 'number'], ['gk positioning', 'number'], ['gk reflexes', 'number']] -- Table: sqlite sequence columns : [['name', 'text'], ['seq', 'text']] -- Table: player columns : [['id', 'number'], ['player api id', 'number'], ['player name', 'text'], ['player fifa api id', 'number'], ['birthday', 'text'], ['height', 'number'], ['weight', 'number']] -- Table: league columns : [['id', 'number'], ['country id', 'number'], ['name', 'text']] -- Table: country columns : [['id', 'number'], ['name', 'text']] -- Table: team columns : [['id', 'number'], ['team api id', 'number'], ['team fifa api id', 'number'], ['team long name', 'text'], ['team short name', 'text']] -- Table: team attributes columns : [['id', 'number'], ['team fifa api id', 'number'], ['team api id', 'number'], ['date', 'text'], ['buildup play speed', 'number'], ['buildup play speed class', 'text'], ['buildup play dribbling', 'number'], ['buildup play dribbling class', 'text'], ['buildup play passing', 'number'], ['buildup play passing class', 'text'], ['buildup play positioning class', 'text'], ['chance creation passing', 'number'], ['chance creation passing class', 'text'], ['chance creation crossing', 'number'], ['chance creation crossing class', 'text'], ['chance creation shooting', 'number'], ['chance creation shooting class', 'text'], ['chance creation positioning class', 'text'], ['defence pressure', 'number'], ['defence pressure class', 'text'], ['defence aggression', 'number'], ['defence aggression class', 'text'], ['defence team width', 'number'], ['defence team width class', 'text'], ['defence defender line class', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables 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 names of all left-footed players who have overall rating between 85 and 90.` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT T1.player_name FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id WHERE T2.preferred_foot = "left" AND T2.overall_rating >= 85 AND T2.overall_rating <= 90
What is the average rating for right-footed players and left-footed players?
-- Language PostgreSQL -- Tables: -- Table: player attributes columns : [['id', 'number'], ['player fifa api id', 'number'], ['player api id', 'number'], ['date', 'text'], ['overall rating', 'number'], ['potential', 'number'], ['preferred foot', 'text'], ['attacking work rate', 'text'], ['defensive work rate', 'text'], ['crossing', 'number'], ['finishing', 'number'], ['heading accuracy', 'number'], ['short passing', 'number'], ['volleys', 'number'], ['dribbling', 'number'], ['curve', 'number'], ['free kick accuracy', 'number'], ['long passing', 'number'], ['ball control', 'number'], ['acceleration', 'number'], ['sprint speed', 'number'], ['agility', 'number'], ['reactions', 'number'], ['balance', 'number'], ['shot power', 'number'], ['jumping', 'number'], ['stamina', 'number'], ['strength', 'number'], ['long shots', 'number'], ['aggression', 'number'], ['interceptions', 'number'], ['positioning', 'number'], ['vision', 'number'], ['penalties', 'number'], ['marking', 'number'], ['standing tackle', 'number'], ['sliding tackle', 'number'], ['gk diving', 'number'], ['gk handling', 'number'], ['gk kicking', 'number'], ['gk positioning', 'number'], ['gk reflexes', 'number']] -- Table: sqlite sequence columns : [['name', 'text'], ['seq', 'text']] -- Table: player columns : [['id', 'number'], ['player api id', 'number'], ['player name', 'text'], ['player fifa api id', 'number'], ['birthday', 'text'], ['height', 'number'], ['weight', 'number']] -- Table: league columns : [['id', 'number'], ['country id', 'number'], ['name', 'text']] -- Table: country columns : [['id', 'number'], ['name', 'text']] -- Table: team columns : [['id', 'number'], ['team api id', 'number'], ['team fifa api id', 'number'], ['team long name', 'text'], ['team short name', 'text']] -- Table: team attributes columns : [['id', 'number'], ['team fifa api id', 'number'], ['team api id', 'number'], ['date', 'text'], ['buildup play speed', 'number'], ['buildup play speed class', 'text'], ['buildup play dribbling', 'number'], ['buildup play dribbling class', 'text'], ['buildup play passing', 'number'], ['buildup play passing class', 'text'], ['buildup play positioning class', 'text'], ['chance creation passing', 'number'], ['chance creation passing class', 'text'], ['chance creation crossing', 'number'], ['chance creation crossing class', 'text'], ['chance creation shooting', 'number'], ['chance creation shooting class', 'text'], ['chance creation positioning class', 'text'], ['defence pressure', 'number'], ['defence pressure class', 'text'], ['defence aggression', 'number'], ['defence aggression class', 'text'], ['defence team width', 'number'], ['defence team width class', 'text'], ['defence defender line class', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the average rating for right-footed players and left-footed players?` to a syntactically-correct PostgreSQL query.
SELECT preferred_foot , avg(overall_rating) FROM Player_Attributes GROUP BY preferred_foot
Of all players with an overall rating greater than 80, how many are right-footed and left-footed?
-- Language PostgreSQL -- Tables: -- Table: player attributes columns : [['id', 'number'], ['player fifa api id', 'number'], ['player api id', 'number'], ['date', 'text'], ['overall rating', 'number'], ['potential', 'number'], ['preferred foot', 'text'], ['attacking work rate', 'text'], ['defensive work rate', 'text'], ['crossing', 'number'], ['finishing', 'number'], ['heading accuracy', 'number'], ['short passing', 'number'], ['volleys', 'number'], ['dribbling', 'number'], ['curve', 'number'], ['free kick accuracy', 'number'], ['long passing', 'number'], ['ball control', 'number'], ['acceleration', 'number'], ['sprint speed', 'number'], ['agility', 'number'], ['reactions', 'number'], ['balance', 'number'], ['shot power', 'number'], ['jumping', 'number'], ['stamina', 'number'], ['strength', 'number'], ['long shots', 'number'], ['aggression', 'number'], ['interceptions', 'number'], ['positioning', 'number'], ['vision', 'number'], ['penalties', 'number'], ['marking', 'number'], ['standing tackle', 'number'], ['sliding tackle', 'number'], ['gk diving', 'number'], ['gk handling', 'number'], ['gk kicking', 'number'], ['gk positioning', 'number'], ['gk reflexes', 'number']] -- Table: sqlite sequence columns : [['name', 'text'], ['seq', 'text']] -- Table: player columns : [['id', 'number'], ['player api id', 'number'], ['player name', 'text'], ['player fifa api id', 'number'], ['birthday', 'text'], ['height', 'number'], ['weight', 'number']] -- Table: league columns : [['id', 'number'], ['country id', 'number'], ['name', 'text']] -- Table: country columns : [['id', 'number'], ['name', 'text']] -- Table: team columns : [['id', 'number'], ['team api id', 'number'], ['team fifa api id', 'number'], ['team long name', 'text'], ['team short name', 'text']] -- Table: team attributes columns : [['id', 'number'], ['team fifa api id', 'number'], ['team api id', 'number'], ['date', 'text'], ['buildup play speed', 'number'], ['buildup play speed class', 'text'], ['buildup play dribbling', 'number'], ['buildup play dribbling class', 'text'], ['buildup play passing', 'number'], ['buildup play passing class', 'text'], ['buildup play positioning class', 'text'], ['chance creation passing', 'number'], ['chance creation passing class', 'text'], ['chance creation crossing', 'number'], ['chance creation crossing class', 'text'], ['chance creation shooting', 'number'], ['chance creation shooting class', 'text'], ['chance creation positioning class', 'text'], ['defence pressure', 'number'], ['defence pressure class', 'text'], ['defence aggression', 'number'], ['defence aggression class', 'text'], ['defence team width', 'number'], ['defence team width class', 'text'], ['defence defender line class', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Of all players with an overall rating greater than 80, how many are right-footed and left-footed?` to a syntactically-correct PostgreSQL query.
SELECT preferred_foot , count(*) FROM Player_Attributes WHERE overall_rating > 80 GROUP BY preferred_foot
List all of the player ids with a height of at least 180cm and an overall rating higher than 85.
-- Language PostgreSQL -- Tables: -- Table: player attributes columns : [['id', 'number'], ['player fifa api id', 'number'], ['player api id', 'number'], ['date', 'text'], ['overall rating', 'number'], ['potential', 'number'], ['preferred foot', 'text'], ['attacking work rate', 'text'], ['defensive work rate', 'text'], ['crossing', 'number'], ['finishing', 'number'], ['heading accuracy', 'number'], ['short passing', 'number'], ['volleys', 'number'], ['dribbling', 'number'], ['curve', 'number'], ['free kick accuracy', 'number'], ['long passing', 'number'], ['ball control', 'number'], ['acceleration', 'number'], ['sprint speed', 'number'], ['agility', 'number'], ['reactions', 'number'], ['balance', 'number'], ['shot power', 'number'], ['jumping', 'number'], ['stamina', 'number'], ['strength', 'number'], ['long shots', 'number'], ['aggression', 'number'], ['interceptions', 'number'], ['positioning', 'number'], ['vision', 'number'], ['penalties', 'number'], ['marking', 'number'], ['standing tackle', 'number'], ['sliding tackle', 'number'], ['gk diving', 'number'], ['gk handling', 'number'], ['gk kicking', 'number'], ['gk positioning', 'number'], ['gk reflexes', 'number']] -- Table: sqlite sequence columns : [['name', 'text'], ['seq', 'text']] -- Table: player columns : [['id', 'number'], ['player api id', 'number'], ['player name', 'text'], ['player fifa api id', 'number'], ['birthday', 'text'], ['height', 'number'], ['weight', 'number']] -- Table: league columns : [['id', 'number'], ['country id', 'number'], ['name', 'text']] -- Table: country columns : [['id', 'number'], ['name', 'text']] -- Table: team columns : [['id', 'number'], ['team api id', 'number'], ['team fifa api id', 'number'], ['team long name', 'text'], ['team short name', 'text']] -- Table: team attributes columns : [['id', 'number'], ['team fifa api id', 'number'], ['team api id', 'number'], ['date', 'text'], ['buildup play speed', 'number'], ['buildup play speed class', 'text'], ['buildup play dribbling', 'number'], ['buildup play dribbling class', 'text'], ['buildup play passing', 'number'], ['buildup play passing class', 'text'], ['buildup play positioning class', 'text'], ['chance creation passing', 'number'], ['chance creation passing class', 'text'], ['chance creation crossing', 'number'], ['chance creation crossing class', 'text'], ['chance creation shooting', 'number'], ['chance creation shooting class', 'text'], ['chance creation positioning class', 'text'], ['defence pressure', 'number'], ['defence pressure class', 'text'], ['defence aggression', 'number'], ['defence aggression class', 'text'], ['defence team width', 'number'], ['defence team width class', 'text'], ['defence defender line class', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `List all of the player ids with a height of at least 180cm and an overall rating higher than 85.` to a syntactically-correct PostgreSQL query.
SELECT player_api_id FROM Player WHERE height >= 180 INTERSECT SELECT player_api_id FROM Player_Attributes WHERE overall_rating > 85
List all of the ids for left-footed players with a height between 180cm and 190cm.
-- Language PostgreSQL -- Tables: -- Table: player attributes columns : [['id', 'number'], ['player fifa api id', 'number'], ['player api id', 'number'], ['date', 'text'], ['overall rating', 'number'], ['potential', 'number'], ['preferred foot', 'text'], ['attacking work rate', 'text'], ['defensive work rate', 'text'], ['crossing', 'number'], ['finishing', 'number'], ['heading accuracy', 'number'], ['short passing', 'number'], ['volleys', 'number'], ['dribbling', 'number'], ['curve', 'number'], ['free kick accuracy', 'number'], ['long passing', 'number'], ['ball control', 'number'], ['acceleration', 'number'], ['sprint speed', 'number'], ['agility', 'number'], ['reactions', 'number'], ['balance', 'number'], ['shot power', 'number'], ['jumping', 'number'], ['stamina', 'number'], ['strength', 'number'], ['long shots', 'number'], ['aggression', 'number'], ['interceptions', 'number'], ['positioning', 'number'], ['vision', 'number'], ['penalties', 'number'], ['marking', 'number'], ['standing tackle', 'number'], ['sliding tackle', 'number'], ['gk diving', 'number'], ['gk handling', 'number'], ['gk kicking', 'number'], ['gk positioning', 'number'], ['gk reflexes', 'number']] -- Table: sqlite sequence columns : [['name', 'text'], ['seq', 'text']] -- Table: player columns : [['id', 'number'], ['player api id', 'number'], ['player name', 'text'], ['player fifa api id', 'number'], ['birthday', 'text'], ['height', 'number'], ['weight', 'number']] -- Table: league columns : [['id', 'number'], ['country id', 'number'], ['name', 'text']] -- Table: country columns : [['id', 'number'], ['name', 'text']] -- Table: team columns : [['id', 'number'], ['team api id', 'number'], ['team fifa api id', 'number'], ['team long name', 'text'], ['team short name', 'text']] -- Table: team attributes columns : [['id', 'number'], ['team fifa api id', 'number'], ['team api id', 'number'], ['date', 'text'], ['buildup play speed', 'number'], ['buildup play speed class', 'text'], ['buildup play dribbling', 'number'], ['buildup play dribbling class', 'text'], ['buildup play passing', 'number'], ['buildup play passing class', 'text'], ['buildup play positioning class', 'text'], ['chance creation passing', 'number'], ['chance creation passing class', 'text'], ['chance creation crossing', 'number'], ['chance creation crossing class', 'text'], ['chance creation shooting', 'number'], ['chance creation shooting class', 'text'], ['chance creation positioning class', 'text'], ['defence pressure', 'number'], ['defence pressure class', 'text'], ['defence aggression', 'number'], ['defence aggression class', 'text'], ['defence team width', 'number'], ['defence team width class', 'text'], ['defence defender line class', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `List all of the ids for left-footed players with a height between 180cm and 190cm.` to a syntactically-correct PostgreSQL query.
SELECT player_api_id FROM Player WHERE height >= 180 AND height <= 190 INTERSECT SELECT player_api_id FROM Player_Attributes WHERE preferred_foot = "left"
Who are the top 3 players in terms of overall rating?
-- Language PostgreSQL -- Tables: -- Table: player attributes columns : [['id', 'number'], ['player fifa api id', 'number'], ['player api id', 'number'], ['date', 'text'], ['overall rating', 'number'], ['potential', 'number'], ['preferred foot', 'text'], ['attacking work rate', 'text'], ['defensive work rate', 'text'], ['crossing', 'number'], ['finishing', 'number'], ['heading accuracy', 'number'], ['short passing', 'number'], ['volleys', 'number'], ['dribbling', 'number'], ['curve', 'number'], ['free kick accuracy', 'number'], ['long passing', 'number'], ['ball control', 'number'], ['acceleration', 'number'], ['sprint speed', 'number'], ['agility', 'number'], ['reactions', 'number'], ['balance', 'number'], ['shot power', 'number'], ['jumping', 'number'], ['stamina', 'number'], ['strength', 'number'], ['long shots', 'number'], ['aggression', 'number'], ['interceptions', 'number'], ['positioning', 'number'], ['vision', 'number'], ['penalties', 'number'], ['marking', 'number'], ['standing tackle', 'number'], ['sliding tackle', 'number'], ['gk diving', 'number'], ['gk handling', 'number'], ['gk kicking', 'number'], ['gk positioning', 'number'], ['gk reflexes', 'number']] -- Table: sqlite sequence columns : [['name', 'text'], ['seq', 'text']] -- Table: player columns : [['id', 'number'], ['player api id', 'number'], ['player name', 'text'], ['player fifa api id', 'number'], ['birthday', 'text'], ['height', 'number'], ['weight', 'number']] -- Table: league columns : [['id', 'number'], ['country id', 'number'], ['name', 'text']] -- Table: country columns : [['id', 'number'], ['name', 'text']] -- Table: team columns : [['id', 'number'], ['team api id', 'number'], ['team fifa api id', 'number'], ['team long name', 'text'], ['team short name', 'text']] -- Table: team attributes columns : [['id', 'number'], ['team fifa api id', 'number'], ['team api id', 'number'], ['date', 'text'], ['buildup play speed', 'number'], ['buildup play speed class', 'text'], ['buildup play dribbling', 'number'], ['buildup play dribbling class', 'text'], ['buildup play passing', 'number'], ['buildup play passing class', 'text'], ['buildup play positioning class', 'text'], ['chance creation passing', 'number'], ['chance creation passing class', 'text'], ['chance creation crossing', 'number'], ['chance creation crossing class', 'text'], ['chance creation shooting', 'number'], ['chance creation shooting class', 'text'], ['chance creation positioning class', 'text'], ['defence pressure', 'number'], ['defence pressure class', 'text'], ['defence aggression', 'number'], ['defence aggression class', 'text'], ['defence team width', 'number'], ['defence team width class', 'text'], ['defence defender line class', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Who are the top 3 players in terms of overall rating?` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT T1.player_name FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id ORDER BY overall_rating DESC LIMIT 3
List the names and birthdays of the top five players in terms of potential.
-- Language PostgreSQL -- Tables: -- Table: player attributes columns : [['id', 'number'], ['player fifa api id', 'number'], ['player api id', 'number'], ['date', 'text'], ['overall rating', 'number'], ['potential', 'number'], ['preferred foot', 'text'], ['attacking work rate', 'text'], ['defensive work rate', 'text'], ['crossing', 'number'], ['finishing', 'number'], ['heading accuracy', 'number'], ['short passing', 'number'], ['volleys', 'number'], ['dribbling', 'number'], ['curve', 'number'], ['free kick accuracy', 'number'], ['long passing', 'number'], ['ball control', 'number'], ['acceleration', 'number'], ['sprint speed', 'number'], ['agility', 'number'], ['reactions', 'number'], ['balance', 'number'], ['shot power', 'number'], ['jumping', 'number'], ['stamina', 'number'], ['strength', 'number'], ['long shots', 'number'], ['aggression', 'number'], ['interceptions', 'number'], ['positioning', 'number'], ['vision', 'number'], ['penalties', 'number'], ['marking', 'number'], ['standing tackle', 'number'], ['sliding tackle', 'number'], ['gk diving', 'number'], ['gk handling', 'number'], ['gk kicking', 'number'], ['gk positioning', 'number'], ['gk reflexes', 'number']] -- Table: sqlite sequence columns : [['name', 'text'], ['seq', 'text']] -- Table: player columns : [['id', 'number'], ['player api id', 'number'], ['player name', 'text'], ['player fifa api id', 'number'], ['birthday', 'text'], ['height', 'number'], ['weight', 'number']] -- Table: league columns : [['id', 'number'], ['country id', 'number'], ['name', 'text']] -- Table: country columns : [['id', 'number'], ['name', 'text']] -- Table: team columns : [['id', 'number'], ['team api id', 'number'], ['team fifa api id', 'number'], ['team long name', 'text'], ['team short name', 'text']] -- Table: team attributes columns : [['id', 'number'], ['team fifa api id', 'number'], ['team api id', 'number'], ['date', 'text'], ['buildup play speed', 'number'], ['buildup play speed class', 'text'], ['buildup play dribbling', 'number'], ['buildup play dribbling class', 'text'], ['buildup play passing', 'number'], ['buildup play passing class', 'text'], ['buildup play positioning class', 'text'], ['chance creation passing', 'number'], ['chance creation passing class', 'text'], ['chance creation crossing', 'number'], ['chance creation crossing class', 'text'], ['chance creation shooting', 'number'], ['chance creation shooting class', 'text'], ['chance creation positioning class', 'text'], ['defence pressure', 'number'], ['defence pressure class', 'text'], ['defence aggression', 'number'], ['defence aggression class', 'text'], ['defence team width', 'number'], ['defence team width class', 'text'], ['defence defender line class', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables 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 names and birthdays of the top five players in terms of potential.` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT T1.player_name , T1.birthday FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id ORDER BY potential DESC LIMIT 5
How many performances are there?
-- Language PostgreSQL -- Tables: -- Table: member columns : [['member id', 'text'], ['name', 'text'], ['nationality', 'text'], ['role', 'text']] -- Table: performance columns : [['performance id', 'number'], ['date', 'text'], ['host', 'text'], ['location', 'text'], ['attendance', 'number']] -- Table: member attendance columns : [['member id', 'number'], ['performance id', 'number'], ['num of pieces', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many performances are there?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM performance
List the hosts of performances in ascending order of attendance.
-- Language PostgreSQL -- Tables: -- Table: member columns : [['member id', 'text'], ['name', 'text'], ['nationality', 'text'], ['role', 'text']] -- Table: performance columns : [['performance id', 'number'], ['date', 'text'], ['host', 'text'], ['location', 'text'], ['attendance', 'number']] -- Table: member attendance columns : [['member id', 'number'], ['performance id', 'number'], ['num of pieces', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `List the hosts of performances in ascending order of attendance.` to a syntactically-correct PostgreSQL query.
SELECT HOST FROM performance ORDER BY Attendance ASC
What are the dates and locations of performances?
-- Language PostgreSQL -- Tables: -- Table: member columns : [['member id', 'text'], ['name', 'text'], ['nationality', 'text'], ['role', 'text']] -- Table: performance columns : [['performance id', 'number'], ['date', 'text'], ['host', 'text'], ['location', 'text'], ['attendance', 'number']] -- Table: member attendance columns : [['member id', 'number'], ['performance id', 'number'], ['num of pieces', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the dates and locations of performances?` to a syntactically-correct PostgreSQL query.
SELECT Date , LOCATION FROM performance
Show the attendances of the performances at location "TD Garden" or "Bell Centre"
-- Language PostgreSQL -- Tables: -- Table: member columns : [['member id', 'text'], ['name', 'text'], ['nationality', 'text'], ['role', 'text']] -- Table: performance columns : [['performance id', 'number'], ['date', 'text'], ['host', 'text'], ['location', 'text'], ['attendance', 'number']] -- Table: member attendance columns : [['member id', 'number'], ['performance id', 'number'], ['num of pieces', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show the attendances of the performances at location "TD Garden" or "Bell Centre"` to a syntactically-correct PostgreSQL query.
SELECT Attendance FROM performance WHERE LOCATION = "TD Garden" OR LOCATION = "Bell Centre"
What is the average number of attendees for performances?
-- Language PostgreSQL -- Tables: -- Table: member columns : [['member id', 'text'], ['name', 'text'], ['nationality', 'text'], ['role', 'text']] -- Table: performance columns : [['performance id', 'number'], ['date', 'text'], ['host', 'text'], ['location', 'text'], ['attendance', 'number']] -- Table: member attendance columns : [['member id', 'number'], ['performance id', 'number'], ['num of pieces', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the average number of attendees for performances?` to a syntactically-correct PostgreSQL query.
SELECT avg(Attendance) FROM performance
What is the date of the performance with the highest number of attendees?
-- Language PostgreSQL -- Tables: -- Table: member columns : [['member id', 'text'], ['name', 'text'], ['nationality', 'text'], ['role', 'text']] -- Table: performance columns : [['performance id', 'number'], ['date', 'text'], ['host', 'text'], ['location', 'text'], ['attendance', 'number']] -- Table: member attendance columns : [['member id', 'number'], ['performance id', 'number'], ['num of pieces', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the date of the performance with the highest number of attendees?` to a syntactically-correct PostgreSQL query.
SELECT Date FROM performance ORDER BY Attendance DESC LIMIT 1
Show different locations and the number of performances at each location.
-- Language PostgreSQL -- Tables: -- Table: member columns : [['member id', 'text'], ['name', 'text'], ['nationality', 'text'], ['role', 'text']] -- Table: performance columns : [['performance id', 'number'], ['date', 'text'], ['host', 'text'], ['location', 'text'], ['attendance', 'number']] -- Table: member attendance columns : [['member id', 'number'], ['performance id', 'number'], ['num of pieces', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show different locations and the number of performances at each location.` to a syntactically-correct PostgreSQL query.
SELECT LOCATION , COUNT(*) FROM performance GROUP BY LOCATION
Show the most common location of performances.
-- Language PostgreSQL -- Tables: -- Table: member columns : [['member id', 'text'], ['name', 'text'], ['nationality', 'text'], ['role', 'text']] -- Table: performance columns : [['performance id', 'number'], ['date', 'text'], ['host', 'text'], ['location', 'text'], ['attendance', 'number']] -- Table: member attendance columns : [['member id', 'number'], ['performance id', 'number'], ['num of pieces', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show the most common location of performances.` to a syntactically-correct PostgreSQL query.
SELECT LOCATION FROM performance GROUP BY LOCATION ORDER BY COUNT(*) DESC LIMIT 1
Show the locations that have at least two performances.
-- Language PostgreSQL -- Tables: -- Table: member columns : [['member id', 'text'], ['name', 'text'], ['nationality', 'text'], ['role', 'text']] -- Table: performance columns : [['performance id', 'number'], ['date', 'text'], ['host', 'text'], ['location', 'text'], ['attendance', 'number']] -- Table: member attendance columns : [['member id', 'number'], ['performance id', 'number'], ['num of pieces', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show the locations that have at least two performances.` to a syntactically-correct PostgreSQL query.
SELECT LOCATION FROM performance GROUP BY LOCATION HAVING COUNT(*) >= 2
Show the locations that have both performances with more than 2000 attendees and performances with less than 1000 attendees.
-- Language PostgreSQL -- Tables: -- Table: member columns : [['member id', 'text'], ['name', 'text'], ['nationality', 'text'], ['role', 'text']] -- Table: performance columns : [['performance id', 'number'], ['date', 'text'], ['host', 'text'], ['location', 'text'], ['attendance', 'number']] -- Table: member attendance columns : [['member id', 'number'], ['performance id', 'number'], ['num of pieces', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show the locations that have both performances with more than 2000 attendees and performances with less than 1000 attendees.` to a syntactically-correct PostgreSQL query.
SELECT LOCATION FROM performance WHERE Attendance > 2000 INTERSECT SELECT LOCATION FROM performance WHERE Attendance < 1000
Show the names of members and the location of the performances they attended.
-- Language PostgreSQL -- Tables: -- Table: member columns : [['member id', 'text'], ['name', 'text'], ['nationality', 'text'], ['role', 'text']] -- Table: performance columns : [['performance id', 'number'], ['date', 'text'], ['host', 'text'], ['location', 'text'], ['attendance', 'number']] -- Table: member attendance columns : [['member id', 'number'], ['performance id', 'number'], ['num of pieces', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show the names of members and the location of the performances they attended.` to a syntactically-correct PostgreSQL query.
SELECT T2.Name , T3.Location FROM member_attendance AS T1 JOIN member AS T2 ON T1.Member_ID = T2.Member_ID JOIN performance AS T3 ON T1.Performance_ID = T3.Performance_ID
Show the names of members and the location of performances they attended in ascending alphabetical order of their names.
-- Language PostgreSQL -- Tables: -- Table: member columns : [['member id', 'text'], ['name', 'text'], ['nationality', 'text'], ['role', 'text']] -- Table: performance columns : [['performance id', 'number'], ['date', 'text'], ['host', 'text'], ['location', 'text'], ['attendance', 'number']] -- Table: member attendance columns : [['member id', 'number'], ['performance id', 'number'], ['num of pieces', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show the names of members and the location of performances they attended in ascending alphabetical order of their names.` to a syntactically-correct PostgreSQL query.
SELECT T2.Name , T3.Location FROM member_attendance AS T1 JOIN member AS T2 ON T1.Member_ID = T2.Member_ID JOIN performance AS T3 ON T1.Performance_ID = T3.Performance_ID ORDER BY T2.Name ASC
Show the dates of performances with attending members whose roles are "Violin".
-- Language PostgreSQL -- Tables: -- Table: member columns : [['member id', 'text'], ['name', 'text'], ['nationality', 'text'], ['role', 'text']] -- Table: performance columns : [['performance id', 'number'], ['date', 'text'], ['host', 'text'], ['location', 'text'], ['attendance', 'number']] -- Table: member attendance columns : [['member id', 'number'], ['performance id', 'number'], ['num of pieces', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show the dates of performances with attending members whose roles are "Violin".` to a syntactically-correct PostgreSQL query.
SELECT T3.Date FROM member_attendance AS T1 JOIN member AS T2 ON T1.Member_ID = T2.Member_ID JOIN performance AS T3 ON T1.Performance_ID = T3.Performance_ID WHERE T2.Role = "Violin"
Show the names of members and the dates of performances they attended in descending order of attendance of the performances.
-- Language PostgreSQL -- Tables: -- Table: member columns : [['member id', 'text'], ['name', 'text'], ['nationality', 'text'], ['role', 'text']] -- Table: performance columns : [['performance id', 'number'], ['date', 'text'], ['host', 'text'], ['location', 'text'], ['attendance', 'number']] -- Table: member attendance columns : [['member id', 'number'], ['performance id', 'number'], ['num of pieces', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show the names of members and the dates of performances they attended in descending order of attendance of the performances.` to a syntactically-correct PostgreSQL query.
SELECT T2.Name , T3.Date FROM member_attendance AS T1 JOIN member AS T2 ON T1.Member_ID = T2.Member_ID JOIN performance AS T3 ON T1.Performance_ID = T3.Performance_ID ORDER BY T3.Attendance DESC
List the names of members who did not attend any performance.
-- Language PostgreSQL -- Tables: -- Table: member columns : [['member id', 'text'], ['name', 'text'], ['nationality', 'text'], ['role', 'text']] -- Table: performance columns : [['performance id', 'number'], ['date', 'text'], ['host', 'text'], ['location', 'text'], ['attendance', 'number']] -- Table: member attendance columns : [['member id', 'number'], ['performance id', 'number'], ['num of pieces', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `List the names of members who did not attend any performance.` to a syntactically-correct PostgreSQL query.
SELECT Name FROM member WHERE Member_ID NOT IN (SELECT Member_ID FROM member_attendance)
Find the buildings which have rooms with capacity more than 50.
-- 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 buildings which have rooms with capacity more than 50.` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT building FROM classroom WHERE capacity > 50
What are the distinct buildings with capacities of greater than 50?
-- 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 buildings with capacities of greater than 50?` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT building FROM classroom WHERE capacity > 50
Count the number of rooms that are not in the Lamberton building.
-- Language PostgreSQL -- Tables: -- Table: classroom columns : [['building', 'text'], ['room number', 'text'], ['capacity', 'number']] -- Table: department columns : [['department name', 'text'], ['building', 'text'], ['budget', 'number']] -- Table: course columns : [['course id', 'text'], ['title', 'text'], ['department name', 'text'], ['credits', 'number']] -- Table: instructor columns : [['id', 'text'], ['name', 'text'], ['department name', 'text'], ['salary', 'number']] -- Table: section columns : [['course id', 'text'], ['section id', 'text'], ['semester', 'text'], ['year', 'number'], ['building', 'text'], ['room number', 'text'], ['time slot id', 'text']] -- Table: teaches columns : [['id', 'text'], ['course id', 'text'], ['section id', 'text'], ['semester', 'text'], ['year', 'number']] -- Table: student columns : [['id', 'text'], ['name', 'text'], ['department name', 'text'], ['total credits', 'number']] -- Table: takes classes columns : [['id', 'text'], ['course id', 'text'], ['section id', 'text'], ['semester', 'text'], ['year', 'number'], ['grade', 'text']] -- Table: advisor columns : [['student id', 'text'], ['instructor id', 'text']] -- Table: time slot columns : [['time slot id', 'text'], ['day', 'text'], ['start hour', 'number'], ['start minute', 'number'], ['end hour', 'number'], ['end minute', 'number']] -- Table: prerequisite columns : [['course id', 'text'], ['prerequisite id', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Count the number of rooms that are not in the Lamberton building.` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM classroom WHERE building != 'Lamberton'
How many classrooms are not in Lamberton?
-- 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 classrooms are not in Lamberton?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM classroom WHERE building != 'Lamberton'
What is the name and building of the departments whose budget is more than the average 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 `What is the name and building of the departments whose budget is more than the average budget?` to a syntactically-correct PostgreSQL query.
SELECT dept_name , building FROM department WHERE budget > (SELECT avg(budget) FROM department)
Give the name and building of the departments with greater than average 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 `Give the name and building of the departments with greater than average budget.` to a syntactically-correct PostgreSQL query.
SELECT dept_name , building FROM department WHERE budget > (SELECT avg(budget) FROM department)
Find the room number of the rooms which can sit 50 to 100 students and their buildings.
-- 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 room number of the rooms which can sit 50 to 100 students and their buildings.` to a syntactically-correct PostgreSQL query.
SELECT building , room_number FROM classroom WHERE capacity BETWEEN 50 AND 100
What are the room numbers and corresponding buildings for classrooms which can seat between 50 to 100 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 `What are the room numbers and corresponding buildings for classrooms which can seat between 50 to 100 students?` to a syntactically-correct PostgreSQL query.
SELECT building , room_number FROM classroom WHERE capacity BETWEEN 50 AND 100
Find the name and building of 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 name and building of the department with the highest budget.` to a syntactically-correct PostgreSQL query.
SELECT dept_name , building FROM department ORDER BY budget DESC LIMIT 1
What is the department name and corresponding building for the department with the greatest 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 `What is the department name and corresponding building for the department with the greatest budget?` to a syntactically-correct PostgreSQL query.
SELECT dept_name , building FROM department ORDER BY budget DESC LIMIT 1
What is the name of the student who has the highest total credits 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 is the name of the student who has the highest total credits in the History department.` to a syntactically-correct PostgreSQL query.
SELECT name FROM student WHERE dept_name = 'History' ORDER BY tot_cred DESC LIMIT 1
Give the name of the student in the History department with the most 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 `Give the name of the student in the History department with the most credits.` to a syntactically-correct PostgreSQL query.
SELECT name FROM student WHERE dept_name = 'History' ORDER BY tot_cred DESC LIMIT 1
How many rooms does the Lamberton building have?
-- 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 rooms does the Lamberton building have?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM classroom WHERE building = 'Lamberton'
Count the number of classrooms in Lamberton.
-- 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 `Count the number of classrooms in Lamberton.` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM classroom WHERE building = 'Lamberton'
How many students have advisors?
-- 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 have advisors?` to a syntactically-correct PostgreSQL query.
SELECT count(DISTINCT s_id) FROM advisor
Count the number of students who have advisors.
-- 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 `Count the number of students who have advisors.` to a syntactically-correct PostgreSQL query.
SELECT count(DISTINCT s_id) FROM advisor
How many departments offer 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 `How many departments offer courses?` to a syntactically-correct PostgreSQL query.
SELECT count(DISTINCT dept_name) FROM course
Count the number of departments which offer 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 `Count the number of departments which offer courses.` to a syntactically-correct PostgreSQL query.
SELECT count(DISTINCT dept_name) FROM course
How many different courses offered by 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 `How many different courses offered by Physics department?` to a syntactically-correct PostgreSQL query.
SELECT count(DISTINCT course_id) FROM course WHERE dept_name = 'Physics'
Count the number of courses 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 `Count the number of courses in the Physics department.` to a syntactically-correct PostgreSQL query.
SELECT count(DISTINCT course_id) FROM course WHERE dept_name = 'Physics'
Find the title of courses that have two 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 `Find the title of courses that have two prerequisites?` to a syntactically-correct PostgreSQL query.
SELECT T1.title FROM course AS T1 JOIN prereq AS T2 ON T1.course_id = T2.course_id GROUP BY T2.course_id HAVING count(*) = 2
What are the titles for courses with two 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 titles for courses with two prerequisites?` to a syntactically-correct PostgreSQL query.
SELECT T1.title FROM course AS T1 JOIN prereq AS T2 ON T1.course_id = T2.course_id GROUP BY T2.course_id HAVING count(*) = 2
Find the title, credit, and department name of courses that have more than one 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 `Find the title, credit, and department name of courses that have more than one prerequisites?` to a syntactically-correct PostgreSQL query.
SELECT T1.title , T1.credits , T1.dept_name FROM course AS T1 JOIN prereq AS T2 ON T1.course_id = T2.course_id GROUP BY T2.course_id HAVING count(*) > 1
What is the title, credit value, and department name for courses with more than one 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, credit value, and department name for courses with more than one prerequisite?` to a syntactically-correct PostgreSQL query.
SELECT T1.title , T1.credits , T1.dept_name FROM course AS T1 JOIN prereq AS T2 ON T1.course_id = T2.course_id GROUP BY T2.course_id HAVING count(*) > 1
How many courses that do not have 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 `How many courses that do not have prerequisite?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM course WHERE course_id NOT IN (SELECT course_id FROM prereq)
Count the number 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 `Count the number of courses without prerequisites.` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM course WHERE course_id NOT IN (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 titles 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 titles of courses without prerequisites?` to a syntactically-correct PostgreSQL query.
SELECT title FROM course WHERE course_id NOT IN (SELECT course_id FROM prereq)
How many different instructors have taught some 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 `How many different instructors have taught some course?` to a syntactically-correct PostgreSQL query.
SELECT COUNT (DISTINCT id) FROM teaches
Count the number of distinct instructors who have taught a 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 `Count the number of distinct instructors who have taught a course.` to a syntactically-correct PostgreSQL query.
SELECT COUNT (DISTINCT id) FROM teaches
Find the total budgets of the Marketing or Finance 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 budgets of the Marketing or Finance department.` to a syntactically-correct PostgreSQL query.
SELECT sum(budget) FROM department WHERE dept_name = 'Marketing' OR dept_name = 'Finance'
What is the sum of budgets of the Marketing and Finance departments?
-- 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 sum of budgets of the Marketing and Finance departments?` to a syntactically-correct PostgreSQL query.
SELECT sum(budget) FROM department WHERE dept_name = 'Marketing' OR dept_name = 'Finance'
Find the department name of the instructor whose name contains 'Soisalon'.
-- 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 department name of the instructor whose name contains 'Soisalon'.` to a syntactically-correct PostgreSQL query.
SELECT dept_name FROM instructor WHERE name LIKE '%Soisalon%'
What is the name of the department with an instructure who has a name like 'Soisalon'?
-- 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 department with an instructure who has a name like 'Soisalon'?` to a syntactically-correct PostgreSQL query.
SELECT dept_name FROM instructor WHERE name LIKE '%Soisalon%'
How many rooms whose capacity is less than 50 does the Lamberton building have?
-- 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 rooms whose capacity is less than 50 does the Lamberton building have?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM classroom WHERE building = 'Lamberton' AND capacity < 50
Count the number of rooms in Lamberton with capacity lower than 50.
-- 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 `Count the number of rooms in Lamberton with capacity lower than 50.` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM classroom WHERE building = 'Lamberton' AND capacity < 50
Find the name and budget of departments whose budgets are more than the average 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 name and budget of departments whose budgets are more than the average budget.` to a syntactically-correct PostgreSQL query.
SELECT dept_name , budget FROM department WHERE budget > (SELECT avg(budget) FROM department)
What are the names and budgets of departments with budgets greater than the 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 are the names and budgets of departments with budgets greater than the average?` to a syntactically-correct PostgreSQL query.
SELECT dept_name , budget FROM department WHERE budget > (SELECT avg(budget) FROM department)
what is the name of the instructor who is in Statistics department and earns the lowest 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 is the name of the instructor who is in Statistics department and earns the lowest salary?` to a syntactically-correct PostgreSQL query.
SELECT name FROM instructor WHERE dept_name = 'Statistics' ORDER BY salary LIMIT 1
Give the name of the lowest earning instructor in the 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 `Give the name of the lowest earning instructor in the Statistics department.` to a syntactically-correct PostgreSQL query.
SELECT name FROM instructor WHERE dept_name = 'Statistics' ORDER BY salary LIMIT 1
Find the title of course that is provided by both Statistics and Psychology departments.
-- 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 that is provided by both Statistics and Psychology departments.` to a syntactically-correct PostgreSQL query.
SELECT title FROM course WHERE dept_name = 'Statistics' INTERSECT SELECT title FROM course WHERE dept_name = 'Psychology'
What is the title of a course that is listed in both the Statistics and Psychology departments?
-- 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 a course that is listed in both the Statistics and Psychology departments?` to a syntactically-correct PostgreSQL query.
SELECT title FROM course WHERE dept_name = 'Statistics' INTERSECT SELECT title FROM course WHERE dept_name = 'Psychology'
Find the title of course that is provided by Statistics but not Psychology departments.
-- 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 that is provided by Statistics but not Psychology departments.` to a syntactically-correct PostgreSQL query.
SELECT title FROM course WHERE dept_name = 'Statistics' EXCEPT SELECT title FROM course WHERE dept_name = 'Psychology'
What are the titles of courses that are in the Statistics department but not the Psychology 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 titles of courses that are in the Statistics department but not the Psychology department?` to a syntactically-correct PostgreSQL query.
SELECT title FROM course WHERE dept_name = 'Statistics' EXCEPT SELECT title FROM course WHERE dept_name = 'Psychology'
Find the id of instructors who taught a class 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 the id of instructors who taught a class in Fall 2009 but not in Spring 2010.` to a syntactically-correct PostgreSQL query.
SELECT id FROM teaches WHERE semester = 'Fall' AND YEAR = 2009 EXCEPT SELECT id FROM teaches WHERE semester = 'Spring' AND YEAR = 2010
What are the ids of instructors who taught in the Fall of 2009 but not 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 `What are the ids of instructors who taught in the Fall of 2009 but not in the Spring of 2010?` to a syntactically-correct PostgreSQL query.
SELECT id FROM teaches WHERE semester = 'Fall' AND YEAR = 2009 EXCEPT SELECT id FROM teaches WHERE semester = 'Spring' AND YEAR = 2010
Find the name of students who took any class in the years of 2009 and 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 the name of students who took any class in the years of 2009 and 2010.` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT T1.name FROM student AS T1 JOIN takes AS T2 ON T1.id = T2.id WHERE YEAR = 2009 OR YEAR = 2010
What are the names of the students who took classes in 2009 or 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 names of the students who took classes in 2009 or 2010?` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT T1.name FROM student AS T1 JOIN takes AS T2 ON T1.id = T2.id WHERE YEAR = 2009 OR YEAR = 2010
Find the names of the top 3 departments that provide the largest amount 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 names of the top 3 departments that provide the largest amount of courses?` to a syntactically-correct PostgreSQL query.
SELECT dept_name FROM course GROUP BY dept_name ORDER BY count(*) DESC LIMIT 3
What are the names of the 3 departments 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 are the names of the 3 departments with the most courses?` to a syntactically-correct PostgreSQL query.
SELECT dept_name FROM course GROUP BY dept_name ORDER BY count(*) DESC LIMIT 3
Find the name of the department that offers the highest 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 the department that offers the highest total credits?` to a syntactically-correct PostgreSQL query.
SELECT dept_name FROM course GROUP BY dept_name ORDER BY sum(credits) DESC LIMIT 1
What is the name of the department with the most 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 department with the most credits?` to a syntactically-correct PostgreSQL query.
SELECT dept_name FROM course GROUP BY dept_name ORDER BY sum(credits) DESC LIMIT 1
List the names of all courses ordered by their titles and 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 `List the names of all courses ordered by their titles and credits.` to a syntactically-correct PostgreSQL query.
SELECT title FROM course ORDER BY title , credits
Given the titles of all courses, in order of titles and 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 `Given the titles of all courses, in order of titles and credits.` to a syntactically-correct PostgreSQL query.
SELECT title FROM course ORDER BY title , credits
Which department has the lowest 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 `Which department has the lowest budget?` to a syntactically-correct PostgreSQL query.
SELECT dept_name FROM department ORDER BY budget LIMIT 1
Give the name of the department with the lowest 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 `Give the name of the department with the lowest budget.` to a syntactically-correct PostgreSQL query.
SELECT dept_name FROM department ORDER BY budget LIMIT 1
List the names and buildings of all departments sorted by the budget from large to small.
-- 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 names and buildings of all departments sorted by the budget from large to small.` to a syntactically-correct PostgreSQL query.
SELECT dept_name , building FROM department ORDER BY budget DESC
What are the names and buildings of the deparments, sorted by budget descending?
-- 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 buildings of the deparments, sorted by budget descending?` to a syntactically-correct PostgreSQL query.
SELECT dept_name , building FROM department ORDER BY budget DESC
Who is the instructor with the highest 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 `Who is the instructor with the highest salary?` to a syntactically-correct PostgreSQL query.
SELECT name FROM instructor ORDER BY salary DESC LIMIT 1
Give the name of the highest paid instructor.
-- Language PostgreSQL -- Tables: -- Table: classroom columns : [['building', 'text'], ['room number', 'text'], ['capacity', 'number']] -- Table: department columns : [['department name', 'text'], ['building', 'text'], ['budget', 'number']] -- Table: course columns : [['course id', 'text'], ['title', 'text'], ['department name', 'text'], ['credits', 'number']] -- Table: instructor columns : [['id', 'text'], ['name', 'text'], ['department name', 'text'], ['salary', 'number']] -- Table: section columns : [['course id', 'text'], ['section id', 'text'], ['semester', 'text'], ['year', 'number'], ['building', 'text'], ['room number', 'text'], ['time slot id', 'text']] -- Table: teaches columns : [['id', 'text'], ['course id', 'text'], ['section id', 'text'], ['semester', 'text'], ['year', 'number']] -- Table: student columns : [['id', 'text'], ['name', 'text'], ['department name', 'text'], ['total credits', 'number']] -- Table: takes classes columns : [['id', 'text'], ['course id', 'text'], ['section id', 'text'], ['semester', 'text'], ['year', 'number'], ['grade', 'text']] -- Table: advisor columns : [['student id', 'text'], ['instructor id', 'text']] -- Table: time slot columns : [['time slot id', 'text'], ['day', 'text'], ['start hour', 'number'], ['start minute', 'number'], ['end hour', 'number'], ['end minute', 'number']] -- Table: prerequisite columns : [['course id', 'text'], ['prerequisite id', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Give the name of the highest paid instructor.` to a syntactically-correct PostgreSQL query.
SELECT name FROM instructor ORDER BY salary DESC LIMIT 1
List the information of all instructors ordered by their salary in ascending order.
-- 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 information of all instructors ordered by their salary in ascending order.` to a syntactically-correct PostgreSQL query.
SELECT * FROM instructor ORDER BY salary
Give all information regarding instructors, in order of salary from least to greatest.
-- 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 all information regarding instructors, in order of salary from least to greatest.` to a syntactically-correct PostgreSQL query.
SELECT * FROM instructor ORDER BY salary
Find the name of the students and their department names sorted by their total credits in ascending order.
-- 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 students and their department names sorted by their total credits in ascending order.` to a syntactically-correct PostgreSQL query.
SELECT name , dept_name FROM student ORDER BY tot_cred
What are the names of students and their respective departments, ordered by number of credits from least to greatest?
-- 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 and their respective departments, ordered by number of credits from least to greatest?` to a syntactically-correct PostgreSQL query.
SELECT name , dept_name FROM student ORDER BY tot_cred
list in alphabetic order all course names and their instructors' names in year 2008.
-- 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 all course names and their instructors' names in year 2008.` to a syntactically-correct PostgreSQL query.
SELECT T1.title , T3.name FROM course AS T1 JOIN teaches AS T2 ON T1.course_id = T2.course_id JOIN instructor AS T3 ON T2.id = T3.id WHERE YEAR = 2008 ORDER BY T1.title
Show all titles and their instructors' names for courses in 2008, in alphabetical order by 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 `Show all titles and their instructors' names for courses in 2008, in alphabetical order by title.` to a syntactically-correct PostgreSQL query.
SELECT T1.title , T3.name FROM course AS T1 JOIN teaches AS T2 ON T1.course_id = T2.course_id JOIN instructor AS T3 ON T2.id = T3.id WHERE YEAR = 2008 ORDER BY T1.title
Find the name of instructors who are advising more than one 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 `Find the name of instructors who are advising more than one student.` to a syntactically-correct PostgreSQL query.
SELECT T1.name FROM instructor AS T1 JOIN advisor AS T2 ON T1.id = T2.i_id GROUP BY T2.i_id HAVING count(*) > 1
What are the names of instructors who advise more than one 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 instructors who advise more than one student?` to a syntactically-correct PostgreSQL query.
SELECT T1.name FROM instructor AS T1 JOIN advisor AS T2 ON T1.id = T2.i_id GROUP BY T2.i_id HAVING count(*) > 1
Find the name of the students who have more than one advisor?
-- 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 students who have more than one advisor?` to a syntactically-correct PostgreSQL query.
SELECT T1.name FROM student AS T1 JOIN advisor AS T2 ON T1.id = T2.s_id GROUP BY T2.s_id HAVING count(*) > 1
What are the names of students who have more than one advisor?
-- 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 more than one advisor?` to a syntactically-correct PostgreSQL query.
SELECT T1.name FROM student AS T1 JOIN advisor AS T2 ON T1.id = T2.s_id GROUP BY T2.s_id HAVING count(*) > 1
Find the number of rooms with more than 50 capacity for each building.
-- Language PostgreSQL -- Tables: -- Table: classroom columns : [['building', 'text'], ['room number', 'text'], ['capacity', 'number']] -- Table: department columns : [['department name', 'text'], ['building', 'text'], ['budget', 'number']] -- Table: course columns : [['course id', 'text'], ['title', 'text'], ['department name', 'text'], ['credits', 'number']] -- Table: instructor columns : [['id', 'text'], ['name', 'text'], ['department name', 'text'], ['salary', 'number']] -- Table: section columns : [['course id', 'text'], ['section id', 'text'], ['semester', 'text'], ['year', 'number'], ['building', 'text'], ['room number', 'text'], ['time slot id', 'text']] -- Table: teaches columns : [['id', 'text'], ['course id', 'text'], ['section id', 'text'], ['semester', 'text'], ['year', 'number']] -- Table: student columns : [['id', 'text'], ['name', 'text'], ['department name', 'text'], ['total credits', 'number']] -- Table: takes classes columns : [['id', 'text'], ['course id', 'text'], ['section id', 'text'], ['semester', 'text'], ['year', 'number'], ['grade', 'text']] -- Table: advisor columns : [['student id', 'text'], ['instructor id', 'text']] -- Table: time slot columns : [['time slot id', 'text'], ['day', 'text'], ['start hour', 'number'], ['start minute', 'number'], ['end hour', 'number'], ['end minute', 'number']] -- Table: prerequisite columns : [['course id', 'text'], ['prerequisite id', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Find the number of rooms with more than 50 capacity for each building.` to a syntactically-correct PostgreSQL query.
SELECT count(*) , building FROM classroom WHERE capacity > 50 GROUP BY building
How many rooms in each building have a capacity of over 50?
-- 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 rooms in each building have a capacity of over 50?` to a syntactically-correct PostgreSQL query.
SELECT count(*) , building FROM classroom WHERE capacity > 50 GROUP BY building
Find the maximum and average capacity among rooms in each building.
-- Language PostgreSQL -- Tables: -- Table: classroom columns : [['building', 'text'], ['room number', 'text'], ['capacity', 'number']] -- Table: department columns : [['department name', 'text'], ['building', 'text'], ['budget', 'number']] -- Table: course columns : [['course id', 'text'], ['title', 'text'], ['department name', 'text'], ['credits', 'number']] -- Table: instructor columns : [['id', 'text'], ['name', 'text'], ['department name', 'text'], ['salary', 'number']] -- Table: section columns : [['course id', 'text'], ['section id', 'text'], ['semester', 'text'], ['year', 'number'], ['building', 'text'], ['room number', 'text'], ['time slot id', 'text']] -- Table: teaches columns : [['id', 'text'], ['course id', 'text'], ['section id', 'text'], ['semester', 'text'], ['year', 'number']] -- Table: student columns : [['id', 'text'], ['name', 'text'], ['department name', 'text'], ['total credits', 'number']] -- Table: takes classes columns : [['id', 'text'], ['course id', 'text'], ['section id', 'text'], ['semester', 'text'], ['year', 'number'], ['grade', 'text']] -- Table: advisor columns : [['student id', 'text'], ['instructor id', 'text']] -- Table: time slot columns : [['time slot id', 'text'], ['day', 'text'], ['start hour', 'number'], ['start minute', 'number'], ['end hour', 'number'], ['end minute', 'number']] -- Table: prerequisite columns : [['course id', 'text'], ['prerequisite id', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Find the maximum and average capacity among rooms in each building.` to a syntactically-correct PostgreSQL query.
SELECT max(capacity) , avg(capacity) , building FROM classroom GROUP BY building
What are the greatest and average capacity for rooms in each building?
-- Language PostgreSQL -- Tables: -- Table: classroom columns : [['building', 'text'], ['room number', 'text'], ['capacity', 'number']] -- Table: department columns : [['department name', 'text'], ['building', 'text'], ['budget', 'number']] -- Table: course columns : [['course id', 'text'], ['title', 'text'], ['department name', 'text'], ['credits', 'number']] -- Table: instructor columns : [['id', 'text'], ['name', 'text'], ['department name', 'text'], ['salary', 'number']] -- Table: section columns : [['course id', 'text'], ['section id', 'text'], ['semester', 'text'], ['year', 'number'], ['building', 'text'], ['room number', 'text'], ['time slot id', 'text']] -- Table: teaches columns : [['id', 'text'], ['course id', 'text'], ['section id', 'text'], ['semester', 'text'], ['year', 'number']] -- Table: student columns : [['id', 'text'], ['name', 'text'], ['department name', 'text'], ['total credits', 'number']] -- Table: takes classes columns : [['id', 'text'], ['course id', 'text'], ['section id', 'text'], ['semester', 'text'], ['year', 'number'], ['grade', 'text']] -- Table: advisor columns : [['student id', 'text'], ['instructor id', 'text']] -- Table: time slot columns : [['time slot id', 'text'], ['day', 'text'], ['start hour', 'number'], ['start minute', 'number'], ['end hour', 'number'], ['end minute', 'number']] -- Table: prerequisite columns : [['course id', 'text'], ['prerequisite id', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the greatest and average capacity for rooms in each building?` to a syntactically-correct PostgreSQL query.
SELECT max(capacity) , avg(capacity) , building FROM classroom GROUP BY building
Find the title of the course that is offered by more than one 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 title of the course that is offered by more than one department.` to a syntactically-correct PostgreSQL query.
SELECT title FROM course GROUP BY title HAVING count(*) > 1
What are the titles of courses that are offered in more than one 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 titles of courses that are offered in more than one department?` to a syntactically-correct PostgreSQL query.
SELECT title FROM course GROUP BY title HAVING count(*) > 1
Find the total credits of courses provided by different 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 credits of courses provided by different department.` to a syntactically-correct PostgreSQL query.
SELECT sum(credits) , dept_name FROM course GROUP BY dept_name
How many total credits are offered by 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 total credits are offered by each department?` to a syntactically-correct PostgreSQL query.
SELECT sum(credits) , dept_name FROM course GROUP BY dept_name