sert121/SpiderSQL huggingface dataset:
-- Language PostgreSQL
        -- Tables: 
             -- Table: student 
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]

 -- Table: faculty 
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]

 -- Table: department 
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]

 -- Table: member of 
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]

 -- Table: course 
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]

 -- Table: minor in 
columns : [['student id', 'number'], ['department number', 'number']]

 -- Table: enrolled in 
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]

 -- Table: grade conversion 
columns : [['letter grade', 'text'], ['grade point', 'number']]

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



Question: Find the first name of students in the descending order of age.
SQL: SELECT Fname FROM STUDENT ORDER BY Age DESC
-- Language PostgreSQL
        -- Tables: 
             -- Table: student 
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]

 -- Table: faculty 
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]

 -- Table: department 
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]

 -- Table: member of 
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]

 -- Table: course 
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]

 -- Table: minor in 
columns : [['student id', 'number'], ['department number', 'number']]

 -- Table: enrolled in 
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]

 -- Table: grade conversion 
columns : [['letter grade', 'text'], ['grade point', 'number']]

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



Question: What are the first names of students, ordered by age from greatest to least?
SQL: SELECT Fname FROM STUDENT ORDER BY Age DESC
-- Language PostgreSQL
        -- Tables: 
             -- Table: student 
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]

 -- Table: faculty 
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]

 -- Table: department 
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]

 -- Table: member of 
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]

 -- Table: course 
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]

 -- Table: minor in 
columns : [['student id', 'number'], ['department number', 'number']]

 -- Table: enrolled in 
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]

 -- Table: grade conversion 
columns : [['letter grade', 'text'], ['grade point', 'number']]

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



Question: Find the last name of female (sex is F) students in the descending order of age.
SQL: SELECT LName FROM STUDENT WHERE Sex  =  "F" ORDER BY Age DESC
-- Language PostgreSQL
        -- Tables: 
             -- Table: student 
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]

 -- Table: faculty 
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]

 -- Table: department 
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]

 -- Table: member of 
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]

 -- Table: course 
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]

 -- Table: minor in 
columns : [['student id', 'number'], ['department number', 'number']]

 -- Table: enrolled in 
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]

 -- Table: grade conversion 
columns : [['letter grade', 'text'], ['grade point', 'number']]

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



Question: What are the last names of female students, ordered by age descending?
SQL: SELECT LName FROM STUDENT WHERE Sex  =  "F" ORDER BY Age DESC
-- Language PostgreSQL
        -- Tables: 
             -- Table: student 
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]

 -- Table: faculty 
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]

 -- Table: department 
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]

 -- Table: member of 
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]

 -- Table: course 
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]

 -- Table: minor in 
columns : [['student id', 'number'], ['department number', 'number']]

 -- Table: enrolled in 
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]

 -- Table: grade conversion 
columns : [['letter grade', 'text'], ['grade point', 'number']]

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



Question: Find the last names of faculties in building Barton in alphabetic order.
SQL: SELECT Lname FROM FACULTY WHERE Building  =  "Barton" ORDER BY Lname
-- Language PostgreSQL
        -- Tables: 
             -- Table: student 
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]

 -- Table: faculty 
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]

 -- Table: department 
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]

 -- Table: member of 
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]

 -- Table: course 
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]

 -- Table: minor in 
columns : [['student id', 'number'], ['department number', 'number']]

 -- Table: enrolled in 
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]

 -- Table: grade conversion 
columns : [['letter grade', 'text'], ['grade point', 'number']]

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



Question: What are the last names of faculty in building Barton, sorted by last name?
SQL: SELECT Lname FROM FACULTY WHERE Building  =  "Barton" ORDER BY Lname
-- Language PostgreSQL
        -- Tables: 
             -- Table: student 
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]

 -- Table: faculty 
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]

 -- Table: department 
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]

 -- Table: member of 
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]

 -- Table: course 
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]

 -- Table: minor in 
columns : [['student id', 'number'], ['department number', 'number']]

 -- Table: enrolled in 
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]

 -- Table: grade conversion 
columns : [['letter grade', 'text'], ['grade point', 'number']]

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



Question: Find the first names of faculties of rank Professor in alphabetic order.
SQL: SELECT Fname FROM FACULTY WHERE Rank  =  "Professor" ORDER BY Fname
-- Language PostgreSQL
        -- Tables: 
             -- Table: student 
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]

 -- Table: faculty 
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]

 -- Table: department 
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]

 -- Table: member of 
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]

 -- Table: course 
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]

 -- Table: minor in 
columns : [['student id', 'number'], ['department number', 'number']]

 -- Table: enrolled in 
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]

 -- Table: grade conversion 
columns : [['letter grade', 'text'], ['grade point', 'number']]

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



Question: What are the first names for all faculty professors, ordered by first name?
SQL: SELECT Fname FROM FACULTY WHERE Rank  =  "Professor" ORDER BY Fname
-- Language PostgreSQL
        -- Tables: 
             -- Table: student 
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]

 -- Table: faculty 
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]

 -- Table: department 
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]

 -- Table: member of 
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]

 -- Table: course 
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]

 -- Table: minor in 
columns : [['student id', 'number'], ['department number', 'number']]

 -- Table: enrolled in 
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]

 -- Table: grade conversion 
columns : [['letter grade', 'text'], ['grade point', 'number']]

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



Question: Find the name of the department that has the biggest number of students minored in?
SQL: SELECT T1.DName FROM DEPARTMENT AS T1 JOIN MINOR_IN AS T2 ON T1.DNO  =  T2.DNO GROUP BY T2.DNO ORDER BY count(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: student 
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]

 -- Table: faculty 
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]

 -- Table: department 
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]

 -- Table: member of 
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]

 -- Table: course 
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]

 -- Table: minor in 
columns : [['student id', 'number'], ['department number', 'number']]

 -- Table: enrolled in 
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]

 -- Table: grade conversion 
columns : [['letter grade', 'text'], ['grade point', 'number']]

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



Question: What is the name of the department with the most students minoring in it?
SQL: SELECT T1.DName FROM DEPARTMENT AS T1 JOIN MINOR_IN AS T2 ON T1.DNO  =  T2.DNO GROUP BY T2.DNO ORDER BY count(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: student 
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]

 -- Table: faculty 
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]

 -- Table: department 
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]

 -- Table: member of 
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]

 -- Table: course 
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]

 -- Table: minor in 
columns : [['student id', 'number'], ['department number', 'number']]

 -- Table: enrolled in 
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]

 -- Table: grade conversion 
columns : [['letter grade', 'text'], ['grade point', 'number']]

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



Question: Find the name of the department that has no students minored in?
SQL: SELECT DName FROM DEPARTMENT EXCEPT SELECT T1.DName FROM DEPARTMENT AS T1 JOIN MINOR_IN AS T2 ON T1.DNO  =  T2.DNO
-- Language PostgreSQL
        -- Tables: 
             -- Table: student 
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]

 -- Table: faculty 
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]

 -- Table: department 
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]

 -- Table: member of 
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]

 -- Table: course 
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]

 -- Table: minor in 
columns : [['student id', 'number'], ['department number', 'number']]

 -- Table: enrolled in 
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]

 -- Table: grade conversion 
columns : [['letter grade', 'text'], ['grade point', 'number']]

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



Question: What is the name of the department htat has no students minoring in it?
SQL: SELECT DName FROM DEPARTMENT EXCEPT SELECT T1.DName FROM DEPARTMENT AS T1 JOIN MINOR_IN AS T2 ON T1.DNO  =  T2.DNO
-- Language PostgreSQL
        -- Tables: 
             -- Table: student 
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]

 -- Table: faculty 
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]

 -- Table: department 
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]

 -- Table: member of 
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]

 -- Table: course 
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]

 -- Table: minor in 
columns : [['student id', 'number'], ['department number', 'number']]

 -- Table: enrolled in 
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]

 -- Table: grade conversion 
columns : [['letter grade', 'text'], ['grade point', 'number']]

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



Question: Find the name of the department that has the fewest members.
SQL: SELECT T1.DName FROM DEPARTMENT AS T1 JOIN MEMBER_OF AS T2 ON T1.DNO  =  T2.DNO GROUP BY T2.DNO ORDER BY count(*) ASC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: student 
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]

 -- Table: faculty 
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]

 -- Table: department 
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]

 -- Table: member of 
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]

 -- Table: course 
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]

 -- Table: minor in 
columns : [['student id', 'number'], ['department number', 'number']]

 -- Table: enrolled in 
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]

 -- Table: grade conversion 
columns : [['letter grade', 'text'], ['grade point', 'number']]

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



Question: What is the name of the department with the fewest members?
SQL: SELECT T1.DName FROM DEPARTMENT AS T1 JOIN MEMBER_OF AS T2 ON T1.DNO  =  T2.DNO GROUP BY T2.DNO ORDER BY count(*) ASC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: student 
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]

 -- Table: faculty 
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]

 -- Table: department 
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]

 -- Table: member of 
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]

 -- Table: course 
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]

 -- Table: minor in 
columns : [['student id', 'number'], ['department number', 'number']]

 -- Table: enrolled in 
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]

 -- Table: grade conversion 
columns : [['letter grade', 'text'], ['grade point', 'number']]

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



Question: Find the rank of the faculty that the fewest faculties belong to.
SQL: SELECT Rank FROM FACULTY GROUP BY Rank ORDER BY count(*) ASC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: student 
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]

 -- Table: faculty 
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]

 -- Table: department 
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]

 -- Table: member of 
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]

 -- Table: course 
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]

 -- Table: minor in 
columns : [['student id', 'number'], ['department number', 'number']]

 -- Table: enrolled in 
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]

 -- Table: grade conversion 
columns : [['letter grade', 'text'], ['grade point', 'number']]

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



Question: What is the least common faculty rank?
SQL: SELECT Rank FROM FACULTY GROUP BY Rank ORDER BY count(*) ASC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: student 
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]

 -- Table: faculty 
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]

 -- Table: department 
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]

 -- Table: member of 
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]

 -- Table: course 
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]

 -- Table: minor in 
columns : [['student id', 'number'], ['department number', 'number']]

 -- Table: enrolled in 
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]

 -- Table: grade conversion 
columns : [['letter grade', 'text'], ['grade point', 'number']]

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



Question: What are the first and last names of the instructors who teach the top 3 number of courses?
SQL: SELECT T2.Fname ,  T2.Lname FROM COURSE AS T1 JOIN FACULTY AS T2 ON T1.Instructor  =  T2.FacID GROUP BY T1.Instructor ORDER BY count(*) DESC LIMIT 3
-- Language PostgreSQL
        -- Tables: 
             -- Table: student 
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]

 -- Table: faculty 
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]

 -- Table: department 
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]

 -- Table: member of 
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]

 -- Table: course 
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]

 -- Table: minor in 
columns : [['student id', 'number'], ['department number', 'number']]

 -- Table: enrolled in 
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]

 -- Table: grade conversion 
columns : [['letter grade', 'text'], ['grade point', 'number']]

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



Question: What are the full names of the 3 instructors who teach the most courses?
SQL: SELECT T2.Fname ,  T2.Lname FROM COURSE AS T1 JOIN FACULTY AS T2 ON T1.Instructor  =  T2.FacID GROUP BY T1.Instructor ORDER BY count(*) DESC LIMIT 3
-- Language PostgreSQL
        -- Tables: 
             -- Table: student 
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]

 -- Table: faculty 
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]

 -- Table: department 
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]

 -- Table: member of 
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]

 -- Table: course 
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]

 -- Table: minor in 
columns : [['student id', 'number'], ['department number', 'number']]

 -- Table: enrolled in 
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]

 -- Table: grade conversion 
columns : [['letter grade', 'text'], ['grade point', 'number']]

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



Question: Which building does the instructor who teaches the most number of courses live in?
SQL: SELECT T2.Building FROM COURSE AS T1 JOIN FACULTY AS T2 ON T1.Instructor  =  T2.FacID GROUP BY T1.Instructor ORDER BY count(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: student 
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]

 -- Table: faculty 
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]

 -- Table: department 
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]

 -- Table: member of 
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]

 -- Table: course 
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]

 -- Table: minor in 
columns : [['student id', 'number'], ['department number', 'number']]

 -- Table: enrolled in 
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]

 -- Table: grade conversion 
columns : [['letter grade', 'text'], ['grade point', 'number']]

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



Question: Give the building that the instructor who teaches the greatest number of courses lives in.
SQL: SELECT T2.Building FROM COURSE AS T1 JOIN FACULTY AS T2 ON T1.Instructor  =  T2.FacID GROUP BY T1.Instructor ORDER BY count(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: student 
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]

 -- Table: faculty 
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]

 -- Table: department 
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]

 -- Table: member of 
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]

 -- Table: course 
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]

 -- Table: minor in 
columns : [['student id', 'number'], ['department number', 'number']]

 -- Table: enrolled in 
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]

 -- Table: grade conversion 
columns : [['letter grade', 'text'], ['grade point', 'number']]

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



Question: What are the name of courses that have at least five enrollments?
SQL: SELECT T1.CName FROM COURSE AS T1 JOIN ENROLLED_IN AS T2 ON T1.CID  =  T2.CID GROUP BY T2.CID HAVING COUNT(*)  >=  5
-- Language PostgreSQL
        -- Tables: 
             -- Table: student 
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]

 -- Table: faculty 
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]

 -- Table: department 
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]

 -- Table: member of 
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]

 -- Table: course 
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]

 -- Table: minor in 
columns : [['student id', 'number'], ['department number', 'number']]

 -- Table: enrolled in 
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]

 -- Table: grade conversion 
columns : [['letter grade', 'text'], ['grade point', 'number']]

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



Question: Give the names of the courses with at least five enrollments.
SQL: SELECT T1.CName FROM COURSE AS T1 JOIN ENROLLED_IN AS T2 ON T1.CID  =  T2.CID GROUP BY T2.CID HAVING COUNT(*)  >=  5
-- Language PostgreSQL
        -- Tables: 
             -- Table: student 
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]

 -- Table: faculty 
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]

 -- Table: department 
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]

 -- Table: member of 
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]

 -- Table: course 
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]

 -- Table: minor in 
columns : [['student id', 'number'], ['department number', 'number']]

 -- Table: enrolled in 
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]

 -- Table: grade conversion 
columns : [['letter grade', 'text'], ['grade point', 'number']]

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



Question: Find the first name and last name of the instructor of course that has course name
SQL: SELECT T2.Fname ,  T2.Lname FROM COURSE AS T1 JOIN FACULTY AS T2 ON T1.Instructor  =  T2.FacID WHERE T1.CName  =  "COMPUTER LITERACY"
-- Language PostgreSQL
        -- Tables: 
             -- Table: student 
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]

 -- Table: faculty 
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]

 -- Table: department 
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]

 -- Table: member of 
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]

 -- Table: course 
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]

 -- Table: minor in 
columns : [['student id', 'number'], ['department number', 'number']]

 -- Table: enrolled in 
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]

 -- Table: grade conversion 
columns : [['letter grade', 'text'], ['grade point', 'number']]

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



Question: What is the full name of the instructor who has a course named COMPUTER LITERACY?
SQL: SELECT T2.Fname ,  T2.Lname FROM COURSE AS T1 JOIN FACULTY AS T2 ON T1.Instructor  =  T2.FacID WHERE T1.CName  =  "COMPUTER LITERACY"
-- Language PostgreSQL
        -- Tables: 
             -- Table: student 
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]

 -- Table: faculty 
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]

 -- Table: department 
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]

 -- Table: member of 
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]

 -- Table: course 
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]

 -- Table: minor in 
columns : [['student id', 'number'], ['department number', 'number']]

 -- Table: enrolled in 
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]

 -- Table: grade conversion 
columns : [['letter grade', 'text'], ['grade point', 'number']]

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



Question: Find the department name and room of the course INTRODUCTION TO COMPUTER SCIENCE.
SQL: SELECT T2.Dname ,  T2.Room FROM COURSE AS T1 JOIN DEPARTMENT AS T2 ON T1.DNO  =  T2.DNO WHERE T1.CName  =  "INTRODUCTION TO COMPUTER SCIENCE"
-- Language PostgreSQL
        -- Tables: 
             -- Table: student 
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]

 -- Table: faculty 
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]

 -- Table: department 
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]

 -- Table: member of 
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]

 -- Table: course 
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]

 -- Table: minor in 
columns : [['student id', 'number'], ['department number', 'number']]

 -- Table: enrolled in 
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]

 -- Table: grade conversion 
columns : [['letter grade', 'text'], ['grade point', 'number']]

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



Question: What are the department name and room for the course INTRODUCTION TO COMPUTER SCIENCE?
SQL: SELECT T2.Dname ,  T2.Room FROM COURSE AS T1 JOIN DEPARTMENT AS T2 ON T1.DNO  =  T2.DNO WHERE T1.CName  =  "INTRODUCTION TO COMPUTER SCIENCE"
-- Language PostgreSQL
        -- Tables: 
             -- Table: student 
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]

 -- Table: faculty 
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]

 -- Table: department 
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]

 -- Table: member of 
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]

 -- Table: course 
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]

 -- Table: minor in 
columns : [['student id', 'number'], ['department number', 'number']]

 -- Table: enrolled in 
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]

 -- Table: grade conversion 
columns : [['letter grade', 'text'], ['grade point', 'number']]

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



Question: Find the student first and last names and grade points of all enrollments.
SQL: SELECT T3.Fname ,  T3.LName ,  T2.gradepoint FROM ENROLLED_IN AS T1 JOIN GRADECONVERSION AS T2 JOIN STUDENT AS T3 ON T1.Grade  =  T2.lettergrade AND T1.StuID  =  T3.StuID