[
  {
    "db_id": "computer_student",
    "question": "Which professor advised more than one student in the program?",
    "evidence": "",
    "SQL": "SELECT p_id FROM person WHERE p_id IN (SELECT p_id FROM advisedBy GROUP BY p_id HAVING COUNT(*) > 1)"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of students advised by professors who have not taught any courses?",
    "evidence": "",
    "SQL": "SELECT COUNT(DISTINCT T1.p_id_dummy) FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.p_id NOT IN (SELECT T4.p_id FROM taughtBy AS T4)"
  },
  {
    "db_id": "computer_student",
    "question": "What are the names of the students who have been advised by a professor who teaches a course that has a level more than Level_200?",
    "evidence": "",
    "SQL": "SELECT P1.p_id, P1.student, C.courseLevel FROM person AS P1 INNER JOIN advisedBy AS T1 ON P1.p_id = T1.p_id_dummy INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS C ON T2.course_id = C.course_id WHERE C.courseLevel > 'Level_200' ORDER BY P1.p_id"
  },
  {
    "db_id": "computer_student",
    "question": "Which professors are advising only one student and teaching more than one high-level undergraduate course?",
    "evidence": "",
    "SQL": "SELECT P.p_id, P.professor FROM person P JOIN advisedBy AB ON P.p_id = AB.p_id_dummy WHERE P.student = 0 AND P.p_id IN (SELECT T2.p_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T1.courseLevel = 'Level_400' GROUP BY T2.p_id HAVING COUNT(DISTINCT T1.course_id) > 1)"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of students under all advisors?",
    "evidence": "",
    "SQL": "SELECT COUNT(DISTINCT p_id_dummy) FROM advisedBy"
  },
  {
    "db_id": "computer_student",
    "question": "What are the IDs of the people who are both students and professors, and have a certain position?",
    "evidence": "",
    "SQL": "SELECT p_id FROM person WHERE student = 1 AND professor = 1 AND hasPosition IS NOT NULL"
  },
  {
    "db_id": "computer_student",
    "question": "What are the names of courses taught by the professors who have been in the program for 2 years or less?",
    "evidence": "",
    "SQL": "SELECT course.course_id, course.courseLevel FROM taughtBy INNER JOIN course ON taughtBy.course_id = course.course_id INNER JOIN person ON taughtBy.p_id = person.p_id WHERE person.yearsInProgram <= '2 years' ORDER BY course.courseLevel"
  },
  {
    "db_id": "computer_student",
    "question": "How many students are currently in phase 3 of the program?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person WHERE inPhase = 'Phase_3'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of students who are advised by professors in the program?",
    "evidence": "",
    "SQL": "SELECT COUNT(DISTINCT T1.p_id) AS totalStudents FROM person AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id_dummy WHERE T1.inPhase = 'In-Program'"
  },
  {
    "db_id": "computer_student",
    "question": "What are the IDs of people who are both professors and students?",
    "evidence": "",
    "SQL": "SELECT p_id FROM person WHERE professor <> 0 AND student <> 0"
  },
  {
    "db_id": "computer_student",
    "question": "What are the course IDs and levels of all courses taught by professors with more than 4 years in program?",
    "evidence": "",
    "SQL": "SELECT T1.course_id, T2.courseLevel FROM taughtBy AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T1.p_id = T3.p_id WHERE T3.yearsInProgram > 'Year_4'"
  },
  {
    "db_id": "computer_student",
    "question": "Which professors teach courses for students in their first year?",
    "evidence": "",
    "SQL": "SELECT DISTINCT p_id FROM taughtBy AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T2.courseLevel = 'Level_100'"
  },
  {
    "db_id": "computer_student",
    "question": "What courses is a person teaching, and which ones are they advising another person to take?",
    "evidence": "",
    "SQL": "SELECT T1.courseLevel, T2.p_id AS advisor, T3.p_id AS advisee FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN advisedBy AS T4 ON T2.p_id = T4.p_id_dummy CROSS JOIN person AS T3 WHERE T3.p_id != T2.p_id AND T4.p_id = T3.p_id"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses taught by faculty professors who have been teaching for more than 3 years?",
    "evidence": "",
    "SQL": "SELECT T3.course_id, T3.courseLevel FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T1.course_id WHERE T2.inPhase = 'More_than_3_years' AND T2.hasPosition = 'Faculty_eme'"
  },
  {
    "db_id": "computer_student",
    "question": "Which professors teach more than one course?",
    "evidence": "",
    "SQL": "SELECT DISTINCT T2.p_id FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id GROUP BY T2.p_id HAVING COUNT(T1.course_id) > 1"
  },
  {
    "db_id": "computer_student",
    "question": "What percentage of professors teach high-level undergraduate courses?",
    "evidence": "",
    "SQL": "SELECT CAST(SUM(CASE WHEN T1.courseLevel = 'Level_400' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) AS per FROM course AS T1 JOIN taughtBy AS T2 ON T1.course_id = T2.course_id"
  },
  {
    "db_id": "computer_student",
    "question": "List the names of professors who teach at least two different courses.",
    "evidence": "",
    "SQL": "SELECT DISTINCT T1.p_id, P1.student FROM person AS P1 INNER JOIN taughtBy AS T1 ON P1.p_id = T1.p_id GROUP BY T1.p_id, P1.student HAVING COUNT(DISTINCT T1.course_id) > 1"
  },
  {
    "db_id": "computer_student",
    "question": "What percentage of students are in phase 3?",
    "evidence": "",
    "SQL": "SELECT CAST(COUNT(*) AS REAL) * 100 / (SELECT COUNT(*) FROM person WHERE inPhase='Phase_3') AS percentage FROM person WHERE inPhase='Phase_3'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the average years of experience of professors teaching a course at courseLevel 'undergraduate'?",
    "evidence": "",
    "SQL": "SELECT AVG(yearsInProgram) FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T2.course_id WHERE T3.courseLevel = 'undergraduate' AND T1.professor = 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the number of students who are not in phase?",
    "evidence": "",
    "SQL": "SELECT COUNT(DISTINCT p_id) FROM person WHERE inPhase IS NULL OR inPhase = ''"
  },
  {
    "db_id": "computer_student",
    "question": "What are the names of all the professors that teach a course with a level greater than 400?",
    "evidence": "",
    "SQL": "SELECT P.p_id, P.professor, C.courseLevel FROM taughtBy AS T1 INNER JOIN course AS C ON T1.course_id = C.course_id INNER JOIN person AS P ON T1.p_id = P.p_id WHERE C.courseLevel > '400' ORDER BY P.p_id"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses offered by the professor who has taught the most number of courses?",
    "evidence": "",
    "SQL": "SELECT T3.course_id, T3.courseLevel FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T1.course_id GROUP BY T1.p_id ORDER BY COUNT(*) DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the ID of the student who has been in the program for the least amount of time?",
    "evidence": "",
    "SQL": "SELECT p_id FROM person WHERE yearsInProgram = (SELECT MIN(yearsInProgram) FROM person)"
  },
  {
    "db_id": "computer_student",
    "question": "What course is taught by all professors who also have a position?",
    "evidence": "",
    "SQL": "SELECT course.course_id FROM course INNER JOIN taughtBy ON course.course_id = taughtBy.course_id INNER JOIN person ON taughtBy.p_id = person.p_id WHERE person.hasPosition IS NOT NULL GROUP BY course.course_id HAVING COUNT(person.p_id) = (SELECT COUNT(*) FROM person WHERE hasPosition IS NOT NULL)"
  },
  {
    "db_id": "computer_student",
    "question": "What is the average number of years in program for students who are advised by a professor who teaches a 'Level_500' course?",
    "evidence": "",
    "SQL": "SELECT AVG(T1.yearsInProgram) FROM person AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id_dummy INNER JOIN taughtBy AS T3 ON T2.p_id = T3.p_id INNER JOIN course AS T4 ON T3.course_id = T4.course_id WHERE T4.courseLevel = 'Level_500' AND T1.student = 1"
  },
  {
    "db_id": "computer_student",
    "question": "List the ID of all students who were advised by professor with id 123.",
    "evidence": "",
    "SQL": "SELECT s.student FROM person AS s JOIN advisedBy AS a ON s.p_id = a.p_id_dummy WHERE a.p_id = 123"
  },
  {
    "db_id": "computer_student",
    "question": "Which students have more than one advisor?",
    "evidence": "",
    "SQL": "SELECT p_id FROM advisedBy GROUP BY p_id HAVING COUNT(p_id) > 1"
  },
  {
    "db_id": "computer_student",
    "question": "Which students are advised by a professor who teaches a course?",
    "evidence": "",
    "SQL": "SELECT p1.p_id FROM person AS p1 INNER JOIN advisedBy AS a1 ON p1.p_id = a1.p_id_dummy INNER JOIN taughtBy AS t1 ON a1.p_id = t1.p_id"
  },
  {
    "db_id": "computer_student",
    "question": "What is the average course level of students in year 1?",
    "evidence": "",
    "SQL": "SELECT AVG(T3.courseLevel) FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T2.course_id WHERE T1.yearsInProgram = 'Year_1'"
  },
  {
    "db_id": "computer_student",
    "question": "What level is course 152? List the professors who teach the course.",
    "evidence": "",
    "SQL": "SELECT T1.courseLevel, T2.p_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T2.course_id = 152"
  },
  {
    "db_id": "computer_student",
    "question": "What is the ID of the professor who has taught the most courses?",
    "evidence": "",
    "SQL": "SELECT p_id, COUNT(*) AS course_count FROM taughtBy GROUP BY p_id ORDER BY course_count DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the level of the course taught by the person with ID 35?",
    "evidence": "",
    "SQL": "SELECT courseLevel FROM course INNER JOIN taughtBy ON course.course_id = taughtBy.course_id WHERE taughtBy.p_id = 35"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of courses taught by professors with at least 3 years in program?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) AS total FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T1.course_id = T3.course_id WHERE T2.yearsInProgram >= 3"
  },
  {
    "db_id": "computer_student",
    "question": "How many professors in year 1 are teaching a course?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.yearsInProgram = 'Year_1'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the number of students in all courses that are taught by faculty affiliated professors in their first year of the program?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T2.course_id INNER JOIN person AS T4 ON T3.course_id = T4.p_id WHERE T1.hasPosition = 'Faculty_aff' AND T1.student = 1 AND T4.yearsInProgram = 'Year_1'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of students being advised by professors who are not students?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.student = 0"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses taught by 515?",
    "evidence": "",
    "SQL": "SELECT course_id FROM taughtBy WHERE p_id = 515"
  },
  {
    "db_id": "computer_student",
    "question": "What is the list of students who have a professor having a position 'Teacher Assistant'?",
    "evidence": "",
    "SQL": "SELECT p_id FROM person WHERE hasPosition = 'Teacher Assistant' INTERSECT SELECT p_id FROM person WHERE student IS NOT NULL"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses that have both a professor and a student who are in the same phase?",
    "evidence": "",
    "SQL": "SELECT T3.course_id FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN person AS T4 ON T2.student = T4.p_id INNER JOIN course AS T3 ON T1.course_id = T3.course_id WHERE T3.courseLevel = T2.inPhase"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses taught by the faculty professor who taught course ID 201 and also teach the course 'Data Structures and Algorithms'?",
    "evidence": "",
    "SQL": "SELECT DISTINCT course_id FROM taughtBy WHERE p_id IN (SELECT p_id FROM taughtBy WHERE course_id = 201) AND course_id IN (SELECT course_id FROM taughtBy WHERE p_id IN (SELECT p_id FROM person WHERE hasPosition <> 0) AND course_id LIKE '% Data Structures and Algorithms %') GROUP BY course_id"
  },
  {
    "db_id": "computer_student",
    "question": "What are the levels of all basic undergraduate courses?",
    "evidence": "",
    "SQL": "SELECT DISTINCT T1.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T1.courseLevel = 'Level_200'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the course ID of the undergraduate course taught by a student who is in their first phase of studies?",
    "evidence": "",
    "SQL": "SELECT T1.course_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T3.p_id = T2.p_id WHERE T3.inPhase = 'Phase_1' AND T3.student = 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the percentage of courses taught by professors who have been professors for more than 10 years?",
    "evidence": "",
    "SQL": "SELECT CAST(SUM(CASE WHEN hasPosition = 'Position_200' AND yearsInProgram > 10 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) AS per FROM person AS T1 JOIN taughtBy AS T2 ON T1.p_id = T2.p_id JOIN course AS T3 ON T3.course_id = T2.course_id WHERE T1.hasPosition = 'Position_200' AND T3.courseLevel != 'Level_100'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the course level of the courses taught by 'Name'?",
    "evidence": "",
    "SQL": "SELECT courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE p_id IN (SELECT p_id FROM person WHERE professor = 'Name')"
  },
  {
    "db_id": "computer_student",
    "question": "What are the IDs of the students who are advised by a professor who teaches a course at Level_200?",
    "evidence": "",
    "SQL": "SELECT T2.p_id FROM person AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id INNER JOIN taughtBy AS T3 ON T3.p_id = T1.p_id INNER JOIN course AS T4 ON T3.course_id = T4.course_id WHERE T4.courseLevel = 'Level_200'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the average number of courses taught by a single professor?",
    "evidence": "",
    "SQL": "SELECT CAST(COUNT(course_id) AS REAL) / COUNT(DISTINCT p_id) AS avgnum FROM taughtBy GROUP BY p_id"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of courses taught by professors who teach only undergraduate courses?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM course INNER JOIN taughtBy ON course.course_id = taughtBy.course_id WHERE courseLevel = 'Level_300' OR courseLevel = 'Level_400' OR courseLevel = 'Level_500'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the average number of courses taught by each professor?",
    "evidence": "",
    "SQL": "SELECT CAST(COUNT(course_id) AS REAL) / COUNT(DISTINCT p_id) AS avgnum FROM taughtBy"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses that are being taught by more than one professor?",
    "evidence": "",
    "SQL": "SELECT T1.course_id, T1.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id GROUP BY T1.course_id, T1.courseLevel HAVING COUNT(T2.p_id) > 1"
  },
  {
    "db_id": "computer_student",
    "question": "Who teaches the course with the highest number of students?",
    "evidence": "",
    "SQL": "SELECT T2.p_id FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T2.course_id GROUP BY T2.p_id ORDER BY COUNT(T1.student) DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What are the course IDs and levels of courses taught by a professor whose last name is 'Johnson'?",
    "evidence": "",
    "SQL": "SELECT T1.course_id, T1.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS P ON T2.p_id = P.p_id WHERE P.professor = 1 AND P.hasPosition = 'Johnson' GROUP BY T1.course_id, T1.courseLevel"
  },
  {
    "db_id": "computer_student",
    "question": "What is the level of the course taught by professor with ID 12?",
    "evidence": "",
    "SQL": "SELECT courseLevel FROM course, taughtBy WHERE course.course_id = taughtBy.course_id AND p_id = 12"
  },
  {
    "db_id": "computer_student",
    "question": "List all courses taught by professors with more than 5 years of experience in the field.",
    "evidence": "",
    "SQL": "SELECT * FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T1.course_id WHERE T2.yearsInProgram > 5"
  },
  {
    "db_id": "computer_student",
    "question": "List the IDs of all students who have been advised by a professor who taught 'Level_200' courses.",
    "evidence": "",
    "SQL": "SELECT p_id FROM person WHERE p_id IN (SELECT p_id_dummy FROM advisedBy AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id WHERE T2.course_id IN (SELECT course_id FROM course WHERE courseLevel = 'Level_200'))"
  },
  {
    "db_id": "computer_student",
    "question": "What professors teach course ID 123?",
    "evidence": "",
    "SQL": "SELECT distinct T1.p_id FROM taughtBy AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T2.course_id = 123"
  },
  {
    "db_id": "computer_student",
    "question": "What is the course level for the course that a professor with ID 141 has taught?",
    "evidence": "",
    "SQL": "SELECT T1.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T2.p_id = 141"
  },
  {
    "db_id": "computer_student",
    "question": "Which students are taught by professors that teach more than 2 courses?",
    "evidence": "",
    "SQL": "SELECT p_id FROM taughtBy GROUP BY p_id HAVING COUNT(course_id) > 2"
  },
  {
    "db_id": "computer_student",
    "question": "What is the number of students who are taught by a professor who taught a high-level undergraduate course?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM advisedBy AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN person AS T3 ON T2.p_id = T3.p_id INNER JOIN course AS T4 ON T2.course_id = T4.course_id WHERE T4.courseLevel = 'Level_400'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of people in a given course (including professors and students)?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM taughtBy INNER JOIN person ON taughtBy.p_id = person.p_id"
  },
  {
    "db_id": "computer_student",
    "question": "What is the list of students who are advised by a professor who teaches a course with 'Introduction' level?",
    "evidence": "",
    "SQL": "SELECT S1.p_id FROM person AS S1 JOIN advisedBy AS T1 ON S1.p_id = T1.p_id_dummy JOIN person AS T2 ON T1.p_id = T2.p_id JOIN taughtBy AS T3 ON T2.p_id = T3.p_id JOIN course AS T4 ON T3.course_id = T4.course_id WHERE T4.courseLevel = 'Introduction'"
  },
  {
    "db_id": "computer_student",
    "question": "Which professors taught courses that included both a student and a professor from the same department?",
    "evidence": "",
    "SQL": "SELECT DISTINCT T2.p_id FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN advisedBy AS T3 ON T1.p_id = T3.p_id_dummy WHERE T1.hasPosition = 'Student' OR T1.hasPosition = 'Professor' GROUP BY T2.p_id HAVING COUNT(DISTINCT CASE WHEN T1.hasPosition = 'Student' THEN T1.p_id ELSE T3.p_id_dummy END) > 0"
  },
  {
    "db_id": "computer_student",
    "question": "What is the number of courses taught by professors in Level 400 and their inPhase is 'Graduated'?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM taughtBy AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T1.p_id = T3.p_id WHERE T3.hasPosition = 'Faculty_aff' AND T2.courseLevel = 'Level_400' AND T3.inPhase = 'Graduated'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the ID of the course taught by a professor who is also a student in the 3rd year of their program?",
    "evidence": "",
    "SQL": "SELECT T1.course_id FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.yearsInProgram = 'Year_3'"
  },
  {
    "db_id": "computer_student",
    "question": "What are the professors who have taught courses of all levels?",
    "evidence": "",
    "SQL": "SELECT p_id FROM person WHERE professor = 1 AND (SELECT COUNT(*) FROM taughtBy WHERE taughtBy.p_id = person.p_id GROUP BY taughtBy.p_id) = (SELECT COUNT(*) FROM course) AND hasPosition = 0"
  },
  {
    "db_id": "computer_student",
    "question": "What is the average course level of the courses taught by a professor who also advises a student in 1st year?",
    "evidence": "",
    "SQL": "SELECT AVG(courseLevel) FROM course, taughtBy, advisedBy, person WHERE course.course_id = taughtBy.course_id AND taughtBy.p_id = advisedBy.p_id_dummy AND advisedBy.p_id = person.p_id AND person.yearsInProgram = 'Year_1' AND person.student = 1"
  },
  {
    "db_id": "computer_student",
    "question": "What are the advisors who have the same position as professor with ID 376?",
    "evidence": "",
    "SQL": "SELECT * FROM person AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id_dummy WHERE T1.hasPosition = (SELECT T3.hasPosition FROM person AS T3 WHERE T3.p_id = 376)"
  },
  {
    "db_id": "computer_student",
    "question": "Which courses are taught by professors who have advised a student?",
    "evidence": "",
    "SQL": "SELECT C.course_id, C.courseLevel FROM course AS C INNER JOIN taughtBy AS T ON C.course_id = T.course_id INNER JOIN person AS P ON T.p_id = P.p_id INNER JOIN advisedBy AS A ON P.p_id = A.p_id AND P.student = 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of students currently enrolled in courses taught by the professor of 'Networking' course?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person WHERE inPhase IS NOT NULL AND (SELECT p_id FROM taughtBy WHERE course_id = (SELECT course_id FROM course WHERE courseLevel = 'Networking')) IN (SELECT p_id FROM person WHERE student = 1)"
  },
  {
    "db_id": "computer_student",
    "question": "What is the course ID of every course taught by a professor with name 'Prof Smith'?",
    "evidence": "",
    "SQL": "SELECT T1.course_id FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.hasPosition = 'Prof Smith'"
  },
  {
    "db_id": "computer_student",
    "question": "What courses are taught by a professor who is also a student?",
    "evidence": "",
    "SQL": "SELECT course_id FROM taughtBy WHERE p_id IN (SELECT p_id FROM person WHERE yearsInProgram IS NOT NULL)"
  },
  {
    "db_id": "computer_student",
    "question": "What are the names of the students who are being taught by professors with a position 'Chair'?",
    "evidence": "",
    "SQL": "SELECT T1.p_id FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T2.course_id INNER JOIN person AS T4 ON T4.p_id = T1.student WHERE T4.hasPosition = 'Chair'"
  },
  {
    "db_id": "computer_student",
    "question": "Who are the students in Phase 3 taught by a teacher who teaches course with course level 'Advanced'? ",
    "evidence": "",
    "SQL": "SELECT P1.p_id FROM person AS P1 INNER JOIN taughtBy AS T1 ON P1.p_id = T1.p_id INNER JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T2.courseLevel = 'Advanced' AND P1.inPhase = 'Phase 3'"
  },
  {
    "db_id": "computer_student",
    "question": "How many students in each phase are taught by advisors with at least 5 years of experience in the program?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) AS num_students, inPhase, yearsInProgram FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.yearsInProgram >= 5 GROUP BY inPhase, yearsInProgram"
  },
  {
    "db_id": "computer_student",
    "question": "What is the number of professors who have advised more than one student?",
    "evidence": "",
    "SQL": "SELECT COUNT(DISTINCT T1.p_id) FROM advisedBy AS T1 GROUP BY T1.p_id HAVING COUNT(DISTINCT T1.p_id) > 1"
  },
  {
    "db_id": "computer_student",
    "question": "What course levels are taught by professors affiliated to Faculty of Computing Science?",
    "evidence": "",
    "SQL": "SELECT DISTINCT T3.courseLevel FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T2.course_id WHERE T1.hasPosition = 'Faculty_aff' AND T3.courseLevel IS NOT NULL"
  },
  {
    "db_id": "computer_student",
    "question": "What courses are taught by faculty with more than 5 years of experience?",
    "evidence": "",
    "SQL": "SELECT course_id FROM taughtBy WHERE p_id IN (SELECT p_id FROM person WHERE yearsInProgram > '5 Years')"
  },
  {
    "db_id": "computer_student",
    "question": "Which professors are advisors to students who are in the 3rd year of their program?",
    "evidence": "",
    "SQL": "SELECT T2.p_id FROM person AS T2 INNER JOIN advisedBy AS T1 ON T2.p_id = T1.p_id_dummy WHERE T2.yearsInProgram = 'Year_3'"
  },
  {
    "db_id": "computer_student",
    "question": "What are all the courses taught by the professors that are not advised by any student?",
    "evidence": "",
    "SQL": "SELECT DISTINCT c.course_id, c.courseLevel FROM taughtBy t JOIN course c ON t.course_id = c.course_id JOIN person p ON t.p_id = p.p_id WHERE p.professor = 1 AND NOT EXISTS (SELECT 1 FROM advisedBy a WHERE a.p_id = p.p_id)"
  },
  {
    "db_id": "computer_student",
    "question": "What professors are teaching both Level_300 and Level_200 courses?",
    "evidence": "",
    "SQL": "SELECT T1.p_id FROM taughtBy AS T1 WHERE T1.course_id IN (SELECT course_id FROM course WHERE courseLevel = 'Level_300') INTERSECT SELECT T2.p_id FROM taughtBy AS T2 WHERE T2.course_id IN (SELECT course_id FROM course WHERE courseLevel = 'Level_200')"
  },
  {
    "db_id": "computer_student",
    "question": "How many courses taught by professors in 2nd year are not taught by professors in 3rd year?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM taughtBy AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T1.p_id = T3.p_id INNER JOIN person AS T4 ON T3.p_id = T4.p_id WHERE T3.yearsInProgram = 'Year_2' AND T4.yearsInProgram = 'Year_3' AND T1.p_id = T3.p_id"
  },
  {
    "db_id": "computer_student",
    "question": "List the IDs of students who are taught by professor who have a position 'Faculty_eme' in the 'Level_500' courses.",
    "evidence": "",
    "SQL": "SELECT T3.p_id, T4.course_id FROM taughtBy AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T1.p_id = T3.p_id INNER JOIN taughtBy AS T4 ON T4.course_id = T2.course_id WHERE T3.hasPosition = 'Faculty_eme' AND T2.courseLevel = 'Level_500'"
  },
  {
    "db_id": "computer_student",
    "question": "How many professors have taught courses with a course level greater than A?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) AS numProfessors FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T3.courseLevel > 'A' AND T1.student = 0"
  },
  {
    "db_id": "computer_student",
    "question": "Which courses are taught by the most professors?",
    "evidence": "",
    "SQL": "SELECT course_id FROM taughtBy GROUP BY course_id ORDER BY COUNT(p_id) DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the average length of time professors stay in the program?",
    "evidence": "",
    "SQL": "SELECT AVG(yearsInProgram) FROM person WHERE hasPosition = 'Faculty_member' AND inPhase = 'Active'"
  },
  {
    "db_id": "computer_student",
    "question": "Who are all the students who are not in a phase?",
    "evidence": "",
    "SQL": "SELECT * FROM person WHERE inPhase IS NULL"
  },
  {
    "db_id": "computer_student",
    "question": "How many courses are taught by faculty professors?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM taughtBy WHERE p_id IN (SELECT p_id FROM person WHERE hasPosition = 'Professor')"
  },
  {
    "db_id": "computer_student",
    "question": "List down all the courses taught by professors with more than 3 years in the university program.",
    "evidence": "",
    "SQL": "SELECT C.course_id FROM course AS C INNER JOIN taughtBy AS T ON C.course_id = T.course_id INNER JOIN person AS P ON T.p_id = P.p_id WHERE P.inPhase IS NOT NULL GROUP BY C.course_id HAVING COUNT(DISTINCT P.inPhase) > 3"
  },
  {
    "db_id": "computer_student",
    "question": "How many students does a professor advise in total?",
    "evidence": "",
    "SQL": "SELECT COUNT(DISTINCT p_id) FROM advisedBy"
  },
  {
    "db_id": "computer_student",
    "question": "What are the names of students advised by professors who taught undergraduate courses?",
    "evidence": "",
    "SQL": "SELECT p.student FROM person AS p INNER JOIN advisedBy AS ab ON p.p_id = ab.p_id_dummy INNER JOIN taughtBy AS tb ON tb.p_id = ab.p_id INNER JOIN course AS c ON tb.course_id = c.course_id WHERE c.courseLevel = 'Level_300'"
  },
  {
    "db_id": "computer_student",
    "question": "Which professors are in Phase 1 and have been in the program for 2 years?",
    "evidence": "",
    "SQL": "SELECT p_id FROM person WHERE inPhase='Phase 1' AND yearsInProgram='2'"
  },
  {
    "db_id": "computer_student",
    "question": "Mention the course IDs of all courses taught by a person in Year 3 of the program.",
    "evidence": "",
    "SQL": "SELECT T1.course_id FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.yearsInProgram = 'Year_3'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the list of courses taught by non-faculty members?",
    "evidence": "",
    "SQL": "SELECT * FROM course WHERE course_id IN (SELECT course_id FROM taughtBy WHERE p_id IN (SELECT p_id FROM person WHERE hasPosition = 0))"
  },
  {
    "db_id": "computer_student",
    "question": "What is the average length of time professors have been in the program among those teaching courses at level 500?",
    "evidence": "",
    "SQL": "SELECT AVG(T2.yearsInProgram) FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T1.course_id WHERE T3.courseLevel = 'Level_500' GROUP BY T2.yearsInProgram"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of people that are not professors?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person WHERE professor = 0"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses taught by the professor who taught the most professional or master/undergraduate courses?",
    "evidence": "",
    "SQL": "SELECT T1.course_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id GROUP BY T2.p_id ORDER BY COUNT(T2.p_id) DESC LIMIT 1,1"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses taught by professors in faculty?",
    "evidence": "",
    "SQL": "SELECT course.course_id, course.courseLevel FROM course INNER JOIN taughtBy ON course.course_id = taughtBy.course_id INNER JOIN person ON taughtBy.p_id = person.p_id WHERE person.hasPosition = 'Faculty'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the highest level of courses taught by the faculty who teach both Level_500 and Level_300 courses?",
    "evidence": "",
    "SQL": "SELECT MAX(T3.courseLevel) FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T2.course_id WHERE T3.courseLevel IN ('Level_500', 'Level_300') GROUP BY T1.p_id HAVING COUNT(DISTINCT T3.courseLevel) = 2"
  },
  {
    "db_id": "computer_student",
    "question": "What is the list of courses taught by a professor who taught a course of level undergraduate and student of year 1?",
    "evidence": "",
    "SQL": "SELECT T3.course_id, T3.courseLevel FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T2.course_id WHERE T1.student = 1 AND T3.courseLevel = 'Level_300'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the number of professors who are teaching at least two different courses?",
    "evidence": "",
    "SQL": "SELECT COUNT(DISTINCT p_id) FROM taughtBy GROUP BY p_id HAVING COUNT(course_id) > 1"
  },
  {
    "db_id": "computer_student",
    "question": "Which students are taught by a professor that teaches a course with a course level of 'Level_200'?",
    "evidence": "",
    "SQL": "SELECT T1.p_id FROM person AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id INNER JOIN taughtBy AS T3 ON T3.p_id = T2.p_id_dummy INNER JOIN course AS T4 ON T3.course_id = T4.course_id WHERE T4.courseLevel = 'Level_200'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the sum of students advised by professors who have more than one advising position?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person WHERE hasPosition LIKE '%;%' AND student = 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the ID of the student who has been in the program for the least number of years?",
    "evidence": "",
    "SQL": "SELECT p_id FROM person GROUP BY p_id ORDER BY MIN(cast(inPhase as integer)) ASC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of professors and students who have a position as 'Faculty' or 'Teaching Assistant'?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person WHERE hasPosition = 'Faculty' OR hasPosition = 'Teaching Assistant'"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses taught by the professor who taught the most courses in the 'Faculty' department?",
    "evidence": "",
    "SQL": "SELECT T1.course_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id GROUP BY T1.course_id ORDER BY COUNT(T2.p_id) DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What courses are taught by professors who have taught at least 2 courses?",
    "evidence": "",
    "SQL": "SELECT course_id FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id GROUP BY course_id, T2.p_id HAVING COUNT(T1.course_id) >= 2"
  },
  {
    "db_id": "computer_student",
    "question": "What is the list of professors who teach high-level undergraduate courses?",
    "evidence": "",
    "SQL": "SELECT T1.p_id FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T2.course_id WHERE T1.professor = 1 AND T3.courseLevel = 'Level_400'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of students and faculty members in the program?",
    "evidence": "",
    "SQL": "SELECT COUNT(DISTINCT student), COUNT(DISTINCT p_id) FROM person WHERE (hasPosition = 'student' OR hasPosition = 'professor') AND (yearsInProgram IS NULL OR yearsInProgram = 'some values')"
  },
  {
    "db_id": "computer_student",
    "question": "What is the average number of courses taught by each professor?",
    "evidence": "",
    "SQL": "SELECT AVG(T1.course_id) FROM taughtBy AS T1 GROUP BY T1.p_id"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses that are taught by a professor who has also advised multiple students?",
    "evidence": "",
    "SQL": "SELECT DISTINCT T3.course_id, T3.courseLevel FROM course AS T3 INNER JOIN taughtBy AS T2 ON T3.course_id = T2.course_id INNER JOIN advisedBy AS T1 ON T2.p_id = T1.p_id GROUP BY T3.course_id, T3.courseLevel HAVING COUNT(DISTINCT T1.p_id_dummy) > 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the highest level of course taught by a person?",
    "evidence": "",
    "SQL": "SELECT MAX(courseLevel) AS highest_level FROM course INNER JOIN taughtBy ON course.course_id = taughtBy.course_id"
  },
  {
    "db_id": "computer_student",
    "question": "How many professors are advising at least one student in the Phase of qualifications?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person AS T1 JOIN advisedBy AS T2 ON T1.p_id = T2.p_id WHERE T2.p_id_dummy IS NOT NULL AND inPhase = 1"
  },
  {
    "db_id": "computer_student",
    "question": "List the names of the professors who have taught more than one course.",
    "evidence": "",
    "SQL": "SELECT P1.p_id, P1.professor from person as P1 join taughtBy as T1 on P1.p_id = T1.p_id group by P1.p_id having count(T1.course_id) > 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the number of students advised by a professor who taught a basic course?",
    "evidence": "",
    "SQL": "SELECT COUNT(DISTINCT T1.p_id) FROM person AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id INNER JOIN taughtBy AS T3 ON T2.p_id = T3.p_id INNER JOIN course AS T4 ON T3.course_id = T4.course_id WHERE T4.courseLevel = 'Level_100' AND T1.student = 1"
  },
  {
    "db_id": "computer_student",
    "question": "What are all the professors who advise the most students?",
    "evidence": "",
    "SQL": "SELECT T1.p_id FROM person AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id GROUP BY T1.p_id ORDER BY COUNT(T2.p_id) DESC"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses taught by the professor who advised the most students?",
    "evidence": "",
    "SQL": "SELECT DISTINCT T3.course_id, T3.courseLevel FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T1.course_id GROUP BY T3.course_id ORDER BY COUNT(*) DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the professor with the highest number of taught courses?",
    "evidence": "",
    "SQL": "SELECT p_id FROM taughtBy GROUP BY p_id ORDER BY COUNT(p_id) DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the name of the courses taught by a professor who has at least one student who is teaching an undergraduate course?",
    "evidence": "",
    "SQL": "SELECT T1.course_id, T1.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T2.p_id = T3.p_id INNER JOIN advisedBy AS T4 ON T4.p_id = T3.p_id WHERE T3.student = 1 AND T1.courseLevel = 'Level_300'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the course level of the courses taught by a professor with the most advisors?",
    "evidence": "",
    "SQL": "SELECT T1.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id GROUP BY T2.course_id ORDER BY (SELECT COUNT(T3.p_id_dummy) FROM advisedBy AS T3 WHERE T3.p_id = T2.p_id) DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What are the names of the students that have the professor with the ID 2?",
    "evidence": "",
    "SQL": "SELECT P1.student FROM person P1 WHERE P1.p_id IN (SELECT P2.p_id FROM person P2 WHERE P2.p_id = 2)"
  },
  {
    "db_id": "computer_student",
    "question": "What is the course level of course ID 456?",
    "evidence": "",
    "SQL": "SELECT courseLevel FROM course WHERE course_id = 456"
  },
  {
    "db_id": "computer_student",
    "question": "Which courses are taught by professors who are in their third phase of their program?",
    "evidence": "",
    "SQL": "SELECT course.course_id FROM course, taughtBy, person WHERE course.course_id = taughtBy.course_id AND taughtBy.p_id = person.p_id AND person.inPhase = 'Phase_3'"
  },
  {
    "db_id": "computer_student",
    "question": "Which courses are taught by professors with more than 1 advisor?",
    "evidence": "",
    "SQL": "SELECT course_id FROM taughtBy INNER JOIN person AS T2 ON taughtBy.p_id = T2.p_id WHERE T2.professor = 1 GROUP BY course_id HAVING COUNT(T2.p_id) > 1"
  },
  {
    "db_id": "computer_student",
    "question": "How many students are being advised by a professor who teaches a course of medium undergraduate level?",
    "evidence": "",
    "SQL": "SELECT COUNT(DISTINCT T1.p_id) FROM person AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id_dummy INNER JOIN taughtBy AS T3 ON T2.p_id = T3.p_id INNER JOIN course AS T4 ON T3.course_id = T4.course_id WHERE T4.courseLevel = 'Level_200'"
  },
  {
    "db_id": "computer_student",
    "question": "What are the IDs of people who have been students and professors?",
    "evidence": "",
    "SQL": "SELECT DISTINCT p1.p_id FROM person AS p1 WHERE p1.student IS NOT NULL AND p1.professor IS NOT NULL"
  },
  {
    "db_id": "computer_student",
    "question": "Which courses are taught by advisors 415 and 395?",
    "evidence": "",
    "SQL": "SELECT course.course_id, course.courseLevel FROM course, taughtBy, person WHERE course.course_id = taughtBy.course_id AND taughtBy.p_id = person.p_id AND person.p_id IN (415, 395)"
  },
  {
    "db_id": "computer_student",
    "question": "Which students are advised by a professor who teaches a course of level Level_400?",
    "evidence": "",
    "SQL": "SELECT p.student FROM person AS P INNER JOIN advisedBy AS A ON P.p_id = A.p_id_dummy INNER JOIN taughtBy AS T ON T.p_id = A.p_id_dummy INNER JOIN course AS C ON T.course_id = C.course_id WHERE C.courseLevel = 'Level_400'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of courses that professors are teaching?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id"
  },
  {
    "db_id": "computer_student",
    "question": "What are the names of the professors who have students who teach undergraduate courses?",
    "evidence": "",
    "SQL": "SELECT distinct p1.professor FROM person AS p1 INNER JOIN advisedBy AS a ON p1.p_id = a.p_id INNER JOIN person AS p2 ON p2.p_id = a.p_id_dummy INNER JOIN taughtBy AS t ON p2.p_id = t.p_id INNER JOIN course AS c ON t.course_id = c.course_id WHERE c.courseLevel = 'Level_300'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of students who have never taken a course taught by a professor who is currently a member of the faculty?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person AS T1 LEFT JOIN taughtBy AS T2 ON T1.p_id = T2.p_id WHERE T1.student = 1 AND T2.p_id IS NULL"
  },
  {
    "db_id": "computer_student",
    "question": "Which professors are advising a student and teaching a course together?",
    "evidence": "",
    "SQL": "SELECT p1.p_id, p2.p_id FROM person AS p1 INNER JOIN advisedBy AS ab1 ON p1.p_id = ab1.p_id INNER JOIN taughtBy AS tb ON ab1.p_id = tb.p_id INNER JOIN person AS p2 ON tb.p_id = p2.p_id"
  },
  {
    "db_id": "computer_student",
    "question": "What is the number of students for each course at the undergraduate level?",
    "evidence": "",
    "SQL": "SELECT T1.course_id, T1.courseLevel, COUNT(T2.p_id) AS num_students FROM course AS T1 LEFT JOIN person AS T2 ON T1.course_id = T2.student AND T1.courseLevel = 'Level_100' GROUP BY T1.course_id, T1.courseLevel"
  },
  {
    "db_id": "computer_student",
    "question": "How many undergraduate students are advised by at least one professor who teaches at least one course in a specific level?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id INNER JOIN taughtBy AS T3 ON T3.p_id = T2.p_id_dummy INNER JOIN course AS T4 ON T3.course_id = T4.course_id WHERE T4.courseLevel = 'Level_300' AND T1.student = 1"
  },
  {
    "db_id": "computer_student",
    "question": "What are the course IDs taught by both professor 297 and professor 123?",
    "evidence": "",
    "SQL": "SELECT course_id FROM taughtBy WHERE p_id = 297 INTERSECT SELECT course_id FROM taughtBy WHERE p_id = 123"
  },
  {
    "db_id": "computer_student",
    "question": "What is the number of students who have been in a program for exactly 2 years?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person WHERE yearsInProgram = '2 years'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the name of the courses taught by professors with more than 5 years in the program?",
    "evidence": "",
    "SQL": "SELECT DISTINCT course.course_id, course.courseLevel FROM course JOIN taughtBy ON course.course_id = taughtBy.course_id JOIN person ON taughtBy.p_id = person.p_id WHERE person.yearsInProgram > 5"
  },
  {
    "db_id": "computer_student",
    "question": "Who taught the course with ID 105 and what was the course level?",
    "evidence": "",
    "SQL": "SELECT T1.p_id, T3.courseLevel FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T2.course_id WHERE T3.course_id = 105"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of courses taught by professors who have advised more than 3 students?",
    "evidence": "",
    "SQL": "SELECT COUNT(course_id) FROM taughtBy WHERE p_id IN (SELECT p_id FROM advisedBy GROUP BY p_id HAVING COUNT(p_id_dummy) > 3)"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of courses taught by a professor in the Engineering department?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T1.course_id WHERE T2.hasPosition = 'Faculty_Engineering'"
  },
  {
    "db_id": "computer_student",
    "question": "Which students are advised by a professor who also teaches a course?",
    "evidence": "",
    "SQL": "SELECT s.student FROM person s, advisedBy a, taughtBy t WHERE s.p_id = a.p_id_dummy AND a.p_id = t.p_id AND t.course_id IN (SELECT course_id FROM course WHERE courseLevel = 'Level_400')"
  },
  {
    "db_id": "computer_student",
    "question": "What courses did professor with id 1 teach?",
    "evidence": "",
    "SQL": "SELECT course.course_id, course.courseLevel FROM taughtBy INNER JOIN course ON taughtBy.course_id = course.course_id WHERE taughtBy.p_id = 1"
  },
  {
    "db_id": "computer_student",
    "question": "Which advisors have advised students who are in Phase 2 and have been in the program for more than 3 years?",
    "evidence": "",
    "SQL": "SELECT T1.p_id_dummy FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.inPhase = 'Phase 2' AND T2.yearsInProgram > 3"
  },
  {
    "db_id": "computer_student",
    "question": "What is the number of students who are advised by a professor who teaches a Level_500 course?",
    "evidence": "",
    "SQL": "SELECT COUNT(DISTINCT T1.p_id) FROM person AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id_dummy INNER JOIN taughtBy AS T3 ON T3.p_id = T2.p_id INNER JOIN course AS T4 ON T3.course_id = T4.course_id WHERE T4.courseLevel = 'Level_500'"
  },
  {
    "db_id": "computer_student",
    "question": "Who teaches the courses with the lowest general course level?",
    "evidence": "",
    "SQL": "SELECT T1.p_id, T3.courseLevel FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T2.course_id GROUP BY T1.p_id ORDER BY T3.courseLevel ASC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "List the IDs of students who have advisors from the Computer Science department.",
    "evidence": "",
    "SQL": "SELECT T1.p_id FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T2.professor = T3.course_id WHERE T3.courseLevel LIKE '%Computer Science%'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the list of students who are advised by faculty members?",
    "evidence": "",
    "SQL": "SELECT T1.p_id FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.hasPosition = 'Faculty_eme'"
  },
  {
    "db_id": "computer_student",
    "question": "What level is course 165? Who teaches the course?",
    "evidence": "",
    "SQL": "SELECT courseLevel, p_id FROM course NATURAL JOIN taughtBy WHERE course_id = 165"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses taught by professors who have taught courses with level 'Undergraduate'?",
    "evidence": "",
    "SQL": "SELECT T3.course_id, T3.courseLevel FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T1.course_id WHERE T3.courseLevel = 'Undergraduate'"
  },
  {
    "db_id": "computer_student",
    "question": "What professors advise the most number of students?",
    "evidence": "",
    "SQL": "SELECT p1.p_id, COUNT(*) AS num_students FROM person AS p1 INNER JOIN advisedBy AS a1 ON p1.p_id = a1.p_id INNER JOIN person AS p2 ON a1.p_id_dummy = p2.p_id GROUP BY p1.p_id ORDER BY num_students DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "List all students who have had a professor with a 'Faculty' position and those professors' courses",
    "evidence": "",
    "SQL": "SELECT T1.p_id, T2.course_id, T2.courseLevel FROM person AS T1 INNER JOIN taughtBy AS T3 ON T1.p_id = T3.p_id INNER JOIN course AS T2 ON T2.course_id = T3.course_id INNER JOIN person AS T4 ON T4.p_id = T3.p_id WHERE T1.student = 1 AND T4.hasPosition = 'Faculty'"
  },
  {
    "db_id": "computer_student",
    "question": "What courses are being taught by professors who have been a professor for more than 5 years?",
    "evidence": "",
    "SQL": "SELECT T3.course_id, T3.courseLevel FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T1.course_id WHERE T2.yearsInProgram > 5"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses taught by professors with a position of assistant professor?",
    "evidence": "",
    "SQL": "SELECT course.course_id, course.courseLevel FROM course INNER JOIN taughtBy ON course.course_id = taughtBy.course_id INNER JOIN person ON taughtBy.p_id = person.p_id WHERE person.hasPosition = 'Assistant Professor'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of courses taught by each professor?",
    "evidence": "",
    "SQL": "SELECT p_id, COUNT(course_id) as total_courses FROM taughtBy GROUP BY p_id"
  },
  {
    "db_id": "computer_student",
    "question": "How many professors in faculty have more than 2 years of experience?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person WHERE yearsInProgram > 2 AND hasPosition = 'Faculty'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the level of the course taught by the advisor of student ID 80?",
    "evidence": "",
    "SQL": "SELECT T1.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN advisedBy AS T3 ON T2.p_id = T3.p_id WHERE T3.p_id_dummy = 80"
  },
  {
    "db_id": "computer_student",
    "question": "List the IDs of all students who are currently in phase 3",
    "evidence": "",
    "SQL": "SELECT p_id FROM person WHERE inPhase = 'phase 3' AND student = 1"
  },
  {
    "db_id": "computer_student",
    "question": "List the IDs of all courses that have been taught by professors from the faculty.",
    "evidence": "",
    "SQL": "SELECT course_id FROM taughtBy INNER JOIN person ON taughtBy.p_id = person.p_id WHERE person.hasPosition = 'Faculty_aff'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the course ID of the course taught by Professor 210?",
    "evidence": "",
    "SQL": "SELECT course_id FROM taughtBy WHERE p_id = 210"
  },
  {
    "db_id": "computer_student",
    "question": "What courses are taught by both a professor and a student?",
    "evidence": "",
    "SQL": "SELECT T1.course_id FROM taughtBy AS T1 JOIN person AS T2 ON T1.p_id = T2.p_id WHERE (T2.professor = 1 OR T2.professor IS NULL) AND (T2.student = 1 OR T2.student IS NULL)"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of professors who teach a course with a level higher than Level_300?",
    "evidence": "",
    "SQL": "SELECT COUNT(DISTINCT T2.p_id) FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T1.courseLevel > 'Level_300'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of students who have advised someone?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id WHERE T1.student = 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the course level of the courses taught by the professor with the most taught courses?",
    "evidence": "",
    "SQL": "SELECT DISTINCT T1.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T2.p_id = T3.p_id GROUP BY T1.course_id, T3.p_id ORDER BY COUNT(*) DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "Who are the students advised by the professors teaching Level_400 courses?",
    "evidence": "",
    "SQL": "SELECT distinct T2.p_id FROM person AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id INNER JOIN taughtBy AS T3 ON T3.p_id = T2.p_id WHERE T3.course_id IN (SELECT course_id FROM course WHERE courseLevel = 'Level_400')"
  },
  {
    "db_id": "computer_student",
    "question": "How many courses has a student who has been in the program for more than 2 years, but is not a professor?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person AS T1 INNER JOIN course AS T2 ON T1.student = T2.course_id WHERE T1.yearsInProgram > '2' AND NOT EXISTS (SELECT * FROM person AS T3 WHERE T3.p_id = T1.p_id AND T3.professor = 1)"
  },
  {
    "db_id": "computer_student",
    "question": "What is the name of the professor teaching a 'Level_400' course?",
    "evidence": "",
    "SQL": "SELECT P.professor FROM course AS C JOIN taughtBy AS T ON C.course_id = T.course_id JOIN person AS P ON T.p_id = P.p_id WHERE C.courseLevel = 'Level_400'"
  },
  {
    "db_id": "computer_student",
    "question": "What students have not been advised by an advisor in their first phase?",
    "evidence": "",
    "SQL": "SELECT * FROM person WHERE p_id NOT IN (SELECT T1.p_id FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.inPhase = 'Phase_1')"
  },
  {
    "db_id": "computer_student",
    "question": "What are the course IDs of courses taught by advisors who have been in the program for more than 5 years?",
    "evidence": "",
    "SQL": "SELECT T1.course_id FROM taughtBy AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id INNER JOIN person AS T3 ON T2.p_id = T3.p_id WHERE T3.yearsInProgram > 5"
  },
  {
    "db_id": "computer_student",
    "question": "What is the professor's faculty position who has advised the most number of students?",
    "evidence": "",
    "SQL": "SELECT T1.hasPosition FROM person AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id_dummy GROUP BY T1.p_id ORDER BY COUNT(T2.p_id_dummy) DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "Who are the professors that have taught the most courses?",
    "evidence": "",
    "SQL": "SELECT p_id FROM taughtBy GROUP BY p_id ORDER BY COUNT(course_id) DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses taught by professors who have advised more than 2 students?",
    "evidence": "",
    "SQL": "SELECT T2.course_id FROM taughtBy AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id INNER JOIN advisedBy AS T3 ON T3.p_id = T1.p_id GROUP BY T2.course_id HAVING COUNT(T3.p_id_dummy) > 2"
  },
  {
    "db_id": "computer_student",
    "question": "What is the list of students who are advised by at least one professor that teaches Level_500 courses?",
    "evidence": "",
    "SQL": "SELECT T1.p_id FROM person AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id_dummy INNER JOIN taughtBy AS T3 ON T2.p_id = T3.p_id WHERE T3.course_id IN (SELECT course_id FROM course WHERE courseLevel = 'Level_500') GROUP BY T1.p_id HAVING COUNT(DISTINCT T3.course_id) > 0"
  },
  {
    "db_id": "computer_student",
    "question": "What is the number of students who have been advised by at least one professor who taught at least one Level_400 course?",
    "evidence": "",
    "SQL": "SELECT COUNT(DISTINCT T2.p_id) FROM person AS T2 INNER JOIN advisedBy AS T1 ON T2.p_id = T1.p_id_dummy INNER JOIN taughtBy AS T3 ON T1.p_id = T3.p_id WHERE T3.course_id IN (SELECT course_id FROM course WHERE courseLevel = 'Level_400')"
  },
  {
    "db_id": "computer_student",
    "question": "What is the average number of years a student has been in the program for the courses taught by Professor X?",
    "evidence": "",
    "SQL": "SELECT AVG(yearsInProgram) FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T2.course_id WHERE T3.course_id IN (SELECT course_id FROM taughtBy WHERE p_id = (SELECT p_id FROM person WHERE hasPosition = 'Professor X'))"
  },
  {
    "db_id": "computer_student",
    "question": "Who are the people who have advised more than 5 students to teach?",
    "evidence": "",
    "SQL": "SELECT p_id_dummy FROM advisedBy GROUP BY p_id_dummy HAVING COUNT(p_id_dummy) > 5"
  },
  {
    "db_id": "computer_student",
    "question": "What are the names of all professors who have taught a course with the title 'Introduction to Computer Science'?",
    "evidence": "",
    "SQL": "SELECT P1.p_id AS p_id, P1.student AS p_student, P1.professor AS p_professor FROM person AS P1 INNER JOIN taughtBy AS T1 ON P1.p_id = T1.p_id INNER JOIN course AS C1 ON T1.course_id = C1.course_id WHERE C1.courseLevel LIKE '%Introduction%'"
  },
  {
    "db_id": "computer_student",
    "question": "Which students have not had an advisor yet?",
    "evidence": "",
    "SQL": "SELECT p_id FROM person WHERE hasPosition IS NULL"
  },
  {
    "db_id": "computer_student",
    "question": "List all the courses taught by the professors who have been in the program for more than 5 years and taught courses in the advanced level.",
    "evidence": "",
    "SQL": "SELECT T2.course_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T2.p_id = T3.p_id WHERE T3.inPhase = 'advanced' AND T3.yearsInProgram > 5"
  },
  {
    "db_id": "computer_student",
    "question": "What is the position of the professor who teaches the most courses in the faculty?",
    "evidence": "",
    "SQL": "SELECT T1.hasPosition FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id GROUP BY T1.p_id ORDER BY COUNT(T2.course_id) DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "List the courses taught by the person who taught the most basic courses.",
    "evidence": "",
    "SQL": "SELECT DISTINCT T2.course_id FROM taughtBy AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id GROUP BY T2.course_id ORDER BY (SELECT COUNT(*) FROM taughtBy AS T3 WHERE T3.course_id = T2.course_id) DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "Which courses have both professor and student as the same person?",
    "evidence": "",
    "SQL": "SELECT T1.course_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T2.p_id = T3.p_id GROUP BY T1.course_id HAVING COUNT(DISTINCT T3.professor) = 1 AND COUNT(DISTINCT T3.student) = 1"
  },
  {
    "db_id": "computer_student",
    "question": "How many professors are teaching courses with level higher than 'Undergraduate'?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM taughtBy AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T2.courseLevel > 'Undergraduate'"
  },
  {
    "db_id": "computer_student",
    "question": "Which professors have advised a student who has advised another student?",
    "evidence": "",
    "SQL": "SELECT p_id FROM person AS T1 WHERE p_id IN (SELECT p_id FROM person AS T2 WHERE p_id IN (SELECT p_id_dummy FROM advisedBy AS T3)) AND hasPosition = 'professor'"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses that have been taught by a professor who also advises students?",
    "evidence": "",
    "SQL": "SELECT T1.course_id, T1.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN advisedBy AS T3 ON T2.p_id = T3.p_id"
  },
  {
    "db_id": "computer_student",
    "question": "What courses are taught by professors teaching Level_400 courses?",
    "evidence": "",
    "SQL": "SELECT * FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T2.p_id = T3.p_id WHERE T3.professor = 1 AND T1.courseLevel = 'Level_400'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of courses that are taught by professors who teach level 400 or higher courses?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T2.p_id = T3.p_id WHERE T3.hasPosition = 'Faculty_eme' AND T1.courseLevel = 'Level_400' OR T1.courseLevel = 'Level_500'"
  },
  {
    "db_id": "computer_student",
    "question": "Which professors are teaching a course level of Level_400?",
    "evidence": "",
    "SQL": "SELECT p_id FROM person NATURAL JOIN taughtBy NATURAL JOIN course WHERE courseLevel = 'Level_400'"
  },
  {
    "db_id": "computer_student",
    "question": "What are the IDs of students who are in the post-quals phase and are not advised by any professors?",
    "evidence": "",
    "SQL": "SELECT p_id FROM person WHERE inPhase = 'Post_Quals' AND student = 1 AND NOT EXISTS (SELECT 1 FROM advisedBy WHERE advisedBy.p_id = person.p_id)"
  },
  {
    "db_id": "computer_student",
    "question": "What is the name of the courses taught by professors who have more than 3 years of experience in the program?",
    "evidence": "",
    "SQL": "SELECT course.course_id, course.courseLevel FROM course, person, taughtBy WHERE person.p_id = taughtBy.p_id AND person.yearsInProgram > 3"
  },
  {
    "db_id": "computer_student",
    "question": "What professor advises more students in total?",
    "evidence": "",
    "SQL": "SELECT p_id, COUNT(*) as total_students FROM advisedBy GROUP BY p_id ORDER BY total_students DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What course levels are being taught by professors who advise students in the fifth phase of the program?",
    "evidence": "",
    "SQL": "SELECT courseLevel FROM course INNER JOIN taughtBy ON course.course_id = taughtBy.course_id INNER JOIN person ON taughtBy.p_id = person.p_id WHERE person.inPhase = 'Fifth' AND person.hasPosition = 'Professor' GROUP BY courseLevel"
  },
  {
    "db_id": "computer_student",
    "question": "List the IDs of courses taught by professors who have taught a course of level 'beginner'.",
    "evidence": "",
    "SQL": "SELECT T1.course_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id GROUP BY T1.course_id, T2.p_id HAVING COUNT(T1.courseLevel) = (SELECT COUNT(*) FROM course WHERE courseLevel = 'beginner')"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses taught by professors who have advised more than 3 students to teach?",
    "evidence": "",
    "SQL": "SELECT course_id FROM taughtBy WHERE p_id IN (SELECT p_id_dummy FROM advisedBy GROUP BY p_id_dummy HAVING COUNT(p_id_dummy) > 3)"
  },
  {
    "db_id": "computer_student",
    "question": "What are the names of the students who are advised by a professor who taught 'Level_500' courses?",
    "evidence": "",
    "SQL": "SELECT p_id FROM person WHERE student=1 AND EXISTS (SELECT * FROM advisedBy AS AB JOIN taughtBy AS TB ON AB.p_id_dummy = TB.p_id WHERE TB.course_id IN (SELECT course_id FROM course WHERE courseLevel='Level_500'))"
  },
  {
    "db_id": "computer_student",
    "question": "What are the course IDs of the courses that are taught by both a professor and a student?",
    "evidence": "",
    "SQL": "SELECT DISTINCT course_id FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.hasPosition = 'professor' AND T2.hasPosition = 'student'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the ID and position of the professor who taught the course 'Course_101'?",
    "evidence": "",
    "SQL": "SELECT p_id, hasPosition FROM person NATURAL JOIN taughtBy WHERE course_id = 'Course_101'"
  },
  {
    "db_id": "computer_student",
    "question": "How many students has the teacher who teaches course no.3?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN person AS T3 ON T2.student = T3.p_id WHERE T1.course_id = 3"
  },
  {
    "db_id": "computer_student",
    "question": "List the ID and course level of students who have never held a position",
    "evidence": "",
    "SQL": "SELECT T1.p_id, T2.courseLevel FROM person AS T1 INNER JOIN course AS T2 ON T1.p_id = T2.course_id WHERE T1.hasPosition IS NULL"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of courses taught by a professor who has a position of 'Assistant Professor'?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM taughtBy JOIN person ON taughtBy.p_id = person.p_id JOIN course ON taughtBy.course_id = course.course_id WHERE person.hasPosition = 'Assistant Professor'"
  },
  {
    "db_id": "computer_student",
    "question": "What are the student IDs of students who are taught by a professor teaching a basic course and their ID of employing professor?",
    "evidence": "",
    "SQL": "SELECT T1.p_id, T2.p_id FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T1.course_id WHERE T3.courseLevel = 'Level_100'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of students who have the course 'Introduction to Computer Science' taught by at least one professor?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person WHERE p_id IN (SELECT p_id FROM taughtBy WHERE course_id IN (SELECT course_id FROM course WHERE courseLevel = 'Intro'))"
  },
  {
    "db_id": "computer_student",
    "question": "Find the IDs of professors who have advised a student who has taken a course with a level of 'Master'?",
    "evidence": "",
    "SQL": "SELECT T1.p_id FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T1.p_id_dummy = T3.course_id WHERE T3.courseLevel = 'Master'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the number of courses that a professor who has a tenure of more than 5 years taught?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM taughtBy JOIN person ON taughtBy.p_id = person.p_id WHERE person.hasPosition = 'professor' AND person.yearsInProgram > 5"
  },
  {
    "db_id": "computer_student",
    "question": "What courses are taught by professors with more than 3 years in the program?",
    "evidence": "",
    "SQL": "SELECT C.courseLevel, C.course_id FROM course AS C INNER JOIN taughtBy AS T ON C.course_id = T.course_id INNER JOIN person AS P ON T.p_id = P.p_id WHERE P.yearsInProgram > 3"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of students in the program?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) AS total_students FROM person WHERE student = 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the course with the most teachers?",
    "evidence": "",
    "SQL": "SELECT course_id FROM taughtBy GROUP BY course_id ORDER BY COUNT(course_id) DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "Which students are in more than one phase and what is their phase?",
    "evidence": "",
    "SQL": "SELECT T1.p_id, T2.inPhase FROM person AS T1 INNER JOIN taughtBy AS T3 ON T1.p_id = T3.p_id INNER JOIN person AS T2 ON T1.student = T2.p_id WHERE T2.inPhase IS NOT NULL GROUP BY T1.p_id HAVING COUNT(DISTINCT T2.inPhase) > 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the number of students who are in their first phase of their program and not in their last year?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person WHERE inPhase = 'Phase_1' AND yearsInProgram != 'Year_4'"
  },
  {
    "db_id": "computer_student",
    "question": "How many courses are taught by professors who are in a position of Faculty?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T2.p_id = T3.p_id WHERE T3.hasPosition = 'Faculty'"
  },
  {
    "db_id": "computer_student",
    "question": "What are the IDs of students who are not currently in a phase?",
    "evidence": "",
    "SQL": "SELECT p_id FROM person WHERE inPhase IS NULL"
  },
  {
    "db_id": "computer_student",
    "question": "What is the course level of the course taught by the most faculty members?",
    "evidence": "",
    "SQL": "SELECT courseLevel FROM (SELECT course_id, COUNT(*) as count FROM taughtBy GROUP BY course_id ORDER BY count DESC LIMIT 1) AS T1 INNER JOIN course ON T1.course_id = course.course_id"
  },
  {
    "db_id": "computer_student",
    "question": "Which course has only one professor teaching it?",
    "evidence": "",
    "SQL": "SELECT course_id FROM taughtBy GROUP BY course_id HAVING COUNT(p_id) = 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the course ID of a course taught by a professor who has a position?",
    "evidence": "",
    "SQL": "SELECT T1.course_id FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.hasPosition <> 0"
  },
  {
    "db_id": "computer_student",
    "question": "How many students are there in total in the database?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person WHERE student = 1"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses that a professor from the department of Computer Science has taught?",
    "evidence": "",
    "SQL": "SELECT T1.course_id, T1.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T2.p_id = T3.p_id WHERE T3.inPhase LIKE '%Computer Science%' GROUP BY T1.course_id, T1.courseLevel"
  },
  {
    "db_id": "computer_student",
    "question": "Which course is taught by the most professors?",
    "evidence": "",
    "SQL": "SELECT T1.course_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id GROUP BY T1.course_id ORDER BY COUNT(T2.p_id) DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "How many students are in the phase of preparation?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person WHERE inPhase = 'Phase_Preparation'"
  },
  {
    "db_id": "computer_student",
    "question": "What are all the courses taught by a professor who has taught at least 3 courses?",
    "evidence": "",
    "SQL": "SELECT course_id FROM taughtBy WHERE p_id IN (SELECT p_id FROM taughtBy GROUP BY p_id HAVING COUNT(course_id) > 2)"
  },
  {
    "db_id": "computer_student",
    "question": "What are all the course levels offered by the professor who advises the student with ID 50?",
    "evidence": "",
    "SQL": "SELECT DISTINCT courseLevel FROM taughtBy AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id INNER JOIN advisedBy AS T3 ON T2.course_id = T3.p_id AND T3.p_id_dummy = (SELECT p_id_dummy FROM advisedBy WHERE p_id = 50)"
  },
  {
    "db_id": "computer_student",
    "question": "Which courses have only one professor teaching them?",
    "evidence": "",
    "SQL": "SELECT T1.course_id, T1.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id GROUP BY T1.course_id, T1.courseLevel HAVING COUNT(T2.p_id) = 1"
  },
  {
    "db_id": "computer_student",
    "question": "What professors teach courses at level 2?",
    "evidence": "",
    "SQL": "SELECT p_id FROM taughtBy JOIN course ON taughtBy.course_id = course.course_id WHERE courseLevel = '2'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the name of the student who has been in the program for more than 3 years and has advised at least one student?",
    "evidence": "",
    "SQL": "SELECT P1.p_id, P1.student FROM person AS P1 WHERE P1.yearsInProgram > '3' AND EXISTS (SELECT * FROM advisedBy WHERE P1.p_id = advisedBy.p_id)"
  },
  {
    "db_id": "computer_student",
    "question": "What are all the courses offered by professors who have faculty employees?",
    "evidence": "",
    "SQL": "SELECT T3.course_id, T3.courseLevel FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T1.course_id WHERE T2.hasPosition = 'Faculty_employee'"
  },
  {
    "db_id": "computer_student",
    "question": "Who are the people who have been in the program for at least 2 years?",
    "evidence": "",
    "SQL": "SELECT p_id FROM person WHERE yearsInProgram >= '2'"
  },
  {
    "db_id": "computer_student",
    "question": "What are all the courses taught by professors with the highest yearsInProgram?",
    "evidence": "",
    "SQL": "SELECT distinct T3.course_id, T3.courseLevel FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T1.course_id WHERE T2.inPhase IS NULL AND T2.yearsInProgram = (SELECT MAX(yearsInProgram) FROM person)"
  },
  {
    "db_id": "computer_student",
    "question": "What is the average course level of the courses taught by a professor with at least 3 years of experience in the program?",
    "evidence": "",
    "SQL": "SELECT AVG(T3.courseLevel) FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T2.course_id WHERE T1.yearsInProgram >= '3'"
  },
  {
    "db_id": "computer_student",
    "question": "What are the highest level courses taught by a professor in the department?",
    "evidence": "",
    "SQL": "SELECT distinct T2.courseLevel FROM taughtBy AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T1.p_id = T3.p_id WHERE T3.hasPosition = 'Professor' ORDER BY T2.courseLevel DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the percentage of students who are in the phase of applications for courses taught by professors with more than 5 years in the program?",
    "evidence": "",
    "SQL": "SELECT COUNT(*)/SUM(CASE WHEN yearsInProgram > 5 THEN 1 ELSE 0 END)*100 FROM person WHERE inPhase = 'applications' AND hasPosition = 0 AND professor IS NOT NULL"
  },
  {
    "db_id": "computer_student",
    "question": "Which faculty members teach both undergraduate courses at lower levels?",
    "evidence": "",
    "SQL": "SELECT DISTINCT T1.p_id FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T2.course_id WHERE T1.hasPosition = 'Faculty_eme' AND (T3.courseLevel = 'Level_200' OR T3.courseLevel = 'Level_100')"
  },
  {
    "db_id": "computer_student",
    "question": "What is the list of course ID's taught by a student who has a hasPosition of 'Teaching Assistant'? ",
    "evidence": "",
    "SQL": "SELECT course_id FROM taughtBy, person WHERE course_id IN (SELECT course_id FROM taughtBy, person WHERE taughtBy.p_id = person.p_id AND person.hasPosition='Teaching Assistant')"
  },
  {
    "db_id": "computer_student",
    "question": "Which professor teaches the most courses in Level_300?",
    "evidence": "",
    "SQL": "SELECT p_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T1.courseLevel = 'Level_300' GROUP BY T2.p_id ORDER BY COUNT(T2.course_id) DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "Which courses were taught by professor ID '1'?",
    "evidence": "",
    "SQL": "SELECT course_id FROM taughtBy WHERE p_id = 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the number of students who are not in the first year, but have a professor who is also in the first year?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id_dummy INNER JOIN taughtBy AS T3 ON T2.p_id = T3.p_id INNER JOIN course AS T4 ON T3.course_id = T4.course_id WHERE T1.student = 1 AND T4.courseLevel != 'Level_1' AND T3.p_id IN (SELECT p_id FROM person WHERE inPhase = 'Year_1')"
  },
  {
    "db_id": "computer_student",
    "question": "What is the course level of the course taught by a professor who has advised the most number of students?",
    "evidence": "",
    "SQL": "SELECT courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN advisedBy AS T3 ON T2.p_id = T3.p_id_dummy GROUP BY T1.course_id ORDER BY COUNT(T3.p_id_dummy) DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What are the IDs of courses taught by professors with a position as department head?",
    "evidence": "",
    "SQL": "SELECT course_id FROM taughtBy INNER JOIN person ON taughtBy.p_id = person.p_id WHERE person.hasPosition = 'Department_Head'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the ID of the student that has been advised by the professor who taught the course with ID 101 and the course level is Advanced?",
    "evidence": "",
    "SQL": "SELECT T1.p_id FROM person AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id_dummy INNER JOIN taughtBy AS T3 ON T2.p_id = T3.p_id INNER JOIN course AS T4 ON T3.course_id = T4.course_id WHERE T4.course_id = 101 AND T4.courseLevel = 'Advanced'"
  },
  {
    "db_id": "computer_student",
    "question": "Which professor has the most students?",
    "evidence": "",
    "SQL": "SELECT p_id FROM person WHERE professor = p_id GROUP BY p_id ORDER BY COUNT(p_id) DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "Which students are not advised by any professor?",
    "evidence": "",
    "SQL": "SELECT p_id FROM person WHERE p_id NOT IN (SELECT p_id FROM advisedBy)"
  },
  {
    "db_id": "computer_student",
    "question": "What is the course level of the courses taught by the professor with most taught courses?",
    "evidence": "",
    "SQL": "SELECT T1.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id GROUP BY T2.p_id ORDER BY COUNT(*) DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What are all the courses taught by a professor with a specific level of expertise?",
    "evidence": "",
    "SQL": "SELECT * FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T2.p_id = T3.p_id WHERE T3.hasPosition = 'Level_500' AND T1.courseLevel = 'Level_500'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the highest-level undergraduate course taught by a professor who has been in the program for more than 5 years and has taught at least one course?",
    "evidence": "",
    "SQL": "SELECT course.courseLevel FROM course INNER JOIN taughtBy ON course.course_id = taughtBy.course_id INNER JOIN person ON taughtBy.p_id = person.p_id WHERE person.yearsInProgram > '5' GROUP BY course.courseLevel ORDER BY course.courseLevel DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "Which professors teach courses at the graduate level?",
    "evidence": "",
    "SQL": "SELECT DISTINCT T1.p_id, T2.courseLevel FROM taughtBy AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T2.courseLevel = 'Graduate'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of courses taught by professors who have more than 5 years of experience in the program?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T2.p_id = T3.p_id WHERE T3.yearsInProgram > 5"
  },
  {
    "db_id": "computer_student",
    "question": "How many students are currently taking at least one high-level or harder undergraduate course?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person AS T1 WHERE T1.student = 1 AND T1.inPhase <> 0 AND EXISTS (SELECT * FROM course AS T2 INNER JOIN taughtBy AS T3 ON T2.course_id = T3.course_id WHERE T2.courseLevel = 'Level_400' AND T1.p_id = T3.p_id)"
  },
  {
    "db_id": "computer_student",
    "question": "What is the percentage of students who have more than 2 advisors among all students?",
    "evidence": "",
    "SQL": "SELECT COUNT(T1.p_id) / (SELECT COUNT(*) FROM person WHERE student = 1) * 100 AS percentage FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.student = 1 GROUP BY T2.p_id HAVING COUNT(T2.p_id) > 2"
  },
  {
    "db_id": "computer_student",
    "question": "How many undergraduate courses that have a professor who has a position in the school of engineering?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T2.p_id = T3.p_id WHERE T1.courseLevel = 'Level_200' AND T3.hasPosition LIKE '%school of engineering%'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the average age of students in a specific phase in the course with course ID 123?",
    "evidence": "",
    "SQL": "SELECT AVG(T1.yearsInProgram) FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T3.course_id = 123 AND T1.inPhase = 'specific phase'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the most common position among all professors?",
    "evidence": "",
    "SQL": "SELECT hasPosition AS position, COUNT(*) AS frequency FROM person WHERE professor = 1 GROUP BY hasPosition ORDER BY frequency DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses taught by professors with a position as 'Professor' in the faculty?",
    "evidence": "",
    "SQL": "SELECT courseLevel FROM course INNER JOIN taughtBy ON course.course_id = taughtBy.course_id WHERE taughtBy.p_id IN (SELECT p_id FROM person WHERE hasPosition = 'Professor')"
  },
  {
    "db_id": "computer_student",
    "question": "What are the names of all the students who are currently in Phase 2?",
    "evidence": "",
    "SQL": "SELECT T2.p_id, T1.student FROM person AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.inPhase = 2 AND T1.student = 1"
  },
  {
    "db_id": "computer_student",
    "question": "Who are the professors who teach more than one course?",
    "evidence": "",
    "SQL": "SELECT T2.p_id FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id GROUP BY T2.p_id HAVING COUNT(T1.course_id) > 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of years of experience of professors who teach graduate courses?",
    "evidence": "",
    "SQL": "SELECT SUM(yearsInProgram) FROM person p INNER JOIN taughtBy tb ON p.p_id = tb.p_id WHERE p.hasPosition = 1 AND tb.course_id IN (SELECT course_id FROM course WHERE courseLevel = 'Level_500')"
  },
  {
    "db_id": "computer_student",
    "question": "What is the number of students who are advised to teach by a professor teaching professional or master/graduate courses?",
    "evidence": "",
    "SQL": "SELECT COUNT(DISTINCT T4.p_id) FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T2.course_id INNER JOIN advisedBy AS T4 ON T4.p_id = T1.p_id WHERE T3.courseLevel = 'Level_500'"
  },
  {
    "db_id": "computer_student",
    "question": "List the courses taught by a faculty member in the Level_200 courses.",
    "evidence": "",
    "SQL": "SELECT T1.course_id, T1.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T2.p_id = T3.p_id WHERE T3.professor = 1 AND T1.courseLevel = 'Level_200'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the name of the professor who has taught the most courses?",
    "evidence": "",
    "SQL": "SELECT T2.p_id FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id GROUP BY T2.p_id ORDER BY COUNT(T1.course_id) DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses that have at least one professor who is also a student?",
    "evidence": "",
    "SQL": "SELECT course_id FROM course NATURAL JOIN taughtBy NATURAL JOIN person WHERE professor = student"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of students who are affiliated with the faculty?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) AS total_students FROM person WHERE hasPosition = 'Faculty_aff'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the minimum number of years a professor has been in the program before they become a faculty employee?",
    "evidence": "",
    "SQL": "SELECT MIN(yearsInProgram) FROM person WHERE hasPosition = 'Faculty_employee'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of students and professors who teach courses at the university?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person WHERE (student = 0 OR professor = 1) AND p_id IN (SELECT p_id FROM taughtBy)"
  },
  {
    "db_id": "computer_student",
    "question": "Which students have taken more than one course taught by a professor who teaches at least one 'Level_400' course?",
    "evidence": "",
    "SQL": "SELECT p.student FROM person AS p INNER JOIN (SELECT p_id FROM taughtBy AS tb INNER JOIN course AS c ON tb.course_id = c.course_id WHERE c.courseLevel = 'Level_400' GROUP BY p_id HAVING COUNT(c.course_id) > 0) AS q ON p.p_id = q.p_id GROUP BY p.student HAVING COUNT(q.p_id) > 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of courses that are taught by professors with 'PhD' as their highest degree?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T2.p_id = T3.p_id WHERE T3.hasPosition = 'PhD'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the name of the person who advises the most students?",
    "evidence": "",
    "SQL": "SELECT p_id FROM person WHERE hasPosition = 'Adviser' ORDER BY (SELECT COUNT(*) FROM advisedBy WHERE advisedBy.p_id = person.p_id) DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses that are taught by professors who have been advisors to more than one student?",
    "evidence": "",
    "SQL": "SELECT T1.course_id FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN advisedBy AS T3 ON T2.p_id = T3.p_id_dummy GROUP BY T1.course_id HAVING COUNT(T3.p_id_dummy) > 1"
  },
  {
    "db_id": "computer_student",
    "question": "What are the names of all the students who were advised by the same professor?",
    "evidence": "",
    "SQL": "SELECT DISTINCT p1.p_id, p1.student AS StudentName FROM person p1 INNER JOIN advisedBy p2 ON p1.p_id = p2.p_id_dummy JOIN person p3 ON p2.p_id = p3.p_id WHERE p3.professor = p1.p_id"
  },
  {
    "db_id": "computer_student",
    "question": "What courses are taught by professors who also advise students?",
    "evidence": "",
    "SQL": "SELECT course.course_id, course.courseLevel FROM course INNER JOIN taughtBy ON course.course_id = taughtBy.course_id INNER JOIN person AS p ON taughtBy.p_id = p.p_id WHERE p.hasPosition = 'Professor' AND p.p_id IN (SELECT p_id FROM person WHERE hasPosition = 'Student')"
  },
  {
    "db_id": "computer_student",
    "question": "What professors teach the most courses?",
    "evidence": "",
    "SQL": "SELECT p_id, COUNT(*) AS numCourses FROM taughtBy GROUP BY p_id ORDER BY numCourses DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses taught by a professor who also advises a student?",
    "evidence": "",
    "SQL": "SELECT course_id FROM taughtBy WHERE p_id IN (SELECT p_id FROM advisedBy)"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of students under the faculty professors who taught Level_400 courses?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T2.course_id WHERE T1.hasPosition = 'Faculty_eme' AND T3.courseLevel = 'Level_400' AND T1.student = 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the course with the highest student enrollment?",
    "evidence": "",
    "SQL": "SELECT course_id FROM course NATURAL JOIN (SELECT course_id, COUNT(*) AS student_count FROM taughtBy GROUP BY course_id ORDER BY student_count DESC LIMIT 1) AS T1"
  },
  {
    "db_id": "computer_student",
    "question": "Which students are advised by a faculty member who teaches a course in Level_400?",
    "evidence": "",
    "SQL": "SELECT P.p_id FROM person P, person Q, course C, taughtBy T WHERE P.p_id = Q.p_id AND T.p_id = Q.p_id AND C.course_id = T.course_id AND C.courseLevel = 'Level_400' AND P.inPhase = 'Student_phase'"
  },
  {
    "db_id": "computer_student",
    "question": "What courses are taught by the professors who have students advising them?",
    "evidence": "",
    "SQL": "SELECT T1.course_id FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.professor = 0"
  },
  {
    "db_id": "computer_student",
    "question": "What are the IDs of all students who are advised by a professor who teaches a course at level 500?",
    "evidence": "",
    "SQL": "SELECT P1.p_id FROM person AS P1 INNER JOIN advisedBy AS P2 ON P1.p_id = P2.p_id_dummy INNER JOIN taughtBy AS T1 ON T1.p_id = P2.p_id INNER JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T2.courseLevel = 'Level_500' AND P1.student = 'yes'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the number of students who are advised by a professor who teaches a basic undergraduate course?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id_dummy INNER JOIN taughtBy AS T3 ON T2.p_id = T3.p_id INNER JOIN course AS T4 ON T3.course_id = T4.course_id WHERE T4.courseLevel = 'Level_200' AND T1.student = 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the ID of the professor who is advising students in Phase 2 and has been in the program for 2 years?",
    "evidence": "",
    "SQL": "SELECT p_id FROM person WHERE inPhase = 'Phase_2' AND yearsInProgram = '2'"
  },
  {
    "db_id": "computer_student",
    "question": "Which student has taught by most professors?",
    "evidence": "",
    "SQL": "SELECT T1.p_id FROM person AS T1 JOIN advisedBy AS T2 ON T1.p_id = T2.p_id GROUP BY T1.p_id ORDER BY COUNT(T2.p_id) DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the highest level of course taught by a professor who has been in the faculty for more than 5 years?",
    "evidence": "",
    "SQL": "SELECT MAX(T1.courseLevel) FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T2.p_id = T3.p_id WHERE T3.yearsInProgram > 5"
  },
  {
    "db_id": "computer_student",
    "question": "List the courses taught by professors with advisor students having position status in faculty.",
    "evidence": "",
    "SQL": "SELECT T2.course_id, T1.hasPosition FROM taughtBy AS T2 INNER JOIN person AS T1 ON T2.p_id = T1.p_id WHERE T1.hasPosition <> 0"
  },
  {
    "db_id": "computer_student",
    "question": "How many students have at least one advisor?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person WHERE student = 1 AND (SELECT COUNT(*) FROM advisedBy WHERE advisedBy.p_id = person.p_id) > 0"
  },
  {
    "db_id": "computer_student",
    "question": "What is the number of courses taught by both faculty members and their advisees?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM (SELECT course_id FROM taughtBy AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id AND T1.course_id = T2.p_id_dummy GROUP BY course_id) AS T3"
  },
  {
    "db_id": "computer_student",
    "question": "How many students are there who are in the 4th year of their program and are taught by Professor?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person WHERE yearsInProgram = 'Year_4' AND hasPosition = 'Professor'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the ID of the student who is taught by a professor who teaches a Level_500 course?",
    "evidence": "",
    "SQL": "SELECT T2.p_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T1.courseLevel = 'Level_500' GROUP BY T2.p_id"
  },
  {
    "db_id": "computer_student",
    "question": "List all the courses taught by professors with more than 5 years of program",
    "evidence": "",
    "SQL": "SELECT T1.course_id, T1.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T2.p_id = T3.p_id WHERE T3.yearsInProgram > 5"
  },
  {
    "db_id": "computer_student",
    "question": "What are the course levels taught by more than 2 people?",
    "evidence": "",
    "SQL": "SELECT DISTINCT T3.courseLevel FROM course AS T3 INNER JOIN taughtBy AS T2 ON T3.course_id = T2.course_id GROUP BY T3.courseLevel HAVING COUNT(T2.course_id) > 2"
  },
  {
    "db_id": "computer_student",
    "question": "Which courses are taught by faculty members with more than 5 years of experience in the department?",
    "evidence": "",
    "SQL": "SELECT course.course_id, course.courseLevel FROM course INNER JOIN taughtBy ON course.course_id = taughtBy.course_id INNER JOIN person ON taughtBy.p_id = person.p_id WHERE person.yearsInProgram > '5 years' GROUP BY course.course_id"
  },
  {
    "db_id": "computer_student",
    "question": "What are the most common positions held by professors at the university?",
    "evidence": "",
    "SQL": "SELECT hasPosition, COUNT(*) FROM person GROUP BY hasPosition ORDER BY COUNT(*) DESC"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of students currently in the program",
    "evidence": "",
    "SQL": "SELECT COUNT(student) FROM person WHERE inPhase IS NOT NULL"
  },
  {
    "db_id": "computer_student",
    "question": "How many students are advised by a professor?",
    "evidence": "",
    "SQL": "SELECT COUNT(T1.p_id_dummy) FROM advisedBy AS T1"
  },
  {
    "db_id": "computer_student",
    "question": "Please list the IDs of faculty employees who are both professors and advisors.",
    "evidence": "",
    "SQL": "SELECT p_id FROM person WHERE hasPosition = 'Faculty_eme' AND professor = 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the number of courses taught by each professor?",
    "evidence": "",
    "SQL": "SELECT p_id, COUNT(course_id) as num_courses FROM taughtBy GROUP BY p_id"
  },
  {
    "db_id": "computer_student",
    "question": "Which professors teach courses at the Level_300 level?",
    "evidence": "",
    "SQL": "SELECT T2.p_id, T3.courseLevel FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T2.course_id WHERE T3.courseLevel = 'Level_300'"
  },
  {
    "db_id": "computer_student",
    "question": "List the IDs of students who are in phase one and were taught by professor with ID 3.",
    "evidence": "",
    "SQL": "SELECT student FROM person WHERE inPhase = 'Phase One' AND EXISTS (SELECT 1 FROM taughtBy WHERE taughtBy.p_id = person.p_id AND taughtBy.course_id IN (SELECT course_id FROM course WHERE courseLevel = 'Undergraduate')) AND p_id IN (SELECT p_id FROM person WHERE p_id = 3)"
  },
  {
    "db_id": "computer_student",
    "question": "What are the course IDs and levels of all the courses that are taught by professors who are in faculty?",
    "evidence": "",
    "SQL": "SELECT T1.course_id, T1.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T2.p_id = T3.p_id WHERE T3.hasPosition = 'faculty'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the name of the professor who has advised the most students to teach?",
    "evidence": "",
    "SQL": "SELECT p_id FROM advisedBy GROUP BY p_id HAVING COUNT(p_id) > 0 ORDER BY COUNT(p_id) DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the list of students who are in phase 4 and taught by a professor with a course level of 'Level_400'?",
    "evidence": "",
    "SQL": "SELECT * FROM person AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id_dummy INNER JOIN taughtBy AS T3 ON T1.p_id = T3.p_id INNER JOIN course AS T4 ON T3.course_id = T4.course_id WHERE T1.inPhase = 'phase_4' AND T4.courseLevel = 'Level_400'"
  },
  {
    "db_id": "computer_student",
    "question": "Which students are advised by the professor who teaches the most courses?",
    "evidence": "",
    "SQL": "SELECT T1.p_id FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.professor = (SELECT T3.p_id FROM person AS T3 WHERE (SELECT COUNT(T4.course_id) FROM taughtBy AS T4 WHERE T4.p_id = T3.p_id) = (SELECT MAX(T5.course_id) FROM taughtBy AS T5 GROUP BY T5.p_id))"
  },
  {
    "db_id": "computer_student",
    "question": "Which professors teach in both Level_300 and Level_400 courses?",
    "evidence": "",
    "SQL": "SELECT distinct p_id FROM taughtBy AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T2.courseLevel IN ('Level_300', 'Level_400') GROUP BY p_id HAVING COUNT(DISTINCT T2.courseLevel) = 2"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of students and professors across all levels?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person WHERE professor = 1 OR student = 1"
  },
  {
    "db_id": "computer_student",
    "question": "Who are the people who have taught course with course ID 105 and have more than 5 years of experience?",
    "evidence": "",
    "SQL": "SELECT T1.p_id FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T2.course_id WHERE T3.course_id = 105 AND T1.yearsInProgram > 5"
  },
  {
    "db_id": "computer_student",
    "question": "What is the list of students who are taught by professors who have taught level 400 courses?",
    "evidence": "",
    "SQL": "SELECT T1.student FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T3.courseLevel = 'Level_400'"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses taught by the professor with the most number of students?",
    "evidence": "",
    "SQL": "SELECT T1.course_id FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id GROUP BY T1.course_id ORDER BY COUNT(T2.p_id) DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "List the courses taught by professors who are not in their program's first phase",
    "evidence": "",
    "SQL": "SELECT T3.course_id, T3.courseLevel FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T1.course_id WHERE T2.inPhase != 'FirstPhase' AND T2.p_id != T2.student"
  },
  {
    "db_id": "computer_student",
    "question": "Who are the students that are part of phase 2 and has been in the program for more than 3 years?",
    "evidence": "",
    "SQL": "SELECT p_id FROM person WHERE inPhase = 'Phase_2' AND yearsInProgram LIKE '%_2%' AND yearsInProgram LIKE '%3%'"
  },
  {
    "db_id": "computer_student",
    "question": "What are the IDs of students who have been advised by a professor who teaches a course with a course level 'Level_400'?",
    "evidence": "",
    "SQL": "SELECT DISTINCT P1.p_id FROM person AS P1 INNER JOIN advisedBy AS A ON P1.p_id = A.p_id_dummy INNER JOIN taughtBy AS T ON A.p_id = T.p_id INNER JOIN course AS C ON T.course_id = C.course_id WHERE C.courseLevel = 'Level_400'"
  },
  {
    "db_id": "computer_student",
    "question": "Which students are advised by multiple professors and take a course taught by a professor who is a faculty affiliate?",
    "evidence": "",
    "SQL": "SELECT T1.p_id, T2.course_id FROM person AS T1 INNER JOIN advisedBy AS T3 ON T1.p_id = T3.p_id_dummy INNER JOIN taughtBy AS T4 ON T4.p_id = T3.p_id_dummy INNER JOIN course AS T2 ON T4.course_id = T2.course_id WHERE T1.student = 1 AND T2.courseLevel = 'Faculty_aff'"
  },
  {
    "db_id": "computer_student",
    "question": "What courses has a professor who has a position 'Researcher' and also taught course with courseLevel 'Level_200'?",
    "evidence": "",
    "SQL": "SELECT T1.course_id, T1.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T2.p_id = T3.p_id WHERE T3.hasPosition = 'Researcher' AND T1.courseLevel = 'Level_200'"
  },
  {
    "db_id": "computer_student",
    "question": "What are the unique courses offered by professors who have a course level of 'Bachelor'?",
    "evidence": "",
    "SQL": "SELECT DISTINCT T2.course_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T2.p_id = T3.p_id WHERE T1.courseLevel = 'Bachelor'"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses taught by professors who also advise students?",
    "evidence": "",
    "SQL": "SELECT course.course_id FROM course INNER JOIN taughtBy ON course.course_id = taughtBy.course_id INNER JOIN person ON taughtBy.p_id = person.p_id WHERE person.hasPosition = 'advisedBy'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the highest course level offered by a teacher who has advised at least 5 students?",
    "evidence": "",
    "SQL": "SELECT MAX(T3.courseLevel) FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T2.course_id INNER JOIN advisedBy AS T4 ON T1.p_id = T4.p_id_dummy GROUP BY T1.p_id HAVING COUNT(T4.p_id_dummy) >= 5"
  },
  {
    "db_id": "computer_student",
    "question": "Who taught the most undergraduate courses?",
    "evidence": "",
    "SQL": "SELECT T2.p_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T1.courseLevel = 'Level_300' GROUP BY T2.p_id ORDER BY COUNT(T2.course_id) DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "Which students are advised by professors who teach advanced undergraduate courses?",
    "evidence": "",
    "SQL": "SELECT distinct T1.p_id FROM person AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id INNER JOIN taughtBy AS T3 ON T2.p_id_dummy = T3.p_id INNER JOIN course AS T4 ON T3.course_id = T4.course_id WHERE T4.courseLevel = 'Level_400'"
  },
  {
    "db_id": "computer_student",
    "question": "What are the IDs of professors who have taught a Level_300 or Level_400 course?",
    "evidence": "",
    "SQL": "SELECT p_id FROM taughtBy JOIN course ON taughtBy.course_id = course.course_id WHERE course.courseLevel IN ('Level_300', 'Level_400')"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses taught by students who are at least 3 years in the undergraduate program?",
    "evidence": "",
    "SQL": "SELECT T3.course_id, T3.courseLevel FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T1.course_id WHERE T2.inPhase = 'Level_300' AND T2.yearsInProgram >= 3"
  },
  {
    "db_id": "computer_student",
    "question": "What is the most common undergraduate course level taught by a professor?",
    "evidence": "",
    "SQL": "SELECT courseLevel, COUNT(*) AS count FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id GROUP BY courseLevel ORDER BY count DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What are all the courses taught by professors who have taught only one course?",
    "evidence": "",
    "SQL": "SELECT T1.course_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id GROUP BY T2.course_id HAVING COUNT(T2.course_id) = 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the ID of the person who taught course ID of 152?",
    "evidence": "",
    "SQL": "SELECT p_id FROM taughtBy WHERE course_id = 152"
  },
  {
    "db_id": "computer_student",
    "question": "What is the course level of a course which is taught by a professor who also advises a student in their 9th year of program?",
    "evidence": "",
    "SQL": "SELECT course.courseLevel FROM course INNER JOIN taughtBy ON course.course_id = taughtBy.course_id INNER JOIN person ON taughtBy.p_id = person.p_id WHERE person.yearsInProgram = 'Year_9' AND hasPosition = 'Professor'"
  },
  {
    "db_id": "computer_student",
    "question": "List the IDs of all the students who have at least one professor advising them.",
    "evidence": "",
    "SQL": "SELECT DISTINCT P1.p_id FROM person AS P1 INNER JOIN advisedBy AS T1 ON P1.p_id = T1.p_id_dummy GROUP BY P1.p_id HAVING COUNT(T1.p_id_dummy) > 0"
  },
  {
    "db_id": "computer_student",
    "question": "How many professors are there that teach more than one course?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person P JOIN taughtBy TB ON P.p_id = TB.p_id WHERE P.professor = 1 GROUP BY P.p_id HAVING COUNT(course_id) > 1"
  },
  {
    "db_id": "computer_student",
    "question": "How many students were advised by a person who has more than 4 years of experience in the program?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person WHERE p_id IN (SELECT p_id FROM person WHERE yearsInProgram > '4') AND student > 0"
  },
  {
    "db_id": "computer_student",
    "question": "What is the course ID of the course being taught by the professor who advises the student with ID 80?",
    "evidence": "",
    "SQL": "SELECT T2.course_id FROM taughtBy AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id INNER JOIN advisedBy AS T3 ON T1.p_id = T3.p_id_dummy WHERE T3.p_id_dummy = 80"
  },
  {
    "db_id": "computer_student",
    "question": "Which students are advised by a professor who has taught more than 3 courses?",
    "evidence": "",
    "SQL": "SELECT T1.p_id FROM person AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id INNER JOIN taughtBy AS T3 ON T2.p_id = T3.p_id GROUP BY T1.p_id HAVING COUNT(T3.course_id) > 3"
  },
  {
    "db_id": "computer_student",
    "question": "Who are the students that have advisors who have taught the most courses?",
    "evidence": "",
    "SQL": "SELECT T2.p_id FROM person AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id INNER JOIN taughtBy AS T3 ON T3.p_id = T2.p_id_dummy GROUP BY T2.p_id ORDER BY COUNT(T3.course_id) DESC"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of courses taught by professors who have been in the program for more than 2 years?",
    "evidence": "",
    "SQL": "SELECT COUNT(DISTINCT T3.course_id) FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T1.course_id WHERE T2.yearsInProgram > 2"
  },
  {
    "db_id": "computer_student",
    "question": "What is the course level of the most recent Level_300 courses?",
    "evidence": "",
    "SQL": "SELECT courseLevel FROM course WHERE courseLevel = 'Level_300' ORDER BY course_id DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "Which professors teach both undergraduate and graduate courses?",
    "evidence": "",
    "SQL": "SELECT DISTINCT T1.p_id FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T3.courseLevel IN ('Level_100', 'Level_500')"
  },
  {
    "db_id": "computer_student",
    "question": "List the names and ID of the professors who taught at least two courses.",
    "evidence": "",
    "SQL": "SELECT T1.p_id, T1.professor FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id GROUP BY T1.p_id, T1.professor HAVING COUNT(T2.course_id) >= 2"
  },
  {
    "db_id": "computer_student",
    "question": "What is the ID of the course that has the highest course level?",
    "evidence": "",
    "SQL": "SELECT course_id FROM course ORDER BY courseLevel DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "Which courses are taught by more than one professor?",
    "evidence": "",
    "SQL": "SELECT course_id FROM course WHERE course_id IN (SELECT course_id FROM taughtBy GROUP BY course_id HAVING COUNT(p_id) > 1)"
  },
  {
    "db_id": "computer_student",
    "question": "What courses are being taught by professors who are also advisors of some students?",
    "evidence": "",
    "SQL": "SELECT T1.course_id, T1.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN advisedBy AS T3 ON T2.p_id = T3.p_id_dummy GROUP BY T1.course_id, T1.courseLevel"
  },
  {
    "db_id": "computer_student",
    "question": "What is the average years of program for professors who taught course ID of 135?",
    "evidence": "",
    "SQL": "SELECT AVG(T2.yearsInProgram) FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T1.course_id = 135 AND T2.professor = 1"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses that a specific professor is teaching?",
    "evidence": "",
    "SQL": "SELECT course_id FROM taughtBy WHERE p_id IN (SELECT p_id FROM person WHERE professor IS NOT NULL)"
  },
  {
    "db_id": "computer_student",
    "question": "What are the names of all students advised to teach by a professor teaching high-level undergraduate courses?",
    "evidence": "",
    "SQL": "SELECT T1.student AS student_name FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T2.course_id WHERE T3.courseLevel = 'Level_400' ORDER BY T1.student"
  },
  {
    "db_id": "computer_student",
    "question": "What courses were taught by people who advised more than 10 students?",
    "evidence": "",
    "SQL": "SELECT distinct T1.course_id FROM taughtBy AS T1 JOIN advisedBy AS T2 ON T1.p_id = T2.p_id GROUP BY T1.course_id HAVING COUNT(T2.p_id_dummy) > 10"
  },
  {
    "db_id": "computer_student",
    "question": "How many students are advised to teach by a professor teaching a course with level 'Level_400'?",
    "evidence": "",
    "SQL": "SELECT COUNT(DISTINCT T4.p_id) FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T2.course_id INNER JOIN advisedBy AS T4 ON T4.p_id = T1.p_id WHERE T1.professor = 1 AND T3.courseLevel = 'Level_400'"
  },
  {
    "db_id": "computer_student",
    "question": "How many professors taught at least 5 courses?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM ( SELECT COUNT(course_id) FROM taughtBy GROUP BY p_id HAVING COUNT(course_id) >= 5 )"
  },
  {
    "db_id": "computer_student",
    "question": "What is the ID of the professor who taught the course level 200?",
    "evidence": "",
    "SQL": "SELECT p_id FROM taughtBy INNER JOIN course ON taughtBy.course_id = course.course_id WHERE courseLevel = 'Level_200'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the list of courses taught by professors who are also students at the university?",
    "evidence": "",
    "SQL": "SELECT T3.course_id, T3.courseLevel FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T1.course_id WHERE T2.student = 1"
  },
  {
    "db_id": "computer_student",
    "question": "What are the IDs of professors who teach courses with Level 400?",
    "evidence": "",
    "SQL": "SELECT T1.p_id FROM taughtBy AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T2.courseLevel = 'Level_400'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the list of course IDs taught by a professor who is also a student and has a position?",
    "evidence": "",
    "SQL": "SELECT T1.course_id FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.hasPosition IS NOT NULL AND T2.student IS NOT NULL"
  },
  {
    "db_id": "computer_student",
    "question": "What is the ID of the course taught by the advisor who advises a student with ID 376?",
    "evidence": "",
    "SQL": "SELECT T3.course_id FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN taughtBy AS T3 ON T2.p_id = T3.p_id WHERE T1.p_id_dummy = 141"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses taught by professors who are professors at the department?",
    "evidence": "",
    "SQL": "SELECT T3.course_id, T3.courseLevel FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T1.course_id WHERE T2.hasPosition = 'Professor_dept'"
  },
  {
    "db_id": "computer_student",
    "question": "Which people are teaching Level_300 courses?",
    "evidence": "",
    "SQL": "SELECT T2.p_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T1.courseLevel = 'Level_300'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the number of courses taught by professors who are also students?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM taughtBy AS T1 JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.hasPosition = 'Professor' AND T2.student IS NOT NULL"
  },
  {
    "db_id": "computer_student",
    "question": "What is the highest level of a course that a professor teaches who has a position that starts with the letter A?",
    "evidence": "",
    "SQL": "SELECT DISTINCT courseLevel FROM course JOIN taughtBy ON course.course_id = taughtBy.course_id JOIN person ON taughtBy.p_id = person.p_id WHERE hasPosition LIKE 'A%' ORDER BY courseLevel DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What are all the courses that have been taught by a person who is both a professor and a student?",
    "evidence": "",
    "SQL": "SELECT T1.course_id FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.professor = 1 AND T2.student = 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the average number of years students have been in the program for the professors who taught at least one course?",
    "evidence": "",
    "SQL": "SELECT AVG(yearsInProgram) FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id WHERE T1.professor = 1"
  },
  {
    "db_id": "computer_student",
    "question": "Which professors have taught a master's-level course and also a professional-level course?",
    "evidence": "",
    "SQL": "SELECT T1.p_id FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id WHERE T2.course_id IN (SELECT course_id FROM course WHERE courseLevel = 'Level_700') AND T2.course_id IN (SELECT course_id FROM course WHERE courseLevel = 'Level_500')"
  },
  {
    "db_id": "computer_student",
    "question": "Which students are advised by more than one advisor?",
    "evidence": "",
    "SQL": "SELECT * FROM person AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id_dummy GROUP BY T1.p_id HAVING COUNT(DISTINCT T2.p_id) > 1"
  },
  {
    "db_id": "computer_student",
    "question": "How many courses is professor P with course id 7 taught?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM taughtBy AS T1 WHERE T1.course_id = 7"
  },
  {
    "db_id": "computer_student",
    "question": "What is the name and ID of the professor who taught the most courses?",
    "evidence": "",
    "SQL": "SELECT p_id, COUNT(*) FROM taughtBy GROUP BY p_id ORDER BY COUNT(course_id) DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses taught by professors who have worked as 'Research Professors' at some point in their career?",
    "evidence": "",
    "SQL": "SELECT C.course_id, C.courseLevel FROM course C INNER JOIN taughtBy T ON C.course_id = T.course_id INNER JOIN person P ON T.p_id = P.p_id WHERE P.hasPosition = 'Research Professors'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the course level for a course with ID 113?",
    "evidence": "",
    "SQL": "SELECT courseLevel FROM course WHERE course_id = 113"
  },
  {
    "db_id": "computer_student",
    "question": "Are there any students who are also professors?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person WHERE student = 1 AND professor = 1"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses taught by professors who have a position other than professor?",
    "evidence": "",
    "SQL": "SELECT T3.course_id, T3.courseLevel FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T1.course_id WHERE T2.hasPosition != 'Professor'"
  },
  {
    "db_id": "computer_student",
    "question": "What are the course IDs of the courses taught by professors who have taught in both the 'Level_200' and 'Level_300' undergraduate courses?",
    "evidence": "",
    "SQL": "SELECT course_id FROM taughtBy AS T1 WHERE p_id IN (SELECT p_id FROM taughtBy AS T2 WHERE course_id IN (SELECT course_id FROM course WHERE courseLevel = 'Level_200')) AND p_id IN (SELECT p_id FROM taughtBy AS T3 WHERE course_id IN (SELECT course_id FROM course WHERE courseLevel = 'Level_300'))"
  },
  {
    "db_id": "computer_student",
    "question": "How many students are in the phase of research?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person WHERE hasPosition = 0 AND inPhase = 1"
  },
  {
    "db_id": "computer_student",
    "question": "Which professor teaches the most undergraduate courses with a course level of 'Level_200'?",
    "evidence": "",
    "SQL": "SELECT T1.p_id FROM taughtBy AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T1.p_id = T3.p_id WHERE T2.courseLevel = 'Level_200' AND T3.professor = 1 GROUP BY T1.p_id ORDER BY COUNT(*) DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "How many courses were taught by professors from faculty affiliated position?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.hasPosition = 'Faculty_aff'"
  },
  {
    "db_id": "computer_student",
    "question": "How many students has one or more professor who teaches a graduate-level course?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person AS T1 LEFT JOIN advisedBy AS T2 ON T1.p_id = T2.p_id LEFT JOIN taughtBy AS T3 ON T3.p_id = T2.p_id INNER JOIN course AS T4 ON T3.course_id = T4.course_id WHERE T4.courseLevel = 'Level_500'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the name of the course with the smallest course ID?",
    "evidence": "",
    "SQL": "SELECT courseLevel FROM course WHERE course_id = (SELECT MIN(course_id) FROM course)"
  },
  {
    "db_id": "computer_student",
    "question": "What are the names of courses taught by a professor who has more than 5 years of experience in the program?",
    "evidence": "",
    "SQL": "SELECT DISTINCT course.course_id, course.courseLevel FROM course INNER JOIN taughtBy ON course.course_id = taughtBy.course_id INNER JOIN person ON taughtBy.p_id = person.p_id WHERE person.yearsInProgram > 5"
  },
  {
    "db_id": "computer_student",
    "question": "How many faculty members who are also students are teaching courses in Level_400?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T1.professor = 1 AND T1.student = 1 AND T3.courseLevel = 'Level_400'"
  },
  {
    "db_id": "computer_student",
    "question": "What are the names of students who are advised by a faculty member who has been a student in the program for more than 2 years?",
    "evidence": "",
    "SQL": "SELECT T3.student FROM person AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id INNER JOIN person AS T3 ON T2.p_id_dummy = T3.p_id WHERE T1.inPhase = 'student' AND T1.yearsInProgram > 2"
  },
  {
    "db_id": "computer_student",
    "question": "What is the number of students who are in phase 2 and have been in the program for more than 3 years?",
    "evidence": "",
    "SQL": "SELECT COUNT(student) FROM person WHERE inPhase = 'Phase_2' AND yearsInProgram > '3'"
  },
  {
    "db_id": "computer_student",
    "question": "What courses have been taught by at least 3 professors?",
    "evidence": "",
    "SQL": "SELECT T1.course_id, T1.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id GROUP BY T1.course_id, T1.courseLevel HAVING COUNT(T2.p_id) >= 3"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of professors who teach courses of a specific level?",
    "evidence": "",
    "SQL": "SELECT COUNT(T2.p_id) FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id GROUP BY T1.courseLevel"
  },
  {
    "db_id": "computer_student",
    "question": "Which professors are teaching both 101 and 202 courses?",
    "evidence": "",
    "SQL": "SELECT T1.p_id FROM taughtBy AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id AND T1.course_id = '101' AND T2.course_id = '202'"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses taught by professors who have taught at least 3 courses?",
    "evidence": "",
    "SQL": "SELECT DISTINCT course_id FROM taughtBy GROUP BY course_id HAVING COUNT(course_id) >= 3"
  },
  {
    "db_id": "computer_student",
    "question": "Which students are taught by a professor who teaches at level 500?",
    "evidence": "",
    "SQL": "SELECT p_id FROM person WHERE student IS NOT NULL AND p_id IN (SELECT p_id FROM taughtBy WHERE course_id IN (SELECT course_id FROM course WHERE courseLevel = 'Level_500'))"
  },
  {
    "db_id": "computer_student",
    "question": "Which professors are advisors to students in more than one course?",
    "evidence": "",
    "SQL": "SELECT T1.p_id FROM person AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id_dummy GROUP BY T1.p_id HAVING COUNT(T2.p_id_dummy) > 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the highest level of courses taught by a professor who has a position other than 'Faculty_eme' and has taught at least 2 courses?",
    "evidence": "",
    "SQL": "SELECT DISTINCT T3.courseLevel FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T2.course_id WHERE T1.hasPosition != 'Faculty_eme' GROUP BY T3.courseLevel HAVING COUNT(T2.course_id) >= 2 ORDER BY T3.courseLevel DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the course level of course ID 12?",
    "evidence": "",
    "SQL": "SELECT courseLevel FROM course WHERE course_id = 12"
  },
  {
    "db_id": "computer_student",
    "question": "What is the course level of the course taught by Professor 415?",
    "evidence": "",
    "SQL": "SELECT courseLevel FROM course WHERE course_id IN (SELECT course_id FROM taughtBy WHERE p_id = (SELECT p_id FROM person WHERE professor = 415))"
  },
  {
    "db_id": "computer_student",
    "question": "What is the ID of the course taught by professor with ID 3?",
    "evidence": "",
    "SQL": "SELECT course_id FROM taughtBy WHERE p_id = 3"
  },
  {
    "db_id": "computer_student",
    "question": "Which professors are teaching courses in a higher level?",
    "evidence": "",
    "SQL": "SELECT T1.p_id FROM taughtBy AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T1.p_id IN (SELECT p_id FROM person WHERE professor = 1) AND T2.courseLevel = 'Higher'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the number of courses taught by a faculty member who has been in the program for more than 5 years?",
    "evidence": "",
    "SQL": "SELECT COUNT(T1.course_id) FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T2.p_id = T3.p_id WHERE T3.yearsInProgram > '5' GROUP BY T3.p_id"
  },
  {
    "db_id": "computer_student",
    "question": "Which students are in the 12th year of the program?",
    "evidence": "",
    "SQL": "SELECT p_id FROM person WHERE yearsInProgram = 'Year_12'"
  },
  {
    "db_id": "computer_student",
    "question": "What courses does professor with ID 5 teach?",
    "evidence": "",
    "SQL": "SELECT course_id FROM taughtBy WHERE p_id = 5"
  },
  {
    "db_id": "computer_student",
    "question": "Which professors advise students who are also teaching a course?",
    "evidence": "",
    "SQL": "SELECT P1.p_id FROM person AS P1 INNER JOIN advisedBy AS AB ON P1.p_id = AB.p_id_dummy INNER JOIN taughtBy AS TB ON AB.p_id = TB.p_id"
  },
  {
    "db_id": "computer_student",
    "question": "Who has taught at least two professional courses?",
    "evidence": "",
    "SQL": "SELECT p_id FROM taughtBy GROUP BY p_id HAVING COUNT(course_id) > 1"
  },
  {
    "db_id": "computer_student",
    "question": "What are the names of the students who advised by professor 7 and has not completed their program for more than 2 years?",
    "evidence": "",
    "SQL": "SELECT T2.p_id FROM person AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id WHERE T1.hasPosition = 'student' AND T1.inPhase IS NULL AND T1.yearsInProgram < 3 AND T2.p_id = 7"
  },
  {
    "db_id": "computer_student",
    "question": "What is the level of the course with the highest unique identifying number taught by professor with the identifier 135?",
    "evidence": "",
    "SQL": "SELECT T1.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T2.p_id = 135 ORDER BY T1.course_id DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the most frequently taught course by all professors?",
    "evidence": "",
    "SQL": "SELECT course.course_id, course.courseLevel, COUNT(*) as frequency FROM course INNER JOIN taughtBy ON course.course_id = taughtBy.course_id GROUP BY course.course_id, course.courseLevel ORDER BY frequency DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What are the IDs of students who are advised by a professor who has taught a master course?",
    "evidence": "",
    "SQL": "SELECT P1.p_id FROM person AS P1 INNER JOIN advisedBy AS T1 ON P1.p_id = T1.p_id_dummy INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T3.courseLevel = 'Level_500'"
  },
  {
    "db_id": "computer_student",
    "question": "What are all the courses taught by professors who have a position?",
    "evidence": "",
    "SQL": "SELECT c.course_id, c.courseLevel FROM course c JOIN taughtBy t ON c.course_id = t.course_id JOIN person p ON t.p_id = p.p_id WHERE p.hasPosition IS NOT NULL"
  },
  {
    "db_id": "computer_student",
    "question": "What is the number of courses that are taught by a professor who has been in the program for more than 3 years?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.inPhase = 'true' AND yearsInProgram > '3'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the list of courses taught by professors who have at least 5 years of experience in a program?",
    "evidence": "",
    "SQL": "SELECT course.course_id, course.courseLevel FROM course INNER JOIN taughtBy ON course.course_id = taughtBy.course_id INNER JOIN person ON taughtBy.p_id = person.p_id WHERE person.yearsInProgram >= '5' AND person.professor = 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the number of professional or master/graduate courses taught by a professor?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T1.courseLevel = 'Level_500' AND T2.p_id IN (SELECT p_id from person where hasPosition = 'Professor')"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of students being advised by advisors who also teach courses?",
    "evidence": "",
    "SQL": "SELECT COUNT(DISTINCT T1.p_id) FROM advisedBy AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id"
  },
  {
    "db_id": "computer_student",
    "question": "Find the IDs of professors who teach undergraduate courses.",
    "evidence": "",
    "SQL": "SELECT distinct T.p_id FROM taughtBy T INNER JOIN course C ON T.course_id = C.course_id WHERE C.courseLevel = 'Level_200'"
  },
  {
    "db_id": "computer_student",
    "question": "What are the names of students who have not advised anyone to take a course?",
    "evidence": "",
    "SQL": "SELECT p_id FROM person WHERE p_id NOT IN (SELECT DISTINCT p_id_dummy FROM advisedBy)"
  },
  {
    "db_id": "computer_student",
    "question": "What courses are taught by faculty members who advise more than one student?",
    "evidence": "",
    "SQL": "SELECT T1.course_id FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN advisedBy AS T3 ON T2.p_id = T3.p_id WHERE T3.p_id_dummy IS NOT NULL GROUP BY T1.course_id"
  },
  {
    "db_id": "computer_student",
    "question": "Which students are advised by professors who teach the course no. 9?",
    "evidence": "",
    "SQL": "SELECT T1.p_id FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN taughtBy AS T3 ON T2.p_id = T3.p_id WHERE T3.course_id = 9 AND T2.student = 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the name of the student who has been in the program for the longest amount of time?",
    "evidence": "",
    "SQL": "SELECT inPhase, yearsInProgram FROM person WHERE student = 1 ORDER BY yearsInProgram DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the course level of courses taught by the professor who advised student with ID 80?",
    "evidence": "",
    "SQL": "SELECT courseLevel FROM course INNER JOIN taughtBy ON course.course_id = taughtBy.course_id INNER JOIN advisedBy ON taughtBy.p_id = advisedBy.p_id_dummy WHERE advisedBy.p_id = 80"
  },
  {
    "db_id": "computer_student",
    "question": "What courses are taught by a professor who also advises a student in the 5th year of their program?",
    "evidence": "",
    "SQL": "SELECT course.course_id FROM course, taughtBy, advisedBy, person WHERE course.course_id = taughtBy.course_id AND taughtBy.p_id = advisedBy.p_id AND advisedBy.p_id_dummy = person.p_id AND person.yearsInProgram = 'Year_5'"
  },
  {
    "db_id": "computer_student",
    "question": "List down all the professors who have taught at least one course with the course level of 'Undergraduate'.",
    "evidence": "",
    "SQL": "SELECT DISTINCT T1.p_id FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T1.professor = 1 AND T3.courseLevel = 'Undergraduate'"
  },
  {
    "db_id": "computer_student",
    "question": "Find the professors who are teaching courses that are also taught by another professor.",
    "evidence": "",
    "SQL": "SELECT T2.p_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE EXISTS (SELECT 1 FROM taughtBy AS T3 WHERE T3.course_id = T1.course_id AND T3.p_id <> T2.p_id)"
  },
  {
    "db_id": "computer_student",
    "question": "What is the name of the person who has taught the most courses?",
    "evidence": "",
    "SQL": "SELECT p_id, COUNT(course_id) as numCourses FROM taughtBy GROUP BY p_id ORDER BY numCourses DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What are the names of professors who taught courses at level 300?",
    "evidence": "",
    "SQL": "SELECT P.p_id, P.hasPosition FROM person AS P INNER JOIN taughtBy AS T ON P.p_id = T.p_id INNER JOIN course AS C ON T.course_id = C.course_id WHERE C.courseLevel = 300"
  },
  {
    "db_id": "computer_student",
    "question": "What is the list of courses taught by a professor with at least 5 years of experience?",
    "evidence": "",
    "SQL": "SELECT T1.course_id, T1.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T3.p_id = T2.p_id WHERE T3.yearsInProgram LIKE '%5%'"
  },
  {
    "db_id": "computer_student",
    "question": "Which students are taught by professors who have more than 3 years of experience and what are their levels?",
    "evidence": "",
    "SQL": "SELECT T1.p_id, T2.courseLevel FROM person AS T1 INNER JOIN taughtBy AS T3 ON T1.p_id = T3.p_id INNER JOIN course AS T2 ON T3.course_id = T2.course_id INNER JOIN person AS T4 ON T3.p_id = T4.p_id WHERE T4.yearsInProgram > 3 GROUP BY T1.p_id ORDER BY T1.p_id"
  },
  {
    "db_id": "computer_student",
    "question": "What is the highest course level taught by a professor who has taught at least two courses?",
    "evidence": "",
    "SQL": "SELECT DISTINCT T1.courseLevel AS level FROM course AS T1 JOIN taughtBy AS T2 ON T1.course_id = T2.course_id JOIN person AS T3 ON T3.p_id = T2.p_id GROUP BY T1.courseLevel, T3.p_id HAVING COUNT(T1.course_id) >= 2 ORDER BY level DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the position of the professors who taught course 'CS101'?",
    "evidence": "",
    "SQL": "SELECT T2.hasPosition FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T1.course_id = 'CS101'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the average number of courses taught by each professor?",
    "evidence": "",
    "SQL": "SELECT AVG(cnt) FROM (SELECT p_id, COUNT(*) AS cnt FROM taughtBy GROUP BY p_id) AS T1"
  },
  {
    "db_id": "computer_student",
    "question": "What are the names of professors who teach courses that are also advised by a student?",
    "evidence": "",
    "SQL": "SELECT P1.p_id, P1.hasPosition FROM person AS P1 INNER JOIN taughtBy AS T1 ON P1.p_id = T1.p_id INNER JOIN advisedBy AS T2 ON T1.course_id = T2.p_id_dummy AND T2.p_id = P1.p_id GROUP BY P1.p_id"
  },
  {
    "db_id": "computer_student",
    "question": "What is the number of students in each phase for professors who taught courses of more than 10 ID?",
    "evidence": "",
    "SQL": "SELECT inPhase, COUNT(student) AS studentCount FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T2.course_id WHERE T3.course_id > 10 GROUP BY inPhase"
  },
  {
    "db_id": "computer_student",
    "question": "What is the course level of the course taught by the professor who has taught the most courses?",
    "evidence": "",
    "SQL": "SELECT T1.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id GROUP BY T1.courseLevel ORDER BY COUNT(T2.course_id) DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "Which students have advisors and are currently in phase 2 of their program?",
    "evidence": "",
    "SQL": "SELECT p_id FROM person WHERE student = 1 AND hasPosition = 'Position_Var' AND inPhase = 'Phase_2' AND p_id IN (SELECT p_id FROM advisedBy)"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of professors who taught at least one course in 2020?",
    "evidence": "",
    "SQL": "SELECT COUNT(DISTINCT p_id) FROM taughtBy AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T2.courseLevel LIKE '%year_2020%'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the average number of teachers for courses in Level_200?",
    "evidence": "",
    "SQL": "SELECT AVG(T2.p_id) FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T1.courseLevel = 'Level_200'"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses taught by professors who have a specific course level, say intermediate?",
    "evidence": "",
    "SQL": "SELECT T1.course_id FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T1.course_id = T3.course_id WHERE T2.professor = 1 AND T3.courseLevel = 'Intermediate'"
  },
  {
    "db_id": "computer_student",
    "question": "Who teaches the most courses?",
    "evidence": "",
    "SQL": "SELECT T1.p_id, COUNT(T2.course_id) FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id GROUP BY T1.p_id ORDER BY COUNT(T2.course_id) DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of students in each course level?",
    "evidence": "",
    "SQL": "SELECT courseLevel, COUNT(*) AS total_students FROM course JOIN taughtBy ON course.course_id = taughtBy.course_id JOIN person ON taughtBy.p_id = person.p_id GROUP BY courseLevel"
  },
  {
    "db_id": "computer_student",
    "question": "What is the course level of the course taught by the professor who has advised the most students?",
    "evidence": "",
    "SQL": "SELECT T2.courseLevel FROM taughtBy AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T1.p_id = T3.p_id GROUP BY T2.courseLevel ORDER BY (SELECT COUNT(T1.p_id) FROM taughtBy AS T4 WHERE T4.p_id = T3.p_id) DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the name of the student who has been in the program for the most years?",
    "evidence": "",
    "SQL": "SELECT inPhase, yearsInProgram FROM person WHERE student IS NOT NULL ORDER BY CAST(yearsInProgram AS INTEGER) DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of courses taught by a student who also teaches another course?",
    "evidence": "",
    "SQL": "SELECT COUNT(DISTINCT T2.course_id) FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id WHERE T1.student = 1 GROUP BY T2.p_id HAVING COUNT(T2.course_id) > 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the name of the students taught by professor with ID 1?",
    "evidence": "",
    "SQL": "SELECT T2.student FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T1.p_id = 1"
  },
  {
    "db_id": "computer_student",
    "question": "What courses are taught by professor with ID 123?",
    "evidence": "",
    "SQL": "SELECT course.courseLevel, course.course_id FROM course INNER JOIN taughtBy ON course.course_id = taughtBy.course_id WHERE taughtBy.p_id = 123"
  },
  {
    "db_id": "computer_student",
    "question": "Who are the students in phase 1 of the program who advise people in phase 2?",
    "evidence": "",
    "SQL": "SELECT p_id FROM person WHERE inPhase = 'Phase_1' AND (SELECT COUNT(*) FROM advisedBy AS T2 WHERE T2.p_id = person.p_id AND inPhase = 'Phase_2') > 0"
  },
  {
    "db_id": "computer_student",
    "question": "What is the list of all professors who have students in their class?",
    "evidence": "",
    "SQL": "SELECT DISTINCT T3.p_id FROM taughtBy AS T1 INNER JOIN person AS T3 ON T1.p_id = T3.p_id"
  },
  {
    "db_id": "computer_student",
    "question": "Which students are advised by professors who teach Level_400 courses?",
    "evidence": "",
    "SQL": "SELECT person.p_id AS id FROM person LEFT JOIN advisedBy ON person.p_id = advisedBy.p_id LEFT JOIN taughtBy ON advisedBy.p_id_dummy = taughtBy.p_id JOIN course ON taughtBy.course_id = course.course_id WHERE person.student = 1 AND course.courseLevel = 'Level_400'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the course level of the course taught by the professor who has been in the program for more than 5 years?",
    "evidence": "",
    "SQL": "SELECT T1.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T2.p_id = T3.p_id WHERE T3.yearsInProgram > 5"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses and course levels offered by professors who are professors, and have a minimum of 5 years in a program?",
    "evidence": "",
    "SQL": "SELECT T3.course_id, T3.courseLevel FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T1.course_id WHERE T2.inPhase = '5_Year_Program' AND T2.hasPosition = 'Professor'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the average number of years a student stays in the program?",
    "evidence": "",
    "SQL": "SELECT AVG(CAST(yearsInProgram AS REAL)) FROM person WHERE student = 1"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses taught by people who also advise students?",
    "evidence": "",
    "SQL": "SELECT T1.course_id, T3.courseLevel FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T1.course_id = T3.course_id INNER JOIN advisedBy AS T4 ON T2.p_id = T4.p_id_dummy"
  },
  {
    "db_id": "computer_student",
    "question": "What courses is professor no.7 teaching?",
    "evidence": "",
    "SQL": "SELECT T1.course_id, T2.courseLevel FROM taughtBy AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T1.p_id = 7"
  },
  {
    "db_id": "computer_student",
    "question": "What advisors have taught more than one course?",
    "evidence": "",
    "SQL": "SELECT distinct T1.p_id FROM person AS T1 JOIN taughtBy AS T2 ON T1.p_id = T2.p_id GROUP BY T1.p_id HAVING COUNT(T2.course_id) > 1"
  },
  {
    "db_id": "computer_student",
    "question": "What courses have both a professor and a student in Phase 1 of the program?",
    "evidence": "",
    "SQL": "SELECT course.course_id, course.courseLevel FROM course, taughtBy, person WHERE course.course_id = taughtBy.course_id AND taughtBy.p_id = person.p_id AND person.inPhase = 'Phase_1' AND EXISTS (SELECT 1 FROM person AS P2 WHERE P2.p_id = person.p_id AND P2.student = 1) AND EXISTS (SELECT 1 FROM person AS P3 WHERE P3.p_id = taughtBy.p_id AND P3.professor = 1)"
  },
  {
    "db_id": "computer_student",
    "question": "What are the years of students who are taught by a professor of Level_300?",
    "evidence": "",
    "SQL": "SELECT DISTINCT yearsInProgram FROM person AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id_dummy INNER JOIN taughtBy AS T3 ON T2.p_id = T3.p_id INNER JOIN course AS T4 ON T3.course_id = T4.course_id WHERE T4.courseLevel = 'Level_300'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the average yearsInProgram of all professors who are also students?",
    "evidence": "",
    "SQL": "SELECT AVG(yearsInProgram) FROM person WHERE professor IS NOT NULL AND student IS NOT NULL"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses taught by professors who have taught both 'Level_400' and 'Level_500' courses?",
    "evidence": "",
    "SQL": "SELECT T3.course_id, T3.courseLevel FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T1.course_id WHERE T2.p_id IN (SELECT p_id FROM taughtBy AS T4 WHERE T4.course_id IN (SELECT course_id FROM course WHERE courseLevel = 'Level_400') AND T4.course_id IN (SELECT course_id FROM course WHERE courseLevel = 'Level_500'))"
  },
  {
    "db_id": "computer_student",
    "question": "What courses are taught by the advisors who have advised at least one student in the course with ID 123?",
    "evidence": "",
    "SQL": "SELECT T3.course_id FROM advisedBy AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T3.course_id = 123 GROUP BY T3.course_id HAVING COUNT(T2.p_id) > 0"
  },
  {
    "db_id": "computer_student",
    "question": "Find all the students who have a professor with a specific position in the 'advisedBy' table.",
    "evidence": "",
    "SQL": "SELECT student FROM person WHERE p_id IN (SELECT p_id FROM advisedBy WHERE hasPosition='Specific Position')"
  },
  {
    "db_id": "computer_student",
    "question": "Which students have not been advised by a professor?",
    "evidence": "",
    "SQL": "SELECT p_id FROM person WHERE p_id NOT IN (SELECT p_id FROM advisedBy)"
  },
  {
    "db_id": "computer_student",
    "question": "Which professors teach more courses that have at least 10 enrolled students?",
    "evidence": "",
    "SQL": "SELECT T1.p_id, COUNT(T2.course_id) AS num_courses FROM taughtBy AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T1.p_id = T3.p_id GROUP BY T1.p_id HAVING COUNT(T2.course_id) > 10"
  },
  {
    "db_id": "computer_student",
    "question": "What course levels are taught by the professor whose ID is 2?",
    "evidence": "",
    "SQL": "SELECT courseLevel FROM course, taughtBy, person WHERE course.course_id = taughtBy.course_id AND taughtBy.p_id = person.p_id AND person.p_id = 2"
  },
  {
    "db_id": "computer_student",
    "question": "Which courses are taught by faculty members?",
    "evidence": "",
    "SQL": "SELECT course.course_id, course.courseLevel FROM course INNER JOIN taughtBy ON course.course_id = taughtBy.course_id INNER JOIN person ON taughtBy.p_id = person.p_id WHERE person.professor = 1"
  },
  {
    "db_id": "computer_student",
    "question": "Which students are currently in a course taught by a professor who is also a student themselves?",
    "evidence": "",
    "SQL": "SELECT distinct p1.student from person as p1, person as p2, course as c, taughtBy as tb where p1.p_id = tb.p_id and p1.hasPosition = 0 and p2.p_id = tb.p_id and p2.hasPosition = 1 and c.course_id = tb.course_id and p1.inPhase = c.courseLevel"
  },
  {
    "db_id": "computer_student",
    "question": "What is the average number of courses taught by professors in their 4th year of the program?",
    "evidence": "",
    "SQL": "SELECT AVG(T2.course_id) FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T2.p_id = T3.p_id WHERE T3.inPhase = '4th year' GROUP BY T3.p_id"
  },
  {
    "db_id": "computer_student",
    "question": "What is the number of students enrolled in courses taught by a professor who teaches more than 3 courses?",
    "evidence": "",
    "SQL": "SELECT COUNT(student) FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T2.p_id = T3.p_id WHERE T3.professor = 1 AND T1.courseLevel != 'Level_500' GROUP BY T1.course_id HAVING COUNT(DISTINCT T2.p_id) > 3"
  },
  {
    "db_id": "computer_student",
    "question": "Which students have more than one advisor?",
    "evidence": "",
    "SQL": "SELECT p_id FROM person AS T1 WHERE p_id IN (SELECT p_id FROM advisedBy AS T2 GROUP BY p_id HAVING COUNT(DISTINCT p_id_dummy) > 1)"
  },
  {
    "db_id": "computer_student",
    "question": "What are the course IDs of the courses taught by a professor from phase of qualifications?",
    "evidence": "",
    "SQL": "SELECT T1.course_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T2.p_id IN (SELECT p_id FROM person WHERE inPhase = 'phase of qualifications')"
  },
  {
    "db_id": "computer_student",
    "question": "List the IDs of all students who are also professors.",
    "evidence": "",
    "SQL": "SELECT p_id FROM person WHERE student AND professor"
  },
  {
    "db_id": "computer_student",
    "question": "Which professors have students who are in their second year of the program?",
    "evidence": "",
    "SQL": "SELECT DISTINCT T1.p_id FROM person AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id_dummy INNER JOIN person AS T3 ON T2.p_id = T3.p_id WHERE T3.yearsInProgram = 2"
  },
  {
    "db_id": "computer_student",
    "question": "List the professors who teach more than one course.",
    "evidence": "",
    "SQL": "SELECT DISTINCT p_id FROM taughtBy GROUP BY p_id HAVING COUNT(p_id) > 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the name of the course that has only professors as teachers?",
    "evidence": "",
    "SQL": "SELECT course_id FROM course WHERE course_id NOT IN (SELECT course_id FROM taughtBy WHERE p_id NOT IN (SELECT p_id FROM person WHERE hasPosition = 'Faculty_eme'))"
  },
  {
    "db_id": "computer_student",
    "question": "What courses did professor 303 teach?",
    "evidence": "",
    "SQL": "SELECT T1.course_id FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.p_id = 303"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses taught by professors having more than 5 years of experience in the program?",
    "evidence": "",
    "SQL": "SELECT T1.course_id, T1.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T3.p_id = T2.p_id WHERE T3.yearsInProgram > 5"
  },
  {
    "db_id": "computer_student",
    "question": "What is the average course level of all courses taught by Professor 2?",
    "evidence": "",
    "SQL": "SELECT AVG(courseLevel) FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T2.p_id = 2"
  },
  {
    "db_id": "computer_student",
    "question": "What is the average number of years in program of professors who taught courses with 'Level_700'?",
    "evidence": "",
    "SQL": "SELECT AVG(yearsInProgram) FROM person WHERE p_id IN (SELECT p_id FROM taughtBy WHERE course_id IN (SELECT course_id FROM course WHERE courseLevel = 'Level_700'))"
  },
  {
    "db_id": "computer_student",
    "question": "What are the names of the courses taught by a professor who has been a student at some point?",
    "evidence": "",
    "SQL": "SELECT T1.course_id, T3.courseLevel FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T1.course_id = T3.course_id WHERE T2.student = 1"
  },
  {
    "db_id": "computer_student",
    "question": "Who are the students that have taken courses taught by the professor with most courses taught?",
    "evidence": "",
    "SQL": "SELECT P2.p_id FROM taughtBy AS T1 INNER JOIN person AS P1 ON T1.p_id = P1.p_id INNER JOIN course AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS P2 ON P2.p_id = P1.student GROUP BY P2.p_id HAVING COUNT(T1.p_id) = (SELECT COUNT(T3.p_id) FROM taughtBy AS T3 GROUP BY T3.p_id ORDER BY COUNT(*) DESC LIMIT 1)"
  },
  {
    "db_id": "computer_student",
    "question": "What is the number of students who are not advised by any professor?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person WHERE p_id NOT IN (SELECT p_id FROM advisedBy)"
  },
  {
    "db_id": "computer_student",
    "question": "Which course IDs are taught by professors who have 'Professor' as their 'hasPosition'?",
    "evidence": "",
    "SQL": "SELECT course_id FROM taughtBy WHERE p_id IN (SELECT p_id FROM person WHERE hasPosition = 'Professor')"
  },
  {
    "db_id": "computer_student",
    "question": "List any five professors who taught at least one master course.",
    "evidence": "",
    "SQL": "SELECT DISTINCT T2.p_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T1.courseLevel = 'Level_500' LIMIT 5"
  },
  {
    "db_id": "computer_student",
    "question": "What are the names of students being advised by professors in their 1st year of program?",
    "evidence": "",
    "SQL": "SELECT T2.p_id FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.yearsInProgram = 'Year_1' AND T2.student = 1"
  },
  {
    "db_id": "computer_student",
    "question": "Which professors are teaching at least two courses?",
    "evidence": "",
    "SQL": "SELECT P.p_id, P.hasPosition, C.course_id, C.courseLevel FROM person AS P INNER JOIN taughtBy AS T ON P.p_id = T.p_id INNER JOIN course AS C ON T.course_id = C.course_id GROUP BY P.p_id HAVING COUNT(C.course_id) > 1"
  },
  {
    "db_id": "computer_student",
    "question": "What courses are being taught by professors who have a position?",
    "evidence": "",
    "SQL": "SELECT course.course_id, course.courseLevel, person.p_id FROM course AS course INNER JOIN taughtBy AS taughtBy ON course.course_id = taughtBy.course_id INNER JOIN person AS person ON taughtBy.p_id = person.p_id WHERE person.hasPosition = 'Yes'"
  },
  {
    "db_id": "computer_student",
    "question": "List the course IDs of all courses taught by professors who advise more than one student.",
    "evidence": "",
    "SQL": "SELECT course_id FROM taughtBy WHERE p_id IN (SELECT p_id FROM advisedBy GROUP BY p_id HAVING COUNT(p_id_dummy) > 1)"
  },
  {
    "db_id": "computer_student",
    "question": "What are the advisors who teach Level_400 courses?",
    "evidence": "",
    "SQL": "SELECT p_id_dummy FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN taughtBy AS T3 ON T2.p_id = T3.p_id WHERE T3.course_id IN (SELECT course_id FROM course WHERE courseLevel = 'Level_400')"
  },
  {
    "db_id": "computer_student",
    "question": "What courses are taught by professors who have more than 10 years of experience in the program?",
    "evidence": "",
    "SQL": "SELECT T1.course_id FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.yearsInProgram LIKE '%_10%'"
  },
  {
    "db_id": "computer_student",
    "question": "What courses are taught by professors?",
    "evidence": "",
    "SQL": "SELECT DISTINCT T1.course_id, T1.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T2.p_id IN (SELECT p_id FROM person WHERE professor = 1)"
  },
  {
    "db_id": "computer_student",
    "question": "What is the number of students taught by a professor who has taught Level_400 course?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T2.course_id WHERE T1.student = 1 AND T3.courseLevel = 'Level_400'"
  },
  {
    "db_id": "computer_student",
    "question": "What are the levels of courses taught by the advisor of student ID 10?",
    "evidence": "",
    "SQL": "SELECT T2.courseLevel FROM advisedBy AS T1 INNER JOIN course AS T2 ON T1.p_id = T2.course_id INNER JOIN taughtBy AS T3 ON T2.course_id = T3.course_id WHERE T1.p_id_dummy = 10"
  },
  {
    "db_id": "computer_student",
    "question": "What are all the courses taught by a student?",
    "evidence": "",
    "SQL": "SELECT DISTINCT T1.course_id FROM taughtBy AS T1 WHERE T1.p_id IN (SELECT T2.p_id FROM person AS T2 WHERE T2.student = 1)"
  },
  {
    "db_id": "computer_student",
    "question": "Who taught the most courses?",
    "evidence": "",
    "SQL": "SELECT p_id FROM taughtBy GROUP BY p_id ORDER BY COUNT(course_id) DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the position of the professor who taught the most courses in the 2nd year?",
    "evidence": "",
    "SQL": "SELECT T1.p_id, T1.hasPosition FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T3.courseLevel = '2nd' GROUP BY T1.p_id ORDER BY COUNT(T2.course_id) DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the name of the first person in the 'person' table?",
    "evidence": "",
    "SQL": "SELECT hasPosition FROM person LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "Which professor has taught the most courses?",
    "evidence": "",
    "SQL": "SELECT p_id FROM taughtBy GROUP BY p_id ORDER BY COUNT(*) DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the course ID of the highest level undergraduate course?",
    "evidence": "",
    "SQL": "SELECT course_id FROM course WHERE courseLevel = 'Level_400'"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses taught by professors who have more than 5 years of experience in the program?",
    "evidence": "",
    "SQL": "SELECT course_id FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.yearsInProgram > 5"
  },
  {
    "db_id": "computer_student",
    "question": "What is the course ID of the course taught by the professor with the highest number of students?",
    "evidence": "",
    "SQL": "SELECT course_id FROM taughtBy INNER JOIN person ON taughtBy.p_id = person.p_id WHERE person.student = 1 GROUP BY course_id ORDER BY COUNT(person.student) DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What courses are taught by advisors of students who have at least 3 years of program?",
    "evidence": "",
    "SQL": "SELECT T1.course_id, T1.courseLevel FROM course AS T1 JOIN taughtBy AS T2 ON T1.course_id = T2.course_id JOIN advisedBy AS T3 ON T2.p_id = T3.p_id_dummy JOIN person AS T4 ON T3.p_id = T4.p_id WHERE T4.yearsInProgram LIKE '%3%'"
  },
  {
    "db_id": "computer_student",
    "question": "Who are the students who are being advised by a professor who teaches a course that is in a higher level than the student's current course level?",
    "evidence": "",
    "SQL": "SELECT DISTINCT p1.student FROM person AS p1 INNER JOIN advisedBy AS T2 ON p1.p_id = T2.p_id_dummy INNER JOIN taughtBy AS T3 ON T2.p_id = T3.p_id INNER JOIN course AS T4 ON T3.course_id = T4.course_id WHERE p1.inPhase = 1 AND T4.courseLevel = 'higher level than p1.yearInProgram'"
  },
  {
    "db_id": "computer_student",
    "question": "List down all the professors who teach courses with more than 2 students.",
    "evidence": "",
    "SQL": "SELECT p_id FROM taughtBy JOIN (SELECT course_id, COUNT(p_id) as student_count FROM taughtBy GROUP BY course_id HAVING COUNT(p_id) > 2) AS T2 ON taughtBy.course_id = T2.course_id"
  },
  {
    "db_id": "computer_student",
    "question": "Who has been advising the most students across all courses?",
    "evidence": "",
    "SQL": "SELECT P.p_id FROM person P INNER JOIN advisedBy A ON P.p_id = A.p_id GROUP BY P.p_id ORDER BY COUNT(A.p_id) DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "List the IDs of all professors who advised more than 2 students.",
    "evidence": "",
    "SQL": "SELECT p_id FROM person WHERE p_id IN (SELECT p_id FROM advisedBy GROUP BY p_id HAVING COUNT(p_id_dummy) > 2)"
  },
  {
    "db_id": "computer_student",
    "question": "Which professors teach courses with more than 1 course level?",
    "evidence": "",
    "SQL": "SELECT p_id, courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id GROUP BY T2.p_id HAVING COUNT(DISTINCT T1.courseLevel) > 1"
  },
  {
    "db_id": "computer_student",
    "question": "What undergraduate courses are being taught by professors who are also advising students?",
    "evidence": "",
    "SQL": "SELECT course.course_id, course.courseLevel FROM course INNER JOIN taughtBy ON course.course_id = taughtBy.course_id INNER JOIN person ON taughtBy.p_id = person.p_id WHERE person.hasPosition = 'professor' AND person.hasPosition IS NOT NULL"
  },
  {
    "db_id": "computer_student",
    "question": "What is the course ID of the master course taught by the person with ID 101?",
    "evidence": "",
    "SQL": "SELECT T1.course_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T2.p_id = T3.p_id WHERE T3.p_id = 101 AND T1.courseLevel = 'Level_500'"
  },
  {
    "db_id": "computer_student",
    "question": "Which students are currently in the master/graduate program?",
    "evidence": "",
    "SQL": "SELECT p_id FROM person WHERE inPhase='master/graduate'"
  },
  {
    "db_id": "computer_student",
    "question": "What courses are taught by professors who have advised more than one student?",
    "evidence": "",
    "SQL": "SELECT course_id, p_id FROM taughtBy WHERE p_id IN (SELECT p_id FROM advisedBy GROUP BY p_id HAVING COUNT(p_id_dummy) > 1)"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses taught by the professor who advises the most students?",
    "evidence": "",
    "SQL": "SELECT T1.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id GROUP BY T1.course_id ORDER BY (SELECT COUNT(*) FROM advisedBy AS T3 WHERE T3.p_id = T2.p_id) DESC"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses taught by faculty members?",
    "evidence": "",
    "SQL": "SELECT T1.course_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T2.p_id IN (SELECT p_id FROM person WHERE professor = 1)"
  },
  {
    "db_id": "computer_student",
    "question": "What are the names of the professors who teach only high-level or harder undergraduate courses?",
    "evidence": "",
    "SQL": "SELECT DISTINCT T1.p_id FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T2.course_id WHERE T1.hasPosition = 'Faculty_eme' AND T3.courseLevel = 'Level_400'"
  },
  {
    "db_id": "computer_student",
    "question": "What courses are taught by professors who are not advisors of anyone?",
    "evidence": "",
    "SQL": "SELECT T1.course_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id LEFT JOIN advisedBy AS T3 ON T2.p_id = T3.p_id WHERE T3.p_id IS NULL"
  },
  {
    "db_id": "computer_student",
    "question": "What courses are being taught by professors who advised students for at least two years?",
    "evidence": "",
    "SQL": "SELECT T1.course_id, T2.p_id FROM taughtBy AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id GROUP BY T1.course_id, T2.p_id HAVING COUNT(T2.p_id_dummy) >= 2"
  },
  {
    "db_id": "computer_student",
    "question": "What are all courses taught by Professor Who is in year 1?",
    "evidence": "",
    "SQL": "SELECT T1.course_id, T1.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T2.p_id IN (SELECT p_id FROM person WHERE yearsInProgram = 'Year_1') AND T1.courseLevel NOT LIKE 'Level_999'"
  },
  {
    "db_id": "computer_student",
    "question": "How many students have not been advised by anyone?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person WHERE p_id NOT IN (SELECT p_id FROM advisedBy)"
  },
  {
    "db_id": "computer_student",
    "question": "Which professors have advised more than one student?",
    "evidence": "",
    "SQL": "SELECT p_id FROM advisedBy GROUP BY p_id HAVING COUNT(p_id_dummy) > 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of students who are advised by professors teaching the 'Level_400' courses?",
    "evidence": "",
    "SQL": "SELECT COUNT(student) FROM person AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id INNER JOIN taughtBy AS T3 ON T2.p_id = T3.p_id INNER JOIN course AS T4 ON T3.course_id = T4.course_id WHERE T4.courseLevel = 'Level_400'"
  },
  {
    "db_id": "computer_student",
    "question": "Which students have advisors who teach more than one course?",
    "evidence": "",
    "SQL": "SELECT P1.p_id FROM person AS P1 INNER JOIN advisedBy AS AB ON P1.p_id = AB.p_id_dummy INNER JOIN taughtBy AS T ON AB.p_id = T.p_id GROUP BY P1.p_id HAVING COUNT(T.course_id) > 1"
  },
  {
    "db_id": "computer_student",
    "question": "Which professor teaches at least two courses?",
    "evidence": "",
    "SQL": "SELECT p_id, COUNT(*) AS course_count FROM taughtBy GROUP BY p_id HAVING COUNT(*) >= 2"
  },
  {
    "db_id": "computer_student",
    "question": "What is the average number of years in program that a student is advised by a professor teaching undergraduate courses with level of less than 10?",
    "evidence": "",
    "SQL": "SELECT AVG(T1.yearsInProgram) FROM person AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id INNER JOIN taughtBy AS T3 ON T2.p_id = T3.p_id INNER JOIN course AS T4 ON T3.course_id = T4.course_id WHERE T4.courseLevel = 'Level_400' AND T4.course_id < 10"
  },
  {
    "db_id": "computer_student",
    "question": "Which professors teach the highest number of courses that are labeled as 'basic' or 'medium' courses for undergraduate students?",
    "evidence": "",
    "SQL": "SELECT T2.p_id, COUNT(T2.course_id) AS num_courses FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T1.courseLevel IN ('Level_100', 'Level_200') GROUP BY T2.p_id ORDER BY num_courses DESC"
  },
  {
    "db_id": "computer_student",
    "question": "What are all the courses that are taught by a professor in the 'Level_400'?",
    "evidence": "",
    "SQL": "SELECT T1.course_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T2.p_id = T3.p_id WHERE T3.professor = 1 AND T1.courseLevel = 'Level_400'"
  },
  {
    "db_id": "computer_student",
    "question": "Provide the IDs and course levels of all courses taught by the professors who advised the student with ID 305.",
    "evidence": "",
    "SQL": "SELECT T3.course_id, T3.courseLevel FROM course AS T3 INNER JOIN taughtBy AS T2 ON T3.course_id = T2.course_id INNER JOIN advisedBy AS T1 ON T2.p_id = T1.p_id WHERE T1.p_id_dummy = 305"
  },
  {
    "db_id": "computer_student",
    "question": "What is the list of course IDs taught by professors in Year_1?",
    "evidence": "",
    "SQL": "SELECT course_id FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.yearsInProgram = 'Year_1'"
  },
  {
    "db_id": "computer_student",
    "question": "Which professor has advised the most students?",
    "evidence": "",
    "SQL": "SELECT p_id FROM advisedBy GROUP BY p_id ORDER BY COUNT(p_id) DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What are the IDs of all students who are advised by a professor who teaches a course at the master's level?",
    "evidence": "",
    "SQL": "SELECT T2.p_id FROM person AS T2 INNER JOIN advisedBy AS T1 ON T2.p_id = T1.p_id_dummy INNER JOIN taughtBy AS T3 ON T1.p_id_dummy = T3.p_id INNER JOIN course AS T4 ON T3.course_id = T4.course_id WHERE T4.courseLevel = 'Level_500'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the list of students who have advisors?",
    "evidence": "",
    "SQL": "SELECT p_id FROM person WHERE student = 1 AND hasPosition = 'Student'"
  },
  {
    "db_id": "computer_student",
    "question": "What courses are taught by the professors who have more than one student in their course?",
    "evidence": "",
    "SQL": "SELECT T1.course_id FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id GROUP BY T1.course_id HAVING COUNT(T2.p_id) > 1"
  },
  {
    "db_id": "computer_student",
    "question": "List the ID of professors that teach both basic and medium undergraduate courses.",
    "evidence": "",
    "SQL": "SELECT DISTINCT T1.p_id FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T2.course_id WHERE T3.courseLevel IN ('Level_200', 'Level_300') GROUP BY T1.p_id HAVING COUNT(DISTINCT T3.courseLevel) > 1"
  },
  {
    "db_id": "computer_student",
    "question": "How many courses are taught by a professor who has been in the program for more than two years?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T2.p_id = T3.p_id WHERE T3.inPhase = 'After_Renewal' AND T3.yearsInProgram > 2"
  },
  {
    "db_id": "computer_student",
    "question": "How many courses are not taught by professors with a position 'Instructor'",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM course WHERE course_id NOT IN (SELECT course_id FROM taughtBy WHERE p_id IN (SELECT p_id FROM person WHERE hasPosition = 'Instructor'))"
  },
  {
    "db_id": "computer_student",
    "question": "What are the names of all professors who are teaching a course?",
    "evidence": "",
    "SQL": "SELECT T1.p_id, T2.course_id FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id WHERE T1.hasPosition = 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the average number of students per professor?",
    "evidence": "",
    "SQL": "SELECT AVG(CASE WHEN student = 1 THEN 1 ELSE 0 END) / AVG(CASE WHEN professor = 1 THEN 1 ELSE 0 END) AS avg_students_per_prof FROM person"
  },
  {
    "db_id": "computer_student",
    "question": "Which professors advise most students? Give the professor's ID, name and the number of students they advise.",
    "evidence": "",
    "SQL": "SELECT T1.p_id, 'professor' as position, COUNT(T2.p_id_dummy) as adviseCount FROM person AS T1 LEFT JOIN advisedBy AS T2 ON T1.p_id = T2.p_id AND T1.hasPosition = 'professor' GROUP BY T1.p_id, position ORDER BY adviseCount DESC"
  },
  {
    "db_id": "computer_student",
    "question": "What is the list of courses taught by professors with a hasPosition of 'full-time'?",
    "evidence": "",
    "SQL": "SELECT T1.course_id, T2.hasPosition FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.hasPosition = 'full-time'"
  },
  {
    "db_id": "computer_student",
    "question": "For the courses taught by faculty members who have at least 5 years of experience in the program, what percentage of them are basic or medium undergraduate courses?",
    "evidence": "",
    "SQL": "SELECT ROUND(100 * COUNT(*) / (SELECT COUNT(*) FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T2.p_id IN (SELECT p_id FROM person WHERE yearsInProgram = '5')), 2) AS percentage FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T2.p_id = T3.p_id WHERE T3.hasPosition = 'professor' AND yearsInProgram = '5' AND T1.courseLevel IN ('Level_100', 'Level_300')"
  },
  {
    "db_id": "computer_student",
    "question": "Which course is taught by most number of professors?",
    "evidence": "",
    "SQL": "SELECT T1.course_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id GROUP BY T1.course_id ORDER BY COUNT(T2.p_id) DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the name of the course that was taught by professor who has 10 years of experience in the program?",
    "evidence": "",
    "SQL": "SELECT courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T2.p_id = T3.p_id WHERE T3.inPhase='PhD' AND yearsInProgram='10'"
  },
  {
    "db_id": "computer_student",
    "question": "What are the professors who are teaching both basic and medium undergraduate courses?",
    "evidence": "",
    "SQL": "SELECT p_id FROM person WHERE professor = 1 AND p_id IN (SELECT p_id FROM taughtBy WHERE course_id IN (SELECT course_id FROM course WHERE courseLevel = 'Level_300'))"
  },
  {
    "db_id": "computer_student",
    "question": "List the names of students who have advisors with a tenure track.",
    "evidence": "",
    "SQL": "SELECT T1.p_id, T2.hasPosition FROM person AS T1 INNER JOIN advisedBy AS T3 ON T1.p_id = T3.p_id_dummy INNER JOIN person AS T2 ON T3.p_id = T2.p_id WHERE T2.hasPosition LIKE '%tenure%'"
  },
  {
    "db_id": "computer_student",
    "question": "Which students have the highest number of advisors and what are the years they have been in the program?",
    "evidence": "",
    "SQL": "SELECT T2.yearsInProgram, COUNT(T1.p_id_dummy) AS numAdvisors FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.student = 1 GROUP BY T2.yearsInProgram ORDER BY numAdvisors DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What level is course 127 taught by which professors?",
    "evidence": "",
    "SQL": "SELECT T1.courseLevel, T2.p_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T1.course_id = 127"
  },
  {
    "db_id": "computer_student",
    "question": "What are the IDs of courses that have more than one professor teaching?",
    "evidence": "",
    "SQL": "SELECT course_id FROM course WHERE course_id IN (SELECT course_id FROM taughtBy GROUP BY course_id HAVING COUNT(p_id) > 1)"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of students of the professors who have been teaching a course?",
    "evidence": "",
    "SQL": "SELECT COUNT(DISTINCT person.p_id) FROM taughtBy, person WHERE person.p_id = taughtBy.p_id"
  },
  {
    "db_id": "computer_student",
    "question": "Which students are advised by professors who teach course ID 14?",
    "evidence": "",
    "SQL": "SELECT DISTINCT T2.p_id FROM person AS T2 INNER JOIN advisedBy AS T1 ON T2.p_id = T1.p_id_dummy INNER JOIN taughtBy AS T3 ON T1.p_id = T3.p_id WHERE T3.course_id = 14"
  },
  {
    "db_id": "computer_student",
    "question": "Which professors have advised students in a phase other than 'inPhase'?",
    "evidence": "",
    "SQL": "SELECT T1.p_id_dummy FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id_dummy = T2.p_id WHERE T2.inPhase != 'inPhase'"
  },
  {
    "db_id": "computer_student",
    "question": "Which students are advised by a professor who has been in the program for more than 5 years?",
    "evidence": "",
    "SQL": "SELECT p.student FROM person AS p INNER JOIN advisedBy AS a ON p.p_id = a.p_id INNER JOIN person AS t ON a.p_id_dummy = t.p_id WHERE t.yearsInProgram > 5"
  },
  {
    "db_id": "computer_student",
    "question": "Which professors advise more than one student?",
    "evidence": "",
    "SQL": "SELECT T1.p_id, T1.inPhase, T1.hasPosition FROM person AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id_dummy WHERE T2.p_id = T1.p_id GROUP BY T1.p_id HAVING COUNT(T2.p_id) > 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the ratio of professors who teach course 165 to students in that course?",
    "evidence": "",
    "SQL": "SELECT CAST(SUM(CASE WHEN T1.courseLevel = '165' THEN 1 ELSE 0 END) AS REAL) * 100 / (SELECT COUNT(*) FROM person WHERE student = 1 AND p_id IN (SELECT p_id FROM taughtBy WHERE course_id = 165)) AS ratio FROM course AS T1 WHERE T1.course_id = 165"
  },
  {
    "db_id": "computer_student",
    "question": "What are the names of the courses taught by Professor 401?",
    "evidence": "",
    "SQL": "SELECT course.course_id, course.courseLevel, course.course_id FROM course, taughtBy WHERE taughtBy.p_id = 401 AND course.course_id = taughtBy.course_id"
  },
  {
    "db_id": "computer_student",
    "question": "What is the list of courses taught by faculty members who have worked as advisors for more than 3 years?",
    "evidence": "",
    "SQL": "SELECT C.course_id, C.courseLevel FROM course C INNER JOIN taughtBy T ON C.course_id = T.course_id INNER JOIN person P ON P.p_id = T.p_id WHERE P.inPhase = 'Phase_300' AND P.yearsInProgram > 3 GROUP BY C.course_id, C.courseLevel"
  },
  {
    "db_id": "computer_student",
    "question": "What is the average number of years in a program for students who are in Phase 2?",
    "evidence": "",
    "SQL": "SELECT AVG(yearsInProgram) FROM person WHERE inPhase = 'Phase_2'"
  },
  {
    "db_id": "computer_student",
    "question": "What professor is advising students with both a `student` and a `hasPosition` of 'Ph.D. candidate'?",
    "evidence": "",
    "SQL": "SELECT distinct p_id FROM person as P where P.student = 1 and P.hasPosition = 'Ph.D. candidate'"
  },
  {
    "db_id": "computer_student",
    "question": "What are the IDs of professors who teach only undergraduate courses?",
    "evidence": "",
    "SQL": "SELECT T2.p_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T3.p_id = T2.p_id WHERE T1.courseLevel = 'Undergraduate' AND T3.professor = 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the course level of course ID 123?",
    "evidence": "",
    "SQL": "SELECT courseLevel FROM course WHERE course_id = 123"
  },
  {
    "db_id": "computer_student",
    "question": "What is the general level of the course taught by the professor who has the most advised students?",
    "evidence": "",
    "SQL": "SELECT course.courseLevel FROM course INNER JOIN taughtBy ON course.course_id = taughtBy.course_id INNER JOIN person ON taughtBy.p_id = person.p_id GROUP BY course.course_id ORDER BY (SELECT COUNT(*) FROM advisedBy WHERE advisedBy.p_id = person.p_id) DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses that are taught by professors who have advised students with ID in the range of 300 to 400?",
    "evidence": "",
    "SQL": "SELECT DISTINCT T3.course_id FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN taughtBy AS T3 ON T2.p_id = T3.p_id WHERE T1.p_id BETWEEN 300 AND 400"
  },
  {
    "db_id": "computer_student",
    "question": "What are the IDs of the students who are in the same phase of their undergraduate program?",
    "evidence": "",
    "SQL": "SELECT p_id FROM person WHERE inPhase IS NOT NULL GROUP BY inPhase HAVING COUNT(p_id) > 1"
  },
  {
    "db_id": "computer_student",
    "question": "List the professors who taught more than two high-level or harder undergraduate courses.",
    "evidence": "",
    "SQL": "SELECT DISTINCT T2.p_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T1.courseLevel = 'Level_400' GROUP BY T2.p_id HAVING COUNT(T1.course_id) > 2"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses taught by professors who are in the 5th year of their program?",
    "evidence": "",
    "SQL": "SELECT course.course_id FROM course INNER JOIN taughtBy ON course.course_id = taughtBy.course_id INNER JOIN person ON taughtBy.p_id = person.p_id WHERE person.yearsInProgram = 'Year_5'"
  },
  {
    "db_id": "computer_student",
    "question": "How many students are advised by more than one professor?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person WHERE p_id IN (SELECT p_id_dummy FROM advisedBy GROUP BY p_id_dummy HAVING COUNT(p_id) > 1)"
  },
  {
    "db_id": "computer_student",
    "question": "List the courses taught by professors who have the position of professor.",
    "evidence": "",
    "SQL": "SELECT T2.course_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T2.p_id IN (SELECT p_id FROM person WHERE hasPosition = 'Professor')"
  },
  {
    "db_id": "computer_student",
    "question": "Which advisor advises the most students?",
    "evidence": "",
    "SQL": "SELECT p_id_dummy, COUNT(p_id) FROM advisedBy GROUP BY p_id_dummy ORDER BY COUNT(p_id) DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of students enrolled in a course taught by a faculty member?",
    "evidence": "",
    "SQL": "SELECT COUNT(DISTINCT T2.p_id) FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id WHERE T1.professor = 1 AND T1.hasPosition = 'Faculty_member'"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses taught by professors who have been in the program for more than 3 years?",
    "evidence": "",
    "SQL": "SELECT DISTINCT course_id FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.yearsInProgram > 3"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of students in the program?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person WHERE student = 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the number of students who are advised by a professor who teaches a course with the courseLevel 'Level_200'?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id_dummy INNER JOIN taughtBy AS T3 ON T3.p_id = T1.professor INNER JOIN course AS T4 ON T3.course_id = T4.course_id WHERE T4.courseLevel = 'Level_200'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the average number of years a faculty employee has spent in the program?",
    "evidence": "",
    "SQL": "SELECT AVG( yearsInProgram ) FROM person WHERE hasPosition = 'Faculty_eme'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the course ID of a course that has at least 2 teachers?",
    "evidence": "",
    "SQL": "SELECT course_id FROM taughtBy GROUP BY course_id HAVING COUNT(course_id) > 1"
  },
  {
    "db_id": "computer_student",
    "question": "What students are taking a course taught by professor with ID 200?",
    "evidence": "",
    "SQL": "SELECT p_id FROM person AS T1 WHERE p_id IN (SELECT student FROM person AS T2 WHERE hasPosition = 'student') AND p_id IN (SELECT p_id FROM taughtBy AS T3 WHERE p_id IN (SELECT p_id FROM person WHERE professor = 200) AND course_id IN (SELECT course_id FROM course))"
  },
  {
    "db_id": "computer_student",
    "question": "Which student is advised by a professor who teaches an undergraduate course of level 'Level_300'?",
    "evidence": "",
    "SQL": "SELECT P1.p_id FROM person AS P1 INNER JOIN advisedBy AS T1 ON P1.p_id = T1.p_id_dummy INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS C ON T2.course_id = C.course_id WHERE C.courseLevel = 'Level_300'"
  },
  {
    "db_id": "computer_student",
    "question": "Who is the professor with the highest number of students?",
    "evidence": "",
    "SQL": "SELECT p_id, COUNT(*) FROM person WHERE professor = 1 GROUP BY p_id ORDER BY COUNT(*) DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What are the professors who taught the most courses?",
    "evidence": "",
    "SQL": "SELECT p_id FROM taughtBy GROUP BY p_id ORDER BY COUNT(course_id) DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "List the students who are under advisor 415 and have been in the program for more than 3 years.",
    "evidence": "",
    "SQL": "SELECT DISTINCT T1.p_id FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.yearsInProgram > '3' AND T1.p_id_dummy = 415"
  },
  {
    "db_id": "computer_student",
    "question": "What are the levels of courses taught by a professor who has more than 2 students?",
    "evidence": "",
    "SQL": "SELECT courseLevel FROM course INNER JOIN taughtBy ON course.course_id = taughtBy.course_id WHERE taughtBy.p_id IN (SELECT p_id FROM person WHERE student > 2)"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses taught by professors who have more than 5 years of experience?",
    "evidence": "",
    "SQL": "SELECT T3.course_id FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T1.inPhase = 'Phase_500' AND T1.yearsInProgram > 5"
  },
  {
    "db_id": "computer_student",
    "question": "What courses are taught by the professor who has advised the most students?",
    "evidence": "",
    "SQL": "SELECT T2.course_id FROM taughtBy AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id INNER JOIN advisedBy AS T3 ON T3.p_id = T1.p_id GROUP BY T2.course_id ORDER BY COUNT(T3.p_id) DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What are the names of professors who teach 'Level_300' courses?",
    "evidence": "",
    "SQL": "SELECT p.hasPosition FROM person p JOIN taughtBy t ON p.p_id = t.p_id JOIN course c ON t.course_id = c.course_id WHERE c.courseLevel = 'Level_300'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the list of courses taught by professors who are also advisors?",
    "evidence": "",
    "SQL": "SELECT course.course_id, course.courseLevel FROM course INNER JOIN taughtBy ON course.course_id = taughtBy.course_id INNER JOIN person ON taughtBy.p_id = person.p_id WHERE person.professor = 1"
  },
  {
    "db_id": "computer_student",
    "question": "Who is advising more than one student?",
    "evidence": "",
    "SQL": "SELECT p_id, COUNT(*) as count FROM advisedBy GROUP BY p_id HAVING COUNT(*) > 1"
  },
  {
    "db_id": "computer_student",
    "question": "Which students have been advised by a professor who teaches a course with level Level_500?",
    "evidence": "",
    "SQL": "SELECT T1.p_id FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN taughtBy AS T3 ON T2.p_id = T3.p_id AND T3.course_id IN (SELECT course_id FROM course WHERE courseLevel = 'Level_500') GROUP BY T1.p_id"
  },
  {
    "db_id": "computer_student",
    "question": "How many professors are teaching courses at level 400?",
    "evidence": "",
    "SQL": "SELECT COUNT(DISTINCT p_id) FROM taughtBy INNER JOIN course ON taughtBy.course_id = course.course_id WHERE course.courseLevel = 'Level_400'"
  },
  {
    "db_id": "computer_student",
    "question": "Which professors taught more than one basic undergraduate course?",
    "evidence": "",
    "SQL": "SELECT p_id FROM person WHERE p_id IN (SELECT p_id FROM taughtBy WHERE course_id IN (SELECT course_id FROM course WHERE courseLevel = 'Level_300') GROUP BY p_id HAVING COUNT(DISTINCT course_id) > 1)"
  },
  {
    "db_id": "computer_student",
    "question": "What are the names of all students who are not advised by their professor?",
    "evidence": "",
    "SQL": "SELECT DISTINCT T1.p_id, T1.inPhase FROM person AS T1 LEFT JOIN advisedBy AS T2 ON T1.p_id = T2.p_id_dummy WHERE T2.p_id_dummy IS NULL AND T1.student = 1"
  },
  {
    "db_id": "computer_student",
    "question": "Which students have their advisors from the 'Faculty of Computer Science'?",
    "evidence": "",
    "SQL": "SELECT T1.p_id_dummy FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN person AS T3 ON T2.p_id = T3.p_id WHERE T3.hasPosition = 'Faculty of Computer Science'"
  },
  {
    "db_id": "computer_student",
    "question": "What course levels are taught by professors who also teach courses for Level_400 students?",
    "evidence": "",
    "SQL": "SELECT distinct courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE EXISTS (SELECT 1 FROM course AS T3 INNER JOIN taughtBy AS T4 ON T3.course_id = T4.course_id WHERE T3.courseLevel = 'Level_400' AND T2.p_id = T4.p_id)"
  },
  {
    "db_id": "computer_student",
    "question": "Find the list of courses that are taught by a professor who has more than 3 students.",
    "evidence": "",
    "SQL": "SELECT T1.course_id FROM taughtBy AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id GROUP BY T1.course_id HAVING COUNT(T2.p_id_dummy) > 3"
  },
  {
    "db_id": "computer_student",
    "question": "What courses are taught by the professors who advise more than two students?",
    "evidence": "",
    "SQL": "SELECT DISTINCT T1.course_id, T1.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T3.p_id = T2.p_id INNER JOIN advisedBy AS T4 ON T3.p_id = T4.p_id GROUP BY T1.course_id, T1.courseLevel HAVING COUNT(T4.p_id) > 2"
  },
  {
    "db_id": "computer_student",
    "question": "What is the number of courses that have a professor from the department of Computer Science?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM taughtBy WHERE p_id IN (SELECT p_id FROM person WHERE hasPosition = 'Computer Science')"
  },
  {
    "db_id": "computer_student",
    "question": "What are the names of all students that are advised by the faculty member who taught course ID 104?",
    "evidence": "",
    "SQL": "SELECT p1.student FROM person AS p1 INNER JOIN advisedBy AS a1 ON p1.p_id = a1.p_id_dummy INNER JOIN taughtBy AS t1 ON a1.p_id = t1.p_id INNER JOIN course AS c1 ON t1.course_id = c1.course_id WHERE c1.course_id = 104 AND p1.student IS NOT NULL"
  },
  {
    "db_id": "computer_student",
    "question": "What is the course ID and level of a course taught by the professor who taught the most courses?",
    "evidence": "",
    "SQL": "SELECT T3.course_id, T3.courseLevel FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T1.course_id GROUP BY T3.course_id, T3.courseLevel ORDER BY COUNT(T1.course_id) DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What are all the courses taught by professors who teach master courses?",
    "evidence": "",
    "SQL": "SELECT T1.course_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T1.courseLevel = 'Level_500'"
  },
  {
    "db_id": "computer_student",
    "question": "Who teaches courses in level 500 and has not taught a course before?",
    "evidence": "",
    "SQL": "SELECT DISTINCT T2.p_id FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T1.course_id IN (SELECT course_id FROM course WHERE courseLevel = 'Level_500') AND T2.p_id NOT IN (SELECT p_id FROM taughtBy)"
  },
  {
    "db_id": "computer_student",
    "question": "What is the number of courses taught by professors who have a 'Faculty_aff' position and are in the 'Post_docs' phase of qualification?",
    "evidence": "",
    "SQL": "SELECT COUNT(T1.course_id) FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.hasPosition = 'Faculty_aff' AND T2.inPhase = 'Post_docs'"
  },
  {
    "db_id": "computer_student",
    "question": "How many students have a professor?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person WHERE professor IS NOT NULL"
  },
  {
    "db_id": "computer_student",
    "question": "What are all the courses taught by a person who advises a student with ID 376?",
    "evidence": "",
    "SQL": "SELECT T3.course_id FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN taughtBy AS T3 ON T2.p_id = T3.p_id WHERE T1.p_id_dummy = 376"
  },
  {
    "db_id": "computer_student",
    "question": "What are the names of courses taught by a professor who has more than 5 years of experience in the program?",
    "evidence": "",
    "SQL": "SELECT C.course_id, C.courseLevel FROM course AS C INNER JOIN taughtBy AS T ON C.course_id = T.course_id INNER JOIN person AS P ON T.p_id = P.p_id WHERE P.yearsInProgram > 5"
  },
  {
    "db_id": "computer_student",
    "question": "What is the course level of the course taught by a professor with at least 2 advised students?",
    "evidence": "",
    "SQL": "SELECT T3.courseLevel FROM taughtBy AS T1 INNER JOIN course AS T3 ON T1.course_id = T3.course_id INNER JOIN person AS T2 ON T1.p_id = T2.p_id GROUP BY T3.course_id, T3.courseLevel HAVING COUNT(T2.p_id) >= 2"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of professors who teach courses with level 'Level_400'?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T1.course_id = T3.course_id WHERE T3.courseLevel = 'Level_400'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of courses taught by all professors?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM taughtBy GROUP BY p_id"
  },
  {
    "db_id": "computer_student",
    "question": "What is the number of students who have a professor with 'Software Engineering' as a position?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id INNER JOIN person AS T3 ON T2.p_id_dummy = T3.p_id WHERE T3.hasPosition = 'Software Engineering'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the name of the students in the program that is taught by professor no.93?",
    "evidence": "",
    "SQL": "SELECT p_id_dummy AS 'Student' FROM person AS T1 LEFT JOIN advisedBy AS T2 ON T1.p_id = T2.p_id_dummy LEFT JOIN taughtBy AS T3 ON T1.p_id = T3.p_id WHERE T3.p_id = 93"
  },
  {
    "db_id": "computer_student",
    "question": "How many students are advised by a professor who has at least 5 years of experience in the program?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.yearsInProgram LIKE '%>_5%'"
  },
  {
    "db_id": "computer_student",
    "question": "What are the names of students who are advised by professors in their first year of program?",
    "evidence": "",
    "SQL": "SELECT P.student FROM person AS P INNER JOIN advisedBy AS T ON P.p_id = T.p_id_dummy INNER JOIN person AS T1 ON T.p_id = T1.p_id WHERE T1.yearsInProgram = 'Year_1'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the number of students who have a professor who teaches a course at Level_400?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id INNER JOIN taughtBy AS T3 ON T2.p_id = T3.p_id INNER JOIN course AS T4 ON T3.course_id = T4.course_id WHERE T4.courseLevel = 'Level_400'"
  },
  {
    "db_id": "computer_student",
    "question": "What are the professors who advised a student with both a student and a professor role?",
    "evidence": "",
    "SQL": "SELECT T1.p_id FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.student AND T2.professor"
  },
  {
    "db_id": "computer_student",
    "question": "Who are the students advised by a faculty professor who taught course ID 100 and the course level is Level_500?",
    "evidence": "",
    "SQL": "SELECT P.p_id, P.yearsInProgram FROM person AS P INNER JOIN advisedBy AS A ON P.p_id = A.p_id INNER JOIN taughtBy AS T ON T.p_id = A.p_id_dummy INNER JOIN course AS C ON T.course_id = C.course_id WHERE C.course_id = 100 AND C.courseLevel = 'Level_500'"
  },
  {
    "db_id": "computer_student",
    "question": "How many students are being advised by professors in 'Level_200' undergraduate courses?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) AS count FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN taughtBy AS T3 ON T3.p_id = T2.p_id INNER JOIN course AS T4 ON T3.course_id = T4.course_id WHERE T4.courseLevel = 'Level_200' AND T2.student = 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the student ID of the student who is being advised by a professor who teaches a Level_300 course?",
    "evidence": "",
    "SQL": "SELECT T1.p_id FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id_dummy = T2.p_id INNER JOIN taughtBy AS T3 ON T2.p_id = T3.p_id INNER JOIN course AS T4 ON T3.course_id = T4.course_id WHERE T4.courseLevel = 'Level_300'"
  },
  {
    "db_id": "computer_student",
    "question": "Who are the students in the computer science phase of the program?",
    "evidence": "",
    "SQL": "SELECT p_id FROM person WHERE inPhase = 'computer science'"
  },
  {
    "db_id": "computer_student",
    "question": "List the IDs of professors who have advised at least one student and have taught at least one course.",
    "evidence": "",
    "SQL": "SELECT p_id FROM person WHERE p_id IN (SELECT p_id FROM advisedBy UNION SELECT p_id FROM taughtBy) AND (p_id IN (SELECT p_id_dummy FROM advisedBy) OR p_id IN (SELECT p_id FROM taughtBy)) GROUP BY p_id HAVING COUNT(*) >= 1"
  },
  {
    "db_id": "computer_student",
    "question": "How many students are enrolled in a course taught by a professor who also advises a student?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM taughtBy AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id WHERE T2.p_id_dummy IS NOT NULL"
  },
  {
    "db_id": "computer_student",
    "question": "Who are the advisors who advise more than two students?",
    "evidence": "",
    "SQL": "SELECT p_id, p_id_dummy FROM advisedBy GROUP BY p_id_dummy HAVING COUNT(p_id) > 2"
  },
  {
    "db_id": "computer_student",
    "question": "What is the ID of professors who teach in the Level 300 courses?",
    "evidence": "",
    "SQL": "SELECT T2.p_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T1.courseLevel = 'Level_300'"
  },
  {
    "db_id": "computer_student",
    "question": "Which professor(s) teach course ID 233?",
    "evidence": "",
    "SQL": "SELECT DISTINCT T2.p_id FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T1.course_id = 233"
  },
  {
    "db_id": "computer_student",
    "question": "What is the average number of courses taught by professors who also advise students in the 4th year?",
    "evidence": "",
    "SQL": "SELECT AVG(T1.course_id) FROM taughtBy AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id INNER JOIN person AS T3 ON T2.p_id = T3.p_id WHERE T3.yearsInProgram = 'Year_4'"
  },
  {
    "db_id": "computer_student",
    "question": "What courses is Professor 202 teaching?",
    "evidence": "",
    "SQL": "SELECT course.course_id, course.courseLevel FROM course INNER JOIN taughtBy ON course.course_id = taughtBy.course_id WHERE taughtBy.p_id = 202"
  },
  {
    "db_id": "computer_student",
    "question": "What is the ID of the student who is in the 12th year of program and was taught by a professor who is also in the 12th year of program?",
    "evidence": "",
    "SQL": "SELECT p_id FROM person WHERE inPhase = 'Year_12' AND (SELECT COUNT(*) FROM advisedBy WHERE p_id = person.p_id) > 0"
  },
  {
    "db_id": "computer_student",
    "question": "What are the IDs of students who are in the third phase of the program and have been advised by a professor?",
    "evidence": "",
    "SQL": "SELECT T1.p_id FROM person AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id_dummy WHERE T1.inPhase = 'Phase_3'"
  },
  {
    "db_id": "computer_student",
    "question": "How many courses are taught by at least one professor who is in Phase 2?",
    "evidence": "",
    "SQL": "SELECT COUNT(DISTINCT T1.course_id) FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.inPhase = 'Phase_2'"
  },
  {
    "db_id": "computer_student",
    "question": "List the IDs of all students who take a course that has been taught by at least two professors.",
    "evidence": "",
    "SQL": "SELECT T3.p_id FROM taughtBy AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id AND T1.p_id != T2.p_id INNER JOIN person AS T3 ON T3.p_id = T1.p_id GROUP BY T3.p_id HAVING COUNT(T1.p_id) > 1"
  },
  {
    "db_id": "computer_student",
    "question": "What course is taught by the professor with the most advisors?",
    "evidence": "",
    "SQL": "SELECT C.courseLevel, COUNT(T2.p_id) AS num_advisors, T2.p_id FROM course AS C INNER JOIN taughtBy AS T1 ON C.course_id = T1.course_id INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN advisedBy AS T3 ON T2.p_id = T3.p_id GROUP BY C.course_id, T2.p_id ORDER BY num_advisors DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the number of students who have been in the program for more than 2 years and are not under advisor 415?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person WHERE yearsInProgram > '2' AND NOT EXISTS (SELECT 1 FROM advisedBy WHERE p_id_dummy = 415 AND p_id = person.p_id)"
  },
  {
    "db_id": "computer_student",
    "question": "Which students have advisors with a professor's position?",
    "evidence": "",
    "SQL": "SELECT p_id, hasPosition FROM person AS P WHERE P.hasPosition LIKE '%Professor%' AND P.student = 1"
  },
  {
    "db_id": "computer_student",
    "question": "How many students in total are advised by professors with a position as a graduate?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id WHERE T1.hasPosition = 'Graduate'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the course with the most number of students enrolled in it? Identify the course number?",
    "evidence": "",
    "SQL": "SELECT course_id, COUNT(*) FROM taughtBy JOIN person ON taughtBy.p_id = person.p_id GROUP BY course_id ORDER BY COUNT(*) DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What are the IDs of students who were advised by faculty in the first phase of their program?",
    "evidence": "",
    "SQL": "SELECT T1.p_id FROM person AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id_dummy INNER JOIN person AS T3 ON T3.p_id = T2.p_id INNER JOIN course AS T4 ON T4.course_id = (SELECT course_id FROM course WHERE courseLevel = 'Level_100') WHERE T1.student = 1 AND T3.hasPosition = 'Faculty_aff' AND T1.inPhase = 'Phase_1'"
  },
  {
    "db_id": "computer_student",
    "question": "List all professors who have taught a course that has a 'Course Level' of 'Masters'",
    "evidence": "",
    "SQL": "SELECT T1.p_id FROM taughtBy AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T2.courseLevel = 'Masters'"
  },
  {
    "db_id": "computer_student",
    "question": "What are the course IDs for all courses taught by professors with position status in faculty?",
    "evidence": "",
    "SQL": "SELECT course_id FROM taughtBy INNER JOIN person ON taughtBy.p_id = person.p_id WHERE person.hasPosition = 'Faculty'"
  },
  {
    "db_id": "computer_student",
    "question": "What courses are taught by professors who have been teaching for more than 5 years?",
    "evidence": "",
    "SQL": "SELECT course.course_id, course.courseLevel FROM course INNER JOIN taughtBy ON course.course_id = taughtBy.course_id INNER JOIN person ON taughtBy.p_id = person.p_id WHERE person.yearsInProgram > 5"
  },
  {
    "db_id": "computer_student",
    "question": "What is the course level of the course taught by person with ID 3?",
    "evidence": "",
    "SQL": "SELECT courseLevel FROM course INNER JOIN taughtBy ON course.course_id = taughtBy.course_id WHERE taughtBy.p_id = 3"
  },
  {
    "db_id": "computer_student",
    "question": "What is the ID of students advised by at least 2 professors?",
    "evidence": "",
    "SQL": "SELECT T2.p_id FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id GROUP BY T2.p_id HAVING COUNT(T2.p_id) > 1"
  },
  {
    "db_id": "computer_student",
    "question": "What are all the courses taught by professors with less than 3 years of experience?",
    "evidence": "",
    "SQL": "SELECT course.course_id FROM course INNER JOIN taughtBy ON course.course_id = taughtBy.course_id INNER JOIN person ON taughtBy.p_id = person.p_id WHERE person.yearsInProgram < 'Year_3'"
  },
  {
    "db_id": "computer_student",
    "question": "Who are the students of a professor who taught course no.11?",
    "evidence": "",
    "SQL": "SELECT p_id, inPhase, yearsInProgram FROM person WHERE p_id IN (SELECT p_id FROM taughtBy WHERE course_id = 11) AND professor != 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the course ID of the course taught by Professor 25?",
    "evidence": "",
    "SQL": "SELECT course_id FROM taughtBy WHERE p_id = 25"
  },
  {
    "db_id": "computer_student",
    "question": "What courses are taught by professors with more than 3 students?",
    "evidence": "",
    "SQL": "SELECT distinct course.course_id FROM course, taughtBy, person WHERE taughtBy.p_id = person.p_id AND person.hasPosition = 'Professor' GROUP BY course.course_id HAVING COUNT(person.p_id) > 3"
  },
  {
    "db_id": "computer_student",
    "question": "What is the course level of the courses taught by a professor who has been in the program for more than 5 years and has a position?",
    "evidence": "",
    "SQL": "SELECT courseLevel FROM course JOIN taughtBy ON course.course_id = taughtBy.course_id JOIN person ON taughtBy.p_id = person.p_id WHERE person.yearsInProgram > '5' AND person.hasPosition != ''"
  },
  {
    "db_id": "computer_student",
    "question": "What are the course levels of all courses taught by a student and the professor?",
    "evidence": "",
    "SQL": "SELECT T1.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T2.p_id IN (SELECT p_id from person WHERE student = 1) OR T2.p_id IN (SELECT p_id from person WHERE professor = 1)"
  },
  {
    "db_id": "computer_student",
    "question": "How many courses has each professor taught?",
    "evidence": "",
    "SQL": "SELECT P.p_id, COUNT(T.course_id) FROM person AS P INNER JOIN taughtBy AS T ON P.p_id = T.p_id GROUP BY P.p_id"
  },
  {
    "db_id": "computer_student",
    "question": "Which courses were taught by at least two professors?",
    "evidence": "",
    "SQL": "SELECT DISTINCT T2.course_id FROM taughtBy AS T2 GROUP BY T2.course_id HAVING COUNT(DISTINCT T2.p_id) >= 2"
  },
  {
    "db_id": "computer_student",
    "question": "Which students are advised by professors who taught high-level undergraduate courses?",
    "evidence": "",
    "SQL": "SELECT T2.student FROM person AS T2 INNER JOIN advisedBy AS T1 ON T2.p_id = T1.p_id_dummy INNER JOIN taughtBy AS T3 ON T1.p_id = T3.p_id INNER JOIN course AS T4 ON T3.course_id = T4.course_id WHERE T4.courseLevel = 'Level_400'"
  },
  {
    "db_id": "computer_student",
    "question": "What professors are teaching a course at the 'Faculty_aff' level?",
    "evidence": "",
    "SQL": "SELECT T1.p_id FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T2.course_id WHERE T3.courseLevel = 'Faculty_aff'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the number of students in a course taught by the professor who is also the advisor of a student?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN advisedBy AS T3 ON T2.p_id = T3.p_id_dummy GROUP BY T1.course_id HAVING COUNT(DISTINCT T3.p_id_dummy) > 0"
  },
  {
    "db_id": "computer_student",
    "question": "What are the names of students who are advised by a professor who has taught a course of 'Level_300' or higher?",
    "evidence": "",
    "SQL": "SELECT * FROM person AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id INNER JOIN taughtBy AS T3 ON T2.p_id = T3.p_id INNER JOIN course AS T4 ON T3.course_id = T4.course_id WHERE T4.courseLevel = 'Level_300'"
  },
  {
    "db_id": "computer_student",
    "question": "How many students are enrolled in the \"Level_400\" courses?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T2.p_id = T3.p_id WHERE T3.student = 1 AND T1.courseLevel = 'Level_400'"
  },
  {
    "db_id": "computer_student",
    "question": "Which professors have taught courses with a level above 200?",
    "evidence": "",
    "SQL": "SELECT DISTINCT T1.p_id FROM taughtBy AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T2.courseLevel > 200"
  },
  {
    "db_id": "computer_student",
    "question": "Who are the professors who taught more than one course?",
    "evidence": "",
    "SQL": "SELECT DISTINCT p_id FROM taughtBy GROUP BY p_id HAVING COUNT(DISTINCT course_id) > 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the list of courses taught by a professor who has advised more than 3 students?",
    "evidence": "",
    "SQL": "SELECT T1.course_id FROM taughtBy AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id_dummy GROUP BY T1.course_id HAVING COUNT(T2.p_id_dummy) > 3"
  },
  {
    "db_id": "computer_student",
    "question": "What is the number of students who have not received any advice?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person WHERE p_id NOT IN (SELECT p_id FROM advisedBy)"
  },
  {
    "db_id": "computer_student",
    "question": "What courses have been taught by both professors who have taught only one harder undergraduate course and professors who have taught at least two master/graduate courses?",
    "evidence": "",
    "SQL": "SELECT DISTINCT T1.course_id FROM taughtBy AS T1 WHERE EXISTS (SELECT 1 FROM (SELECT T2.p_id FROM course AS T3 INNER JOIN taughtBy AS T2 ON T3.course_id = T2.course_id WHERE T3.courseLevel = 'Level_400' GROUP BY T2.p_id HAVING COUNT(DISTINCT T3.course_id) = 1) AS T4 WHERE T4.p_id = T1.p_id) AND EXISTS (SELECT 1 FROM (SELECT T5.p_id FROM course AS T6 INNER JOIN taughtBy AS T5 ON T6.course_id = T5.course_id WHERE T6.courseLevel = 'Level_500' GROUP BY T5.p_id HAVING COUNT(DISTINCT T6.course_id) >= 2) AS T7 WHERE T7.p_id = T1.p_id)"
  },
  {
    "db_id": "computer_student",
    "question": "What is the course ID and course level of the course taught by a faculty professor with ID 201 who is a professor in the professional program?",
    "evidence": "",
    "SQL": "SELECT T2.course_id, T3.courseLevel FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T2.course_id WHERE T1.p_id = 201 AND T1.hasPosition = 1 AND T3.courseLevel = 'Level_500'"
  },
  {
    "db_id": "computer_student",
    "question": "Which professors teach only level 500 courses?",
    "evidence": "",
    "SQL": "SELECT p_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T1.courseLevel = 'Level_500' GROUP BY T2.p_id HAVING COUNT(T2.course_id) = (SELECT COUNT(*) FROM course AS T3 WHERE T3.courseLevel = 'Level_500')"
  },
  {
    "db_id": "computer_student",
    "question": "What courses are taught by professors who have position status as faculty?",
    "evidence": "",
    "SQL": "SELECT DISTINCT T1.course_id FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.hasPosition = 'Faculty_eme'"
  },
  {
    "db_id": "computer_student",
    "question": "Which students are advised by a professor who has taught both 'Introduction to Computer Science' and 'Algorithms' courses?",
    "evidence": "",
    "SQL": "SELECT distinct p1.p_id AS student_id FROM advisedBy AS p1 INNER JOIN taughtBy AS p2 ON p1.p_id = p2.p_id INNER JOIN taughtBy AS p3 ON p2.p_id = p3.p_id WHERE p3.course_id = 'course_id_of_Introduction_to_Computer_Science' AND p2.course_id = 'course_id_of_Algorithms'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the number of courses that were taught by a professor with a student?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM taughtBy AS T1 JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.hasPosition = 'student'"
  },
  {
    "db_id": "computer_student",
    "question": "What are all the courses taught by a professor who advises at least one student and also has position as 'Faculty'? ",
    "evidence": "",
    "SQL": "SELECT C.course_id, C.courseLevel FROM course C INNER JOIN taughtBy T ON C.course_id = T.course_id INNER JOIN advisedBy A ON T.p_id = A.p_id_dummy WHERE A.p_id = (SELECT p_id FROM person WHERE hasPosition = 'Faculty_aff') GROUP BY C.course_id, C.courseLevel"
  },
  {
    "db_id": "computer_student",
    "question": "What is the course with the most number of teachers teaching at?",
    "evidence": "",
    "SQL": "SELECT T1.courseLevel, COUNT(T2.p_id) AS num_teachers FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id GROUP BY T1.courseLevel ORDER BY num_teachers DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the percentage of students in the program who are advised by a faculty employee?",
    "evidence": "",
    "SQL": "SELECT ROUND(100 * COUNT(DISTINCT T2.student) / (SELECT COUNT(*) FROM person), 2) FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.hasPosition = 'Faculty_eme'"
  },
  {
    "db_id": "computer_student",
    "question": "What are all the courses that have no teachers?",
    "evidence": "",
    "SQL": "SELECT course_id FROM course WHERE NOT EXISTS (SELECT 1 FROM taughtBy WHERE taughtBy.course_id = course.course_id)"
  },
  {
    "db_id": "computer_student",
    "question": "How many professors teach at least one basic undergraduate course?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T1.professor = 1 AND T3.courseLevel = 'Level_200'"
  },
  {
    "db_id": "computer_student",
    "question": "What are the ID's of professors who advise students who are in Phase 2 of their program?",
    "evidence": "",
    "SQL": "SELECT p_id FROM person WHERE inPhase = 'Phase_2' AND hasPosition = 'advisor'"
  },
  {
    "db_id": "computer_student",
    "question": "What are the IDs of the courses taught by the professor who has been a professor for more than 5 years?",
    "evidence": "",
    "SQL": "SELECT T1.course_id FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.yearsInProgram > 5"
  },
  {
    "db_id": "computer_student",
    "question": "Who is the advisor of person with ID 121?",
    "evidence": "",
    "SQL": "SELECT p_id FROM person WHERE p_id = 121 AND hasPosition = 'advisor'"
  },
  {
    "db_id": "computer_student",
    "question": "What are the IDs of professors who have taught the most courses?",
    "evidence": "",
    "SQL": "SELECT T1.p_id FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id GROUP BY T1.p_id ORDER BY COUNT(*) DESC LIMIT 3"
  },
  {
    "db_id": "computer_student",
    "question": "Who are the students who have advisors that are professors?",
    "evidence": "",
    "SQL": "SELECT p_id, professor FROM person WHERE p_id IN (SELECT p_id FROM person WHERE professor != 0)"
  },
  {
    "db_id": "computer_student",
    "question": "Who are the professors that teach only one course?",
    "evidence": "",
    "SQL": "SELECT T1.p_id FROM taughtBy AS T1 GROUP BY T1.p_id HAVING COUNT(DISTINCT T1.course_id) = 1"
  },
  {
    "db_id": "computer_student",
    "question": "Which courses are taught by professors who have advised the most students?",
    "evidence": "",
    "SQL": "SELECT * FROM course WHERE course_id IN (SELECT course_id FROM taughtBy WHERE p_id IN (SELECT p_id FROM person WHERE p_id IN (SELECT p_id_dummy FROM advisedBy GROUP BY p_id_dummy ORDER BY (SELECT COUNT(*) FROM advisedBy WHERE p_id_dummy = advisedBy.p_id_dummy) DESC LIMIT 1) ) )"
  },
  {
    "db_id": "computer_student",
    "question": "What is the highest level of a course taught by a professor who advised 5 students?",
    "evidence": "",
    "SQL": "SELECT MAX(courseLevel) FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN advisedBy AS T3 ON T2.p_id = T3.p_id WHERE T3.p_id_dummy IN (SELECT p_id_dummy FROM advisedBy GROUP BY p_id_dummy HAVING COUNT(p_id_dummy) = 5)"
  },
  {
    "db_id": "computer_student",
    "question": "What is the course with most taught courses?",
    "evidence": "",
    "SQL": "SELECT course.course_id, COUNT(*) FROM course LEFT JOIN taughtBy ON course.course_id = taughtBy.course_id GROUP BY course.course_id ORDER BY COUNT(*) DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What are the course IDs that are both taught by professors in the 'Faculty_aff' role and students?",
    "evidence": "",
    "SQL": "SELECT * FROM taughtBy AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T1.p_id IN (SELECT p_id FROM person WHERE hasPosition = 'Faculty_aff') AND T1.p_id IN (SELECT p_id FROM person WHERE student = 1)"
  },
  {
    "db_id": "computer_student",
    "question": "Which courses are taught by both Mr. John and Mr. Smith?",
    "evidence": "",
    "SQL": "SELECT course.course_id, course.courseLevel FROM course INNER JOIN taughtBy ON course.course_id = taughtBy.course_id WHERE taughtBy.p_id IN (SELECT p_id FROM person WHERE p_id = 123 OR p_id = 456)"
  },
  {
    "db_id": "computer_student",
    "question": "How many faculty members teach medium undergraduate courses?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T3.courseLevel = 'Level_300' AND T1.professor = 1"
  },
  {
    "db_id": "computer_student",
    "question": "Who is the advisor of a student who has been a student for more than 5 years?",
    "evidence": "",
    "SQL": "SELECT T2.p_id_dummy FROM person AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id WHERE T1.yearsInProgram > 5"
  },
  {
    "db_id": "computer_student",
    "question": "Who are the students that have not taken any courses?",
    "evidence": "",
    "SQL": "SELECT p_id FROM person WHERE p_id NOT IN (SELECT p_id FROM taughtBy) AND p_id IS NOT NULL"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of students who have advisors in the program and take a course in the year they entered the program?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id INNER JOIN taughtBy AS T3 ON T1.p_id = T3.p_id AND T2.p_id_dummy = T3.p_id INNER JOIN course AS T4 ON T3.course_id = T4.course_id WHERE T1.yearsInProgram = T4.courseLevel AND T1.student = 1"
  },
  {
    "db_id": "computer_student",
    "question": "What courses are being taught by both Professor 297 and Professor 353?",
    "evidence": "",
    "SQL": "SELECT C1.course_id FROM course AS C1 INNER JOIN taughtBy AS T1 ON C1.course_id = T1.course_id INNER JOIN taughtBy AS T2 ON C1.course_id = T2.course_id WHERE T1.p_id = 297 AND T2.p_id = 353"
  },
  {
    "db_id": "computer_student",
    "question": "What is the percentage of students in the university who are in their third year of undergraduate studies?",
    "evidence": "",
    "SQL": "SELECT ROUND((SELECT COUNT(*) FROM person WHERE inPhase = 'Year_3' ) * 100.0 / (SELECT COUNT(*) FROM person WHERE inPhase IS NOT NULL) , 2) AS percentage"
  },
  {
    "db_id": "computer_student",
    "question": "Which student has been in the program for the most years?",
    "evidence": "",
    "SQL": "SELECT p_id, MAX(yearsInProgram) AS maxYears FROM person GROUP BY p_id ORDER BY maxYears DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the average number of years a student spends in the program if they have a professor who also taught the course 'Introduction to Artificial Intelligence'?",
    "evidence": "",
    "SQL": "SELECT AVG(T1.yearsInProgram) AS average_years FROM person AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id INNER JOIN taughtBy AS T3 ON T3.p_id = T2.p_id_dummy INNER JOIN course AS T4 ON T3.course_id = T4.course_id WHERE T4.courseLevel = 'Introduction to Artificial Intelligence' AND T1.student = 1"
  },
  {
    "db_id": "computer_student",
    "question": "What level of courses are taught by professors with the position of 'Snr Professor'?",
    "evidence": "",
    "SQL": "SELECT DISTINCT courseLevel FROM course JOIN taughtBy ON course.course_id = taughtBy.course_id JOIN person ON taughtBy.p_id = person.p_id WHERE person.hasPosition = 'Snr Professor'"
  },
  {
    "db_id": "computer_student",
    "question": "What professors teach courses with a level of 'Level_100'?",
    "evidence": "",
    "SQL": "SELECT T2.p_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T1.courseLevel = 'Level_100'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the average number of years a professor has been in the program?",
    "evidence": "",
    "SQL": "SELECT AVG(yearsInProgram) FROM person WHERE hasPosition = 'Professor'"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses taught by the advisors of students in 2nd year?",
    "evidence": "",
    "SQL": "SELECT DISTINCT T3.course_id FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN taughtBy AS T3 ON T2.p_id = T3.p_id WHERE T2.yearsInProgram = 'Year_2'"
  },
  {
    "db_id": "computer_student",
    "question": "Which students have been advised by more than one professor?",
    "evidence": "",
    "SQL": "SELECT p_id FROM person WHERE (SELECT COUNT(p_id) FROM advisedBy WHERE p_id = person.p_id) > 1"
  },
  {
    "db_id": "computer_student",
    "question": "How many students are advised by professor 'John Doe'?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T1.p_id_dummy = (SELECT p_id FROM person WHERE professor = 'John Doe')"
  },
  {
    "db_id": "computer_student",
    "question": "Which professors have taught all Level_200 and Level_300 courses?",
    "evidence": "",
    "SQL": "SELECT T1.p_id FROM taughtBy AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T2.courseLevel IN ('Level_200', 'Level_300') GROUP BY T1.p_id HAVING COUNT(DISTINCT T2.course_id) = (SELECT COUNT(DISTINCT course_id) FROM course WHERE courseLevel IN ('Level_200', 'Level_300'))"
  },
  {
    "db_id": "computer_student",
    "question": "How many courses are taught by a professor with a Ph.D. in Computer Science?",
    "evidence": "",
    "SQL": "SELECT COUNT(T1.course_id) FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T1.course_id = T3.course_id WHERE T2.hasPosition = 'PhD_in_Computer_Science'"
  },
  {
    "db_id": "computer_student",
    "question": "What courses are taught by professor 123?",
    "evidence": "",
    "SQL": "SELECT T1.course_id, T2.courseLevel FROM taughtBy AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T1.p_id = 123"
  },
  {
    "db_id": "computer_student",
    "question": "What is the course level of the course taught by professor p_id 101?",
    "evidence": "",
    "SQL": "SELECT courseLevel FROM course INNER JOIN taughtBy ON course.course_id = taughtBy.course_id WHERE taughtBy.p_id = 101"
  },
  {
    "db_id": "computer_student",
    "question": "How many professors teach at least two undergraduate courses?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM ( SELECT p_id, COUNT(course_id) AS course_count FROM taughtBy GROUP BY p_id HAVING COUNT(course_id) >= 2 ) AS T1"
  },
  {
    "db_id": "computer_student",
    "question": "Which professors have taught 3 or more courses that are not in Level_300?",
    "evidence": "",
    "SQL": "SELECT T1.hasPosition FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id WHERE T1.professor = 1 GROUP BY T1.p_id HAVING COUNT(T2.course_id) > 2 AND NOT EXISTS (SELECT 1 FROM course WHERE courseLevel = 'Level_300' AND course_id = T2.course_id)"
  },
  {
    "db_id": "computer_student",
    "question": "Which professor has the most students in total?",
    "evidence": "",
    "SQL": "SELECT p_id, COUNT(p_id) AS total_students FROM advisedBy GROUP BY p_id ORDER BY total_students DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What are the IDs of students who take a course with a course level of 'advanced' and were taught by a professor who gave advice to more than 4 others?",
    "evidence": "",
    "SQL": "SELECT P1.student FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS P1 ON T2.p_id = P1.p_id INNER JOIN advisedBy AS T3 ON P1.p_id = T3.p_id GROUP BY P1.student HAVING COUNT(T3.p_id_dummy) > 4 AND T1.courseLevel = 'advanced'"
  },
  {
    "db_id": "computer_student",
    "question": "List the IDs of courses taught by professors in phase two",
    "evidence": "",
    "SQL": "SELECT T2.course_id FROM taughtBy AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T1.p_id = T3.p_id WHERE T3.inPhase = 'two'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the number of courses taught by professors who have advised at least one student?",
    "evidence": "",
    "SQL": "SELECT COUNT(DISTINCT course_id) FROM taughtBy T1 INNER JOIN person T2 ON T1.p_id = T2.p_id INNER JOIN advisedBy T3 ON T2.p_id = T3.p_id_dummy GROUP BY T3.p_id_dummy HAVING COUNT(T3.p_id_dummy) > 0"
  },
  {
    "db_id": "computer_student",
    "question": "Which students have been advised by a professor who teaches more than 3 courses?",
    "evidence": "",
    "SQL": "SELECT T1.student FROM person AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id_dummy INNER JOIN taughtBy AS T3 ON T2.p_id = T3.p_id GROUP BY T1.student HAVING COUNT(DISTINCT T3.course_id) > 3"
  },
  {
    "db_id": "computer_student",
    "question": "What are all the courses taught by professors who have more than 3 years in the program?",
    "evidence": "",
    "SQL": "SELECT distinct T1.course_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS P ON T2.p_id = P.p_id WHERE P.yearsInProgram > 3"
  },
  {
    "db_id": "computer_student",
    "question": "What level of courses is taught by professors with more than 5 years in the program?",
    "evidence": "",
    "SQL": "SELECT T1.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T2.p_id = T3.p_id WHERE T3.yearsInProgram > 5 GROUP BY T1.courseLevel"
  },
  {
    "db_id": "computer_student",
    "question": "Which professors teach more than one course?",
    "evidence": "",
    "SQL": "SELECT T1.p_id FROM taughtBy AS T1 GROUP BY T1.p_id HAVING COUNT(DISTINCT T1.course_id) > 1"
  },
  {
    "db_id": "computer_student",
    "question": "What percentage of courses were taught by professors who are not advisors?",
    "evidence": "",
    "SQL": "SELECT CAST(SUM(CASE WHEN NOT EXISTS (SELECT 1 FROM advisedBy WHERE p_id = t.p_id) THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) AS per FROM taughtBy t"
  },
  {
    "db_id": "computer_student",
    "question": "Which students were advised by the same professor as at least one other student?",
    "evidence": "",
    "SQL": "SELECT p1.p_id FROM person AS p1 INNER JOIN advisedBy AS ab ON p1.p_id = ab.p_id_dummy INNER JOIN person AS p2 ON ab.p_id = p2.p_id WHERE p1.student = 1 AND p2.student = 1 GROUP BY p1.p_id HAVING COUNT(DISTINCT p2.p_id) > 1"
  },
  {
    "db_id": "computer_student",
    "question": "Is the course with highest level taught by a professor who is also a student?",
    "evidence": "",
    "SQL": "SELECT * FROM course INNER JOIN taughtBy ON course.course_id = taughtBy.course_id INNER JOIN person ON taughtBy.p_id = person.p_id WHERE course.courseLevel = (SELECT MAX(courseLevel) FROM course) AND person.hasPosition = 'student'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the average number of professional or master/undergraduate courses being taught by each professor?",
    "evidence": "",
    "SQL": "SELECT CAST(COUNT(T1.course_id) AS REAL) / COUNT(DISTINCT T2.p_id) FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T1.courseLevel = 'Level_500'"
  },
  {
    "db_id": "computer_student",
    "question": "What are the professors who teach courses in the 'Intermediate' level?",
    "evidence": "",
    "SQL": "SELECT T1.p_id FROM taughtBy AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T2.courseLevel = 'Intermediate'"
  },
  {
    "db_id": "computer_student",
    "question": "What are all the courses taught by a person who advises at least 3 students?",
    "evidence": "",
    "SQL": "SELECT C.course_id FROM course C JOIN taughtBy T ON C.course_id = T.course_id JOIN person P ON T.p_id = P.p_id GROUP BY C.course_id HAVING COUNT(P.p_id) > 3"
  },
  {
    "db_id": "computer_student",
    "question": "What is the position of the professor who taught the most courses?",
    "evidence": "",
    "SQL": "SELECT T1.p_id, T1.hasPosition FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id GROUP BY T1.p_id ORDER BY COUNT(T2.course_id) DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "Who is teaching a course with a course level of 'Level_500' and what is the course id?",
    "evidence": "",
    "SQL": "SELECT T1.course_id, T2.p_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T2.p_id = T3.p_id WHERE T1.courseLevel = 'Level_500'"
  },
  {
    "db_id": "computer_student",
    "question": "What are the IDs of the students who are taught by faculty members who are also advisors?",
    "evidence": "",
    "SQL": "SELECT DISTINCT T1.p_id FROM person AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id INNER JOIN taughtBy AS T3 ON T1.p_id = T3.p_id WHERE T2.p_id_dummy IS NOT NULL"
  },
  {
    "db_id": "computer_student",
    "question": "What is the list of courses taught by Advisor 3?",
    "evidence": "",
    "SQL": "SELECT course.course_id, course.courseLevel FROM course INNER JOIN taughtBy ON course.course_id = taughtBy.course_id INNER JOIN person ON taughtBy.p_id = person.p_id WHERE person.hasPosition = 'Advisor' AND person.p_id = 3"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses taught by professors who have at least two courses?",
    "evidence": "",
    "SQL": "SELECT DISTINCT T1.course_id FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id GROUP BY T1.course_id, T2.p_id HAVING COUNT(T1.course_id) >= 2"
  },
  {
    "db_id": "computer_student",
    "question": "What is the course level of the course taught by the professor with ID 123?",
    "evidence": "",
    "SQL": "SELECT courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T2.p_id = 123"
  },
  {
    "db_id": "computer_student",
    "question": "What courses are taught by professors who are also advisors?",
    "evidence": "",
    "SQL": "SELECT DISTINCT T1.course_id FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN advisedBy AS T3 ON T2.p_id = T3.p_id"
  },
  {
    "db_id": "computer_student",
    "question": "What is the average number of years a student has been in the program?",
    "evidence": "",
    "SQL": "SELECT AVG(CAST(yearsInProgram AS REAL)) AS average_years FROM person WHERE inPhase != 'Graduated'"
  },
  {
    "db_id": "computer_student",
    "question": "What course levels are taught by faculty professors who have been teaching for more than 5 years?",
    "evidence": "",
    "SQL": "SELECT DISTINCT T3.courseLevel FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T2.course_id WHERE T1.hasPosition = 'Faculty_eme' AND T3.course_id IN (SELECT course_id FROM taughtBy AS T4 GROUP BY course_id HAVING COUNT(DISTINCT T4.p_id) > 5)"
  },
  {
    "db_id": "computer_student",
    "question": "What are all the professors who teach courses in both Level_200 and Level_300?",
    "evidence": "",
    "SQL": "SELECT p_id FROM person WHERE p_id IN (SELECT p_id FROM taughtBy WHERE course_id IN (SELECT course_id FROM course WHERE courseLevel = 'Level_200')) AND p_id IN (SELECT p_id FROM taughtBy WHERE course_id IN (SELECT course_id FROM course WHERE courseLevel = 'Level_300'))"
  },
  {
    "db_id": "computer_student",
    "question": "What is the list of professors who teach more than one course?",
    "evidence": "",
    "SQL": "SELECT p.p_id, p.hasPosition FROM person p JOIN taughtBy t ON p.p_id = t.p_id GROUP BY p.p_id, p.hasPosition HAVING COUNT(t.course_id) > 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the name of the professor who is advising the most students?",
    "evidence": "",
    "SQL": "SELECT person.p_id, professor FROM person INNER JOIN advisedBy AS T1 ON person.p_id = T1.p_id GROUP BY person.p_id ORDER BY COUNT(T1.p_id_dummy) DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What are the levels of courses taught by the advisor of the student with ID 80?",
    "evidence": "",
    "SQL": "SELECT T2.courseLevel FROM course AS T2 INNER JOIN taughtBy AS T3 ON T2.course_id = T3.course_id INNER JOIN advisedBy AS T1 ON T3.p_id = T1.p_id_dummy WHERE T1.p_id = 80"
  },
  {
    "db_id": "computer_student",
    "question": "Which professors have more than 3 students?",
    "evidence": "",
    "SQL": "SELECT DISTINCT p1.p_id FROM person AS p1 INNER JOIN advisedBy AS a ON p1.p_id = a.p_id_dummy GROUP BY p1.p_id HAVING COUNT(*) > 3"
  },
  {
    "db_id": "computer_student",
    "question": "What is the average number of students for each professor?",
    "evidence": "",
    "SQL": "SELECT CAST(COUNT(p_id) AS REAL) / COUNT(DISTINCT p_id_dummy) AS avgnum FROM advisedBy GROUP BY p_id_dummy"
  },
  {
    "db_id": "computer_student",
    "question": "What are the course levels taught by a professor who has a faculty position in phase 1 and has been in the program for at least 4 years?",
    "evidence": "",
    "SQL": "SELECT courseLevel FROM course JOIN taughtBy ON course.course_id = taughtBy.course_id JOIN person ON person.p_id = taughtBy.p_id WHERE person.hasPosition = 'Faculty_eme' AND inPhase = 'Phase_1' AND yearsInProgram >= 4"
  },
  {
    "db_id": "computer_student",
    "question": "What is the minimum course level of a course taught by a student?",
    "evidence": "",
    "SQL": "SELECT MIN(T3.courseLevel) FROM course AS T3 INNER JOIN taughtBy AS T2 ON T3.course_id = T2.course_id WHERE T2.p_id IN (SELECT p_id FROM person WHERE hasPosition = 'Student')"
  },
  {
    "db_id": "computer_student",
    "question": "What courses are taught by faculty professors?",
    "evidence": "",
    "SQL": "SELECT course_id, courseLevel FROM course NATURAL JOIN taughtBy NATURAL JOIN person WHERE hasPosition <> 0"
  },
  {
    "db_id": "computer_student",
    "question": "What is the course level of the course taught by a professor who is not a faculty member?",
    "evidence": "",
    "SQL": "SELECT courseLevel FROM course JOIN taughtBy ON course.course_id = taughtBy.course_id JOIN person ON taughtBy.p_id = person.p_id WHERE person.professor = 0"
  },
  {
    "db_id": "computer_student",
    "question": "What are the names of all students that have been advised by more than one professor?",
    "evidence": "",
    "SQL": "SELECT distinct S.p_id, S.student FROM person AS S JOIN advisedBy AS A ON S.p_id = A.p_id GROUP BY S.p_id HAVING COUNT(A.p_id_dummy) > 1"
  },
  {
    "db_id": "computer_student",
    "question": "How many students have been advised by a professor who taught a course with course ID 15?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id INNER JOIN taughtBy AS T3 ON T2.p_id = T3.p_id WHERE T3.course_id = 15 AND T1.student = 1"
  },
  {
    "db_id": "computer_student",
    "question": "What are the IDs of the students who take courses taught by professors who have taught at least one level 400 course?",
    "evidence": "",
    "SQL": "SELECT T1.p_id FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T2.course_id GROUP BY T1.p_id HAVING COUNT(T3.courseLevel = 'Level_400') > 0"
  },
  {
    "db_id": "computer_student",
    "question": "What percentage of students are in phase 2 or 3 in the basic undergraduate courses?",
    "evidence": "",
    "SQL": "SELECT 100 * COUNT(DISTINCT P.inPhase) / (SELECT COUNT(DISTINCT P2.p_id) FROM person P2 INNER JOIN course C2 ON P2.student = C2.course_id WHERE C2.courseLevel = 'Level_100') AS percentage FROM person P WHERE P.student IN (SELECT T.course_id FROM course T WHERE T.courseLevel = 'Level_100') AND P.inPhase IN ('Phase_2', 'Phase_3')"
  },
  {
    "db_id": "computer_student",
    "question": "What is the number of students who are in their last year in program and have a professor as their advisor?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T1.p_id = T3.course_id WHERE T1.yearsInProgram = '4' AND T2.p_id_dummy = 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of people in the program?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person"
  },
  {
    "db_id": "computer_student",
    "question": "What courses are taught by the professor 'Faculty_aff' in professional or master/undergraduate courses?",
    "evidence": "",
    "SQL": "SELECT * FROM taughtBy AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T1.p_id IN (SELECT p_id FROM person WHERE hasPosition = 'Faculty_aff' AND professor = 1) AND T2.courseLevel = 'Level_500' OR T2.courseLevel = 'Level_600'"
  },
  {
    "db_id": "computer_student",
    "question": "List the IDs of courses taught by professors who have more than 3 students.",
    "evidence": "",
    "SQL": "SELECT T1.course_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T2.p_id = T3.p_id WHERE T3.student > 3"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses taught by professors with more than 5 years of experience in the program?",
    "evidence": "",
    "SQL": "SELECT course.course_id, course.courseLevel FROM course, taughtBy, person WHERE taughtBy.p_id = person.p_id AND person.yearsInProgram > 5 GROUP BY course.course_id"
  },
  {
    "db_id": "computer_student",
    "question": "What is the most common course level taught by professors?",
    "evidence": "",
    "SQL": "SELECT courseLevel, COUNT(*) AS count FROM course NATURAL JOIN taughtBy GROUP BY courseLevel ORDER BY count DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "How many students have advised more than one course?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM advisedBy AS T1 GROUP BY T1.p_id_dummy HAVING COUNT(T1.p_id_dummy) > 1"
  },
  {
    "db_id": "computer_student",
    "question": "What are the IDs of all professors who are not students?",
    "evidence": "",
    "SQL": "SELECT p_id FROM person WHERE hasPosition = 'Faculty'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the course ID of the course taught by the professor with the name 'John'?",
    "evidence": "",
    "SQL": "SELECT T2.course_id FROM taughtBy AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS P ON T1.p_id = P.p_id WHERE P.professor = 1 AND P.student = 0"
  },
  {
    "db_id": "computer_student",
    "question": "What are the course IDs of all courses that were taught by professor 123?",
    "evidence": "",
    "SQL": "SELECT course_id FROM taughtBy WHERE p_id = 123"
  },
  {
    "db_id": "computer_student",
    "question": "What are the names of students in Level_400?",
    "evidence": "",
    "SQL": "SELECT P.student FROM person P WHERE P.hasPosition='Student' AND P.inPhase='Level_400'"
  },
  {
    "db_id": "computer_student",
    "question": "Which students are in phase 2?",
    "evidence": "",
    "SQL": "SELECT * FROM person WHERE inPhase = '2' AND student = 1"
  },
  {
    "db_id": "computer_student",
    "question": "What are the levels of all courses taught by teacher no.85?",
    "evidence": "",
    "SQL": "SELECT T1.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T2.p_id = 85"
  },
  {
    "db_id": "computer_student",
    "question": "What is the number of students who have a faculty position in a Level_400 course?",
    "evidence": "",
    "SQL": "SELECT COUNT(student) FROM person WHERE student = 1 AND inPhase = 'Level_400'"
  },
  {
    "db_id": "computer_student",
    "question": "Which faculty employees teach courses at the level of Level_200 and have at least 2 students in their courses?",
    "evidence": "",
    "SQL": "SELECT T2.p_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T3.p_id = T2.p_id WHERE T1.courseLevel = 'Level_200' AND T3.hasPosition = 'Faculty_eme' GROUP BY T2.p_id HAVING COUNT(T2.course_id) >= 2"
  },
  {
    "db_id": "computer_student",
    "question": "What is the course level for the course that is taught by faculty professor with ID 101?",
    "evidence": "",
    "SQL": "SELECT T3.courseLevel FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T2.course_id WHERE T1.p_id = 101"
  },
  {
    "db_id": "computer_student",
    "question": "What courses are being taught by the professors who have a position of 'Professor'?",
    "evidence": "",
    "SQL": "SELECT T1.course_id, T1.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T2.p_id = T3.p_id WHERE T3.hasPosition = 'Professor' ORDER BY T1.course_id, T1.courseLevel"
  },
  {
    "db_id": "computer_student",
    "question": "What is the number of students taught by professors teaching courses at the Level_400 level?",
    "evidence": "",
    "SQL": "SELECT COUNT(DISTINCT T1.p_id) FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T2.course_id WHERE T3.courseLevel = 'Level_400'"
  },
  {
    "db_id": "computer_student",
    "question": "Which professors have advised students in more than two courses?",
    "evidence": "",
    "SQL": "SELECT T2.p_id FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id GROUP BY T2.p_id HAVING COUNT(DISTINCT T1.course_id) > 2"
  },
  {
    "db_id": "computer_student",
    "question": "What courses do students with most years in program advise most frequently?",
    "evidence": "",
    "SQL": "SELECT T1.course_id, COUNT(T1.course_id) FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id GROUP BY T1.course_id ORDER BY COUNT(*) DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "Who are the professors who have taught at least two courses?",
    "evidence": "",
    "SQL": "SELECT T2.p_id FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id GROUP BY T2.p_id HAVING COUNT(T1.course_id) >= 2"
  },
  {
    "db_id": "computer_student",
    "question": "Who teaches a course that has the level 'Level_200'? List the course IDs",
    "evidence": "",
    "SQL": "SELECT T1.course_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T1.courseLevel = 'Level_200' GROUP BY T1.course_id"
  },
  {
    "db_id": "computer_student",
    "question": "What is the name of the person who advised the most number of students?",
    "evidence": "",
    "SQL": "SELECT p_id, COUNT(*) FROM advisedBy GROUP BY p_id ORDER BY COUNT(*) DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses taught by at least two professors?",
    "evidence": "",
    "SQL": "SELECT course_id, COUNT(*) as count FROM taughtBy GROUP BY course_id HAVING COUNT(*) > 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the course id of a course that is taught by a person with the professor position?",
    "evidence": "",
    "SQL": "SELECT course_id FROM taughtBy JOIN person ON taughtBy.p_id = person.p_id WHERE hasPosition = 'Professor'"
  },
  {
    "db_id": "computer_student",
    "question": "How many professors are teaching more than one course?",
    "evidence": "",
    "SQL": "SELECT COUNT(DISTINCT T1.p_id) FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id GROUP BY T1.p_id HAVING COUNT(T2.course_id) > 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the percentage of students who are advised by a faculty member teaching at least two courses?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) * 100 / (SELECT COUNT(*) FROM person WHERE student = 1) FROM advisedBy AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id GROUP BY T1.p_id_dummy HAVING COUNT(T2.course_id) >= 2"
  },
  {
    "db_id": "computer_student",
    "question": "What is the name of the student who is advised by the professor teaching the most courses?",
    "evidence": "",
    "SQL": "SELECT T1.student FROM person AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id_dummy INNER JOIN taughtBy AS T3 ON T2.p_id = T3.p_id GROUP BY T1.student ORDER BY COUNT(T3.course_id) DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "Which professors taught more than one course?",
    "evidence": "",
    "SQL": "SELECT DISTINCT T1.p_id FROM taughtBy AS T1 GROUP BY T1.p_id HAVING COUNT(T1.course_id) > 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the list of courses taught by the professor who has the most advisors?",
    "evidence": "",
    "SQL": "SELECT DISTINCT T1.course_id, T1.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T2.p_id = T3.p_id GROUP BY T1.course_id, T1.courseLevel ORDER BY (SELECT COUNT(T4.p_id_dummy) FROM advisedBy AS T4 WHERE T4.p_id = T3.p_id) DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "Find the list of courses taught by the professor who advised student ID 7.",
    "evidence": "",
    "SQL": "SELECT course_id FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN advisedBy AS T3 ON T2.p_id = T3.p_id WHERE T3.p_id_dummy = 7"
  },
  {
    "db_id": "computer_student",
    "question": "What are the course IDs and professor IDs of the courses taught by a specific professor who is also a student?",
    "evidence": "",
    "SQL": "SELECT T1.course_id, T2.p_id FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.student = 1 AND T2.p_id IN (SELECT p_id from person where student = 1)"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses taught by professors who have been in the program for more than 4 years?",
    "evidence": "",
    "SQL": "SELECT course_id FROM taughtBy INNER JOIN person ON taughtBy.p_id = person.p_id WHERE yearsInProgram > '4' GROUP BY course_id"
  },
  {
    "db_id": "computer_student",
    "question": "What is the general course level of professors who are teaching more than two courses?",
    "evidence": "",
    "SQL": "SELECT T3.courseLevel FROM course AS T3 INNER JOIN taughtBy AS T2 ON T3.course_id = T2.course_id INNER JOIN person AS T1 ON T2.p_id = T1.p_id WHERE T1.professor = 1 AND T2.course_id IN (SELECT T4.course_id FROM taughtBy AS T4 WHERE T4.p_id = T1.p_id GROUP BY T4.p_id HAVING COUNT(T4.course_id) > 2)"
  },
  {
    "db_id": "computer_student",
    "question": "What is the average years in program of all students who are in the same phase?",
    "evidence": "",
    "SQL": "SELECT AVG(person.yearsInProgram) FROM person WHERE person.inPhase = (SELECT inPhase FROM person GROUP BY inPhase ORDER BY COUNT(inPhase) LIMIT 1)"
  },
  {
    "db_id": "computer_student",
    "question": "How many students have been advised by a professor who teaches a Level_500 course?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id_dummy INNER JOIN taughtBy AS T3 ON T2.p_id = T3.p_id WHERE T3.course_id IN (SELECT course_id FROM course WHERE courseLevel = 'Level_500')"
  },
  {
    "db_id": "computer_student",
    "question": "What are all the course levels taught by a professor who is teaching a course?",
    "evidence": "",
    "SQL": "SELECT T3.courseLevel FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T2.course_id WHERE T1.professor = 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the course level and professor ID who taught the course 'Introduction to Computer Science'?",
    "evidence": "",
    "SQL": "SELECT T1.courseLevel, T2.p_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T1.course_id = (SELECT course_id FROM course WHERE courseLevel = 'Introduction to Computer Science')"
  },
  {
    "db_id": "computer_student",
    "question": "How many students are advised by professors who teach courses at level 3?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN taughtBy AS T3 ON T2.p_id = T3.p_id INNER JOIN course AS T4 ON T3.course_id = T4.course_id WHERE T2.student = 1 AND T4.courseLevel = 'Level_3'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the number of students who are in phase 'engineering'?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person WHERE inPhase = 'engineering' AND student = 1"
  },
  {
    "db_id": "computer_student",
    "question": "What are all the course IDs taught by professors with years in program more than 5?",
    "evidence": "",
    "SQL": "SELECT course_id FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.yearsInProgram > 5"
  },
  {
    "db_id": "computer_student",
    "question": "What courses are taught by a person who is also a professor?",
    "evidence": "",
    "SQL": "SELECT courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T2.p_id IN (SELECT p_id FROM person WHERE professor = 1)"
  },
  {
    "db_id": "computer_student",
    "question": "Please list all the courses which are taught by a professor who has been in the program for less than 5 years.",
    "evidence": "",
    "SQL": "SELECT T2.course_id FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id WHERE T1.inPhase = 'Before_5_years' AND T2.p_id IN (SELECT p_id FROM person WHERE yearsInProgram = 'Before_5_years')"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of years of academic experience of all the students in phase 4?",
    "evidence": "",
    "SQL": "SELECT SUM(yearsInProgram) FROM person WHERE inPhase = 'Phase_4' AND student = 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of years of teaching experience of professors?",
    "evidence": "",
    "SQL": "SELECT SUM(CAST(SUBSTR(yearsInProgram, 7) AS INTEGER)) AS totalYears FROM person WHERE professor = 1"
  },
  {
    "db_id": "computer_student",
    "question": "Which students are advised by more than one professor?",
    "evidence": "",
    "SQL": "SELECT p_id FROM person WHERE p_id IN (SELECT p_id_dummy FROM advisedBy GROUP BY p_id_dummy HAVING COUNT(*) > 1)"
  },
  {
    "db_id": "computer_student",
    "question": "List all professors in the undergraduate level that do not have an advised student.",
    "evidence": "",
    "SQL": "SELECT DISTINCT T1.p_id FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T2.course_id WHERE T3.courseLevel = 'Level_100' AND T1.p_id NOT IN (SELECT p_id FROM advisedBy)"
  },
  {
    "db_id": "computer_student",
    "question": "What is the name of the course taught by the professor who has taught the most courses?",
    "evidence": "",
    "SQL": "SELECT T1.courseLevel, T1.course_id, COUNT(T2.course_id) FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id GROUP BY T1.course_id, T1.courseLevel ORDER BY COUNT(T2.course_id) DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What courses have students who have more than 2 advisors?",
    "evidence": "",
    "SQL": "SELECT DISTINCT T1.course_id FROM taughtBy AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id WHERE T2.p_id_dummy IS NOT NULL GROUP BY T1.course_id HAVING COUNT(T2.p_id) > 2"
  },
  {
    "db_id": "computer_student",
    "question": "What are the IDs of the professors who have both students and a position of Faculty and are teaching a Level_400 course?",
    "evidence": "",
    "SQL": "SELECT T2.p_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T2.p_id = T3.p_id WHERE T1.courseLevel = 'Level_400' AND T3.hasPosition = 'Faculty' AND T3.student IS NOT NULL"
  },
  {
    "db_id": "computer_student",
    "question": "What is the ID of the course that has been taught by the most professors?",
    "evidence": "",
    "SQL": "SELECT course_id FROM taughtBy GROUP BY course_id ORDER BY COUNT(p_id) DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the highest level of a course taught by a professor who has also advised students?",
    "evidence": "",
    "SQL": "SELECT MAX(T1.courseLevel) FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN advisedBy AS T3 ON T2.p_id = T3.p_id"
  },
  {
    "db_id": "computer_student",
    "question": "What is the course level of all courses taught by the person with ID 201?",
    "evidence": "",
    "SQL": "SELECT course.courseLevel FROM course INNER JOIN taughtBy ON course.course_id = taughtBy.course_id WHERE taughtBy.p_id = 201"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses taught by the most frequent professor?",
    "evidence": "",
    "SQL": "SELECT T2.p_id, COUNT(*) FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id GROUP BY T1.p_id ORDER BY COUNT(*) DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of courses taught by people in Phase 1?",
    "evidence": "",
    "SQL": "SELECT COUNT(DISTINCT course_id) FROM taughtBy, person WHERE taughtBy.p_id = person.p_id AND inPhase = 'Phase 1'"
  },
  {
    "db_id": "computer_student",
    "question": "List the courses taught by professors with 'Software Engineering' as their position.",
    "evidence": "",
    "SQL": "SELECT T1.course_id, T1.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T2.p_id = T3.p_id WHERE T3.hasPosition = 'Software Engineering'"
  },
  {
    "db_id": "computer_student",
    "question": "Which professors teach more than one course?",
    "evidence": "",
    "SQL": "SELECT p_id FROM person WHERE p_id IN (SELECT p_id FROM taughtBy GROUP BY p_id HAVING COUNT(course_id) > 1)"
  },
  {
    "db_id": "computer_student",
    "question": "How many students are taught by a faculty member who has been in the program for at least 3 years?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN person AS T3 ON T3.p_id = T2.p_id WHERE T1.student = 1 AND T3.yearsInProgram >= 3"
  },
  {
    "db_id": "computer_student",
    "question": "What is the number of students who have been advised by a professor to teach at least one course?",
    "evidence": "",
    "SQL": "SELECT COUNT(p_id) FROM advisedBy WHERE p_id_dummy != p_id"
  },
  {
    "db_id": "computer_student",
    "question": "Which professors have advised at least two students in the program?",
    "evidence": "",
    "SQL": "SELECT T1.p_id FROM advisedBy AS T1 GROUP BY T1.p_id HAVING COUNT(T1.p_id_dummy) >= 2"
  },
  {
    "db_id": "computer_student",
    "question": "What is the level of the course taught by the professor who advises the most students?",
    "evidence": "",
    "SQL": "SELECT C.courseLevel FROM course C INNER JOIN taughtBy T ON C.course_id = T.course_id INNER JOIN advisedBy A ON T.p_id = A.p_id GROUP BY C.course_id ORDER BY COUNT(A.p_id) DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the highest level course taught by a professor with more than 5 students?",
    "evidence": "",
    "SQL": "SELECT course.courseLevel FROM taughtBy, person, course WHERE taughtBy.p_id = person.p_id AND taughtBy.course_id = course.course_id AND person.student > 5 GROUP BY course.courseLevel ORDER BY course.courseLevel DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses taught by professors in faculty and at 200-level?",
    "evidence": "",
    "SQL": "SELECT T1.course_id, T1.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T2.p_id = T3.p_id WHERE T3.hasPosition = 'Faculty_aff' AND T1.courseLevel = '200_level'"
  },
  {
    "db_id": "computer_student",
    "question": "Which students are advised by professors who teach a course at Level 500?",
    "evidence": "",
    "SQL": "SELECT T1.p_id FROM advisedBy AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T3.courseLevel = 'Level_500'"
  },
  {
    "db_id": "computer_student",
    "question": "Who are the students that have been advised by professor with ID 101 and what phase are they in?",
    "evidence": "",
    "SQL": "SELECT T1.p_id, T1.inPhase FROM person AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id_dummy WHERE T2.p_id = 101"
  },
  {
    "db_id": "computer_student",
    "question": "Which courses are taught by professors who have advised less than 3 students?",
    "evidence": "",
    "SQL": "SELECT course_id FROM taughtBy JOIN person ON taughtBy.p_id = person.p_id JOIN advisedBy ON person.p_id = advisedBy.p_id_dummy GROUP BY course_id HAVING COUNT(advisedBy.p_id) < 3"
  },
  {
    "db_id": "computer_student",
    "question": "What are the names of all professors who have advised more than 2 students?",
    "evidence": "",
    "SQL": "SELECT T1.p_id, T1.professor, T1.student FROM person AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id_dummy WHERE T1.professor = 1 GROUP BY T1.p_id, T1.professor HAVING COUNT(T2.p_id_dummy) > 2"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of students taught by Professor 10?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.p_id = 10 AND T2.student = 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the number of students who are advised by a faculty member with a duration of more than 3 years?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id_dummy INNER JOIN person AS T3 ON T1.p_id = T3.p_id WHERE T3.professor = 1 AND T3.yearsInProgram > 3"
  },
  {
    "db_id": "computer_student",
    "question": "Which student is advised by a person who taught a high-level undergraduate course?",
    "evidence": "",
    "SQL": "SELECT distinct T1.p_id FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id_dummy = T2.p_id INNER JOIN taughtBy AS T3 ON T2.p_id = T3.p_id INNER JOIN course AS T4 ON T4.course_id = T3.course_id WHERE T4.courseLevel = 'Level_400'"
  },
  {
    "db_id": "computer_student",
    "question": "Which courses were taught by a student?",
    "evidence": "",
    "SQL": "SELECT DISTINCT T2.course_id FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id WHERE T1.student = 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of courses taught by professors in the basic or medium undergraduate level?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM taughtBy AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T2.courseLevel = 'Level_300'"
  },
  {
    "db_id": "computer_student",
    "question": "How many courses do students in a particular phase teach?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T2.p_id = T3.p_id WHERE T3.inPhase = 'Phase_1'"
  },
  {
    "db_id": "computer_student",
    "question": "What are the course IDs of all courses taught by a person who has advised at least one other person to teach?",
    "evidence": "",
    "SQL": "SELECT T1.course_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN advisedBy AS T3 ON T3.p_id = T2.p_id GROUP BY T1.course_id HAVING COUNT(T3.p_id) > 0"
  },
  {
    "db_id": "computer_student",
    "question": "What is the number of students in phase 1 of the program who are not being advised by a professor?",
    "evidence": "",
    "SQL": "SELECT COUNT(T1.p_id) FROM person AS T1 WHERE T1.hasPosition = 'Student' AND T1.inPhase = 'Phase 1' AND T1.p_id NOT IN (SELECT T2.p_id FROM person AS T2 WHERE T2.hasPosition = 'Professor')"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses that are taught by both professor and student?",
    "evidence": "",
    "SQL": "SELECT T1.course_id, T1.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T2.p_id IN (SELECT p_id FROM person WHERE professor = 1 AND student = 1)"
  },
  {
    "db_id": "computer_student",
    "question": "What are all the courses taught by a professor who has also advised a student?",
    "evidence": "",
    "SQL": "SELECT T2.course_id FROM person AS T1 INNER JOIN advisedBy AS T3 ON T1.p_id = T3.p_id INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id WHERE T3.p_id_dummy IS NOT NULL"
  },
  {
    "db_id": "computer_student",
    "question": "Which students have professors who taught courses at the Level_400 level?",
    "evidence": "",
    "SQL": "SELECT S1.p_id FROM person AS S1 JOIN advisedBy AS S2 ON S1.p_id = S2.p_id_dummy JOIN taughtBy AS S3 ON S2.p_id = S3.p_id JOIN course AS S4 ON S3.course_id = S4.course_id WHERE S4.courseLevel = 'Level_400'"
  },
  {
    "db_id": "computer_student",
    "question": "What courses does a student who is not a professor teach?",
    "evidence": "",
    "SQL": "SELECT T2.course_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T3.p_id = T2.p_id WHERE T3.student = 1 AND T3.professor = 0"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of courses taught by professors who have a PhD, excluding those who teach more than 2 courses?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T2.p_id = T3.p_id WHERE T3.hasPosition = 'PhD' AND T2.course_id IN (SELECT course_id FROM (SELECT course_id, COUNT(*) AS count FROM taughtBy GROUP BY course_id) AS T4 WHERE count <= 2)"
  },
  {
    "db_id": "computer_student",
    "question": "Which professor teaches the most students?",
    "evidence": "",
    "SQL": "SELECT T1.p_id FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id GROUP BY T1.p_id ORDER BY COUNT(*) DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "Who taught the course with ID 104?",
    "evidence": "",
    "SQL": "SELECT p_id FROM taughtBy WHERE course_id = 104"
  },
  {
    "db_id": "computer_student",
    "question": "What courses are taught by professors in Phase_2?",
    "evidence": "",
    "SQL": "SELECT course_id FROM taughtBy WHERE p_id IN (SELECT p_id FROM person WHERE hasPosition = 'professor' AND inPhase = 'Phase_2') ORDER BY course_id"
  },
  {
    "db_id": "computer_student",
    "question": "Which professors teach courses of Level_500?",
    "evidence": "",
    "SQL": "SELECT T2.p_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T1.courseLevel = 'Level_500' GROUP BY T2.p_id"
  },
  {
    "db_id": "computer_student",
    "question": "What courses are taught by a specific professor, say, with ID 123?",
    "evidence": "",
    "SQL": "SELECT course.course_id, course.courseLevel FROM course INNER JOIN taughtBy ON course.course_id = taughtBy.course_id WHERE taughtBy.p_id = 123"
  },
  {
    "db_id": "computer_student",
    "question": "How many students are advised by a professor who has taught 'Professional' courses?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id INNER JOIN taughtBy AS T3 ON T2.p_id = T3.p_id WHERE T3.course_id IN (SELECT course_id FROM course WHERE courseLevel = 'Level_500') AND T1.student = 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the number of students and professors combined who are affiliated with the faculty and also teach a course?",
    "evidence": "",
    "SQL": "SELECT COUNT(T1.p_id) FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T2.course_id WHERE T1.hasPosition = 'Faculty_aff' OR T1.professor = 1"
  },
  {
    "db_id": "computer_student",
    "question": "What are the professors who have advised at least 5 students in all phases?",
    "evidence": "",
    "SQL": "SELECT p_id FROM person WHERE p_id IN (SELECT p_id FROM advisedBy GROUP BY p_id HAVING COUNT(*) >= 5)"
  },
  {
    "db_id": "computer_student",
    "question": "What are the names of students who take courses taught by professors affiliated with the faculty?",
    "evidence": "",
    "SQL": "SELECT p.student FROM person AS p INNER JOIN advisedBy AS a ON p.p_id = a.p_id_dummy INNER JOIN taughtBy AS t ON a.p_id = t.p_id INNER JOIN course AS c ON t.course_id = c.course_id WHERE c.courseLevel = 'Level_300' AND p.inPhase != 'Completed'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the course name and course level taught by the professor who has the most number of students?",
    "evidence": "",
    "SQL": "SELECT C.course_id, C.courseLevel, COUNT(T1.p_id) AS numStudents FROM taughtBy AS T1 INNER JOIN course AS C ON T1.course_id = C.course_id INNER JOIN person AS P ON T1.p_id = P.p_id GROUP BY T1.course_id ORDER BY COUNT(T1.p_id) DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses taught by professors who teach at least two undergraduate courses?",
    "evidence": "",
    "SQL": "SELECT DISTINCT course_id FROM taughtBy WHERE p_id IN (SELECT p_id FROM taughtBy GROUP BY p_id HAVING COUNT(course_id) > 1)"
  },
  {
    "db_id": "computer_student",
    "question": "List the students who have a professor with multiple roles (both advisor and instructor) and have studied in level 400 courses?",
    "evidence": "",
    "SQL": "SELECT DISTINCT T1.student FROM person AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id_dummy INNER JOIN taughtBy AS T3 ON T1.p_id = T3.p_id WHERE T2.p_id_dummy IN (SELECT p_id FROM advisedBy GROUP BY p_id HAVING COUNT(*) > 1) AND T3.course_id IN (SELECT course_id FROM course WHERE courseLevel = 'Level_400')"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total years of experience of all professors who teach a course with a level of Level_200 or higher?",
    "evidence": "",
    "SQL": "SELECT SUM(yearsInProgram) FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T2.course_id WHERE T3.courseLevel = 'Level_200' AND T1.hasPosition = 'professor'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of courses taught by professors who have advised 3 or more students to teach?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM (SELECT T1.p_id FROM person AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id GROUP BY T1.p_id HAVING COUNT(T2.p_id) >= 3) AS T3 INNER JOIN taughtBy AS T4 ON T3.p_id = T4.p_id"
  },
  {
    "db_id": "computer_student",
    "question": "Which students are in the master/graduate phase and have not been advised by any professors?",
    "evidence": "",
    "SQL": "SELECT p_id FROM person WHERE inPhase = 'master/graduate' AND p_id NOT IN (SELECT p_id FROM advisedBy)"
  },
  {
    "db_id": "computer_student",
    "question": "What is the average yearsInProgram for students being advised by professors with hasPosition as Faculty?",
    "evidence": "",
    "SQL": "SELECT AVG(T2.yearsInProgram) FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.student = 1 AND T2.hasPosition = 'Faculty'"
  },
  {
    "db_id": "computer_student",
    "question": "Which professors taught a course with a course ID that is greater than 5?",
    "evidence": "",
    "SQL": "SELECT T1.p_id FROM taughtBy AS T1 WHERE T1.course_id > 5"
  },
  {
    "db_id": "computer_student",
    "question": "What courses are taught by the professors who have been in the program for more than 2 years?",
    "evidence": "",
    "SQL": "SELECT T3.course_id, T3.courseLevel FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T1.course_id WHERE T2.yearsInProgram > '2'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the average number of courses taught by each professor?",
    "evidence": "",
    "SQL": "SELECT CAST(COUNT(course_id) AS REAL) / COUNT(DISTINCT p_id) AS avgnum FROM taughtBy GROUP BY p_id"
  },
  {
    "db_id": "computer_student",
    "question": "For each course taught by a professor in the 4th year, what are the names of the students who are taught by this professor?",
    "evidence": "",
    "SQL": "SELECT P1.student, C1.course_id FROM taughtBy AS T1 INNER JOIN person AS P1 ON T1.p_id = P1.p_id INNER JOIN course AS C1 ON T1.course_id = C1.course_id WHERE P1.yearsInProgram = 'Year_4'"
  },
  {
    "db_id": "computer_student",
    "question": "What are the names of all faculty employees who advise at least one student?",
    "evidence": "",
    "SQL": "SELECT T3.p_id, T3.professor, T3.student, T3.hasPosition, T3.inPhase, T3.yearsInProgram FROM person AS T3 INNER JOIN advisedBy AS T1 ON T3.p_id = T1.p_id WHERE T3.hasPosition = 'Faculty_eme' GROUP BY T3.p_id, T3.professor, T3.student, T3.hasPosition, T3.inPhase, T3.yearsInProgram HAVING COUNT(T1.p_id_dummy) > 0"
  },
  {
    "db_id": "computer_student",
    "question": "What is the number of professors who taught at least one course?",
    "evidence": "",
    "SQL": "SELECT COUNT(DISTINCT p_id) FROM taughtBy"
  },
  {
    "db_id": "computer_student",
    "question": "What is the name of the professor who has taught the most number of 'Level_500' courses?",
    "evidence": "",
    "SQL": "SELECT p_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id GROUP BY p_id ORDER BY COUNT(T2.course_id) DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the course level of the course taught by professor with ID 141?",
    "evidence": "",
    "SQL": "SELECT courseLevel FROM course INNER JOIN taughtBy ON course.course_id = taughtBy.course_id WHERE taughtBy.p_id = 141"
  },
  {
    "db_id": "computer_student",
    "question": "What is the level of course 10?",
    "evidence": "",
    "SQL": "SELECT courseLevel FROM course WHERE course_id = 10"
  },
  {
    "db_id": "computer_student",
    "question": "What is the course level of courses taught by the professor who is advising a student with ID 312?",
    "evidence": "",
    "SQL": "SELECT T3.courseLevel FROM course AS T3 INNER JOIN taughtBy AS T1 ON T3.course_id = T1.course_id INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN advisedBy AS T4 ON T2.p_id = T4.p_id WHERE T4.p_id_dummy = 312"
  },
  {
    "db_id": "computer_student",
    "question": "What is the course ID of the course taught by professor '305'?",
    "evidence": "",
    "SQL": "SELECT course_id FROM taughtBy WHERE p_id = 305"
  },
  {
    "db_id": "computer_student",
    "question": "What courses are taught by professors who have been in the program for less than 3 years?",
    "evidence": "",
    "SQL": "SELECT C.course_id FROM taughtBy AS T1 INNER JOIN course AS C ON T1.course_id = C.course_id INNER JOIN person AS P ON T1.p_id = P.p_id WHERE P.hasPosition = 'professor' AND P.yearsInProgram < '3_years'"
  },
  {
    "db_id": "computer_student",
    "question": "What professors have taught at least one course at the undergraduate level?",
    "evidence": "",
    "SQL": "SELECT DISTINCT T2.p_id FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T1.course_id WHERE T3.courseLevel = 'Level_300'"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses taught by all the professors who have taught at least 5 courses?",
    "evidence": "",
    "SQL": "SELECT DISTINCT T3.course_id FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T1.course_id GROUP BY T3.course_id HAVING COUNT(DISTINCT T1.p_id) >= 5"
  },
  {
    "db_id": "computer_student",
    "question": "Who has taught the most number of courses?",
    "evidence": "",
    "SQL": "SELECT p_id, COUNT(*) AS total_courses FROM taughtBy GROUP BY p_id ORDER BY total_courses DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the average number of students in a course taught by a faculty who teaches both undergraduate and graduate level courses?",
    "evidence": "",
    "SQL": "SELECT AVG(student) FROM taughtBy AS T1 JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.hasPosition = 'Faculty_eme' AND T2.p_id IN (SELECT p_id FROM person WHERE inPhase != '')"
  },
  {
    "db_id": "computer_student",
    "question": "What is the number of courses taught by professors who advise at least one student?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM taughtBy INNER JOIN person AS T2 ON taughtBy.p_id = T2.p_id WHERE T2.hasPosition = 'Adviser'"
  },
  {
    "db_id": "computer_student",
    "question": "Which courses have a higher course level than the course 'CS 101'?",
    "evidence": "",
    "SQL": "SELECT * FROM course WHERE courseLevel > (SELECT courseLevel FROM course WHERE course_id = 'CS 101')"
  },
  {
    "db_id": "computer_student",
    "question": "List the course IDs and levels of all courses taught by a professor with a professor ID between 30 and 40",
    "evidence": "",
    "SQL": "SELECT T1.course_id, T1.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T2.p_id BETWEEN 30 AND 40"
  },
  {
    "db_id": "computer_student",
    "question": "What are the IDs of the courses taught by a student who is in the program more than 1 year?",
    "evidence": "",
    "SQL": "SELECT T2.course_id FROM taughtBy AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T1.p_id = T3.p_id WHERE T3.student = 1 AND T3.yearsInProgram > 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the list of courses taught by students?",
    "evidence": "",
    "SQL": "SELECT course_id FROM course CROSS JOIN person WHERE course_id NOT IN (SELECT course_id FROM taughtBy)"
  },
  {
    "db_id": "computer_student",
    "question": "What are the course levels of the courses taught by professors who have at least one faculty-affiliated course?",
    "evidence": "",
    "SQL": "SELECT distinct T3.courseLevel FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T2.course_id WHERE T1.hasPosition = 'Faculty_aff'"
  },
  {
    "db_id": "computer_student",
    "question": "How many students in the program are not advised by a professor in their same phase?",
    "evidence": "",
    "SQL": "SELECT COUNT(DISTINCT T1.p_id) FROM person AS T1 LEFT JOIN advisedBy AS T2 ON T1.p_id = T2.p_id_dummy WHERE T2.p_id_dummy IS NULL AND T1.hasPosition != ''"
  },
  {
    "db_id": "computer_student",
    "question": "Who are the students that are in phase 1 and have been in the program for more than 2 years?",
    "evidence": "",
    "SQL": "SELECT p_id FROM person WHERE inPhase = '1' AND yearsInProgram > '2'"
  },
  {
    "db_id": "computer_student",
    "question": "What are the professor IDs who teach courses at the advanced level and have a position status?",
    "evidence": "",
    "SQL": "SELECT T1.p_id FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T2.course_id WHERE T3.courseLevel = 'Advanced' AND T1.hasPosition <> 0"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses taught by a professor who has taught a course with a level less than 400?",
    "evidence": "",
    "SQL": "SELECT DISTINCT T1.course_id, T1.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T2.p_id = T3.p_id WHERE T3.p_id IN (SELECT p_id FROM person WHERE hasPosition = 'Professor') AND T1.courseLevel < 400"
  },
  {
    "db_id": "computer_student",
    "question": "What is the highest level of course taught by professor ID 297?",
    "evidence": "",
    "SQL": "SELECT MAX(T1.courseLevel) FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T2.p_id = 297"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses taught by advisors who have at least one position and are also students themselves?",
    "evidence": "",
    "SQL": "SELECT DISTINCT T3.course_id FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN taughtBy AS T3 ON T2.p_id = T3.p_id WHERE T2.hasPosition IS NOT NULL AND T2.student = 1"
  },
  {
    "db_id": "computer_student",
    "question": "What are the course levels of courses taught by students who are currently in the pre-qualification phase?",
    "evidence": "",
    "SQL": "SELECT courseLevel FROM course WHERE course_id IN (SELECT T1.course_id FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.inPhase = 'Pre_Quals')"
  },
  {
    "db_id": "computer_student",
    "question": "What are all the courses taught by the professors who also teach 3 or more Level 400 courses?",
    "evidence": "",
    "SQL": "SELECT T1.course_id, T2.courseLevel FROM taughtBy AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id INNER JOIN taughtBy AS T3 ON T1.p_id = T3.p_id INNER JOIN course AS T4 ON T3.course_id = T4.course_id WHERE T4.courseLevel = 'Level_400' GROUP BY T1.course_id, T2.courseLevel HAVING COUNT(DISTINCT T3.course_id) > 2"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses taught by professors with more than 2 years of experience?",
    "evidence": "",
    "SQL": "SELECT T1.course_id, T1.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T2.p_id = T3.p_id WHERE T3.yearsInProgram > 2"
  },
  {
    "db_id": "computer_student",
    "question": "What is the average course level of courses taught by a particular professor?",
    "evidence": "",
    "SQL": "SELECT AVG(T3.courseLevel) AS avg_level FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T1.course_id GROUP BY T2.p_id"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses taught by a professor who advises a student that is in the third phase?",
    "evidence": "",
    "SQL": "SELECT T1.course_id, T1.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T2.p_id = T3.p_id INNER JOIN advisedBy AS T4 ON T3.p_id = T4.p_id INNER JOIN person AS T5 ON T4.p_id_dummy = T5.p_id WHERE T5.inPhase = 'Phase_3' GROUP BY T1.course_id, T1.courseLevel"
  },
  {
    "db_id": "computer_student",
    "question": "What are the years in programs of professors who taught course 'Data Structures'?",
    "evidence": "",
    "SQL": "SELECT T2.yearsInProgram FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.professor = 1 AND T1.course_id IN (SELECT course_id FROM course WHERE courseLevel = 'Data Structures')"
  },
  {
    "db_id": "computer_student",
    "question": "What is the course level of all courses taught by professors who also have another advisor?",
    "evidence": "",
    "SQL": "SELECT course.courseLevel FROM course INNER JOIN taughtBy ON course.course_id = taughtBy.course_id INNER JOIN person ON taughtBy.p_id = person.p_id WHERE person.hasPosition = 'Professor' AND (SELECT COUNT(*) FROM advisedBy WHERE p_id = person.p_id) > 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the count of courses taught by professors who have 'Faculty_employee' as their position?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T2.course_id WHERE T1.hasPosition = 'Faculty_employee'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of professors who teach courses of level 'Introductory'?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) AS total FROM person AS T1 JOIN taughtBy AS T2 ON T1.p_id = T2.p_id WHERE T2.course_id IN (SELECT course_id FROM course WHERE courseLevel = 'Introductory') AND T1.student = 0"
  },
  {
    "db_id": "computer_student",
    "question": "Which courses are taught by both professor no. 79 and professor no. 21?",
    "evidence": "",
    "SQL": "SELECT T1.course_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T2.p_id IN (79, 21) GROUP BY T1.course_id HAVING COUNT(DISTINCT T2.p_id) = 2"
  },
  {
    "db_id": "computer_student",
    "question": "What courses does professor with id 123 teach?",
    "evidence": "",
    "SQL": "SELECT T1.course_id FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.p_id = 123"
  },
  {
    "db_id": "computer_student",
    "question": "How many students in the program have no position or advisory role?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person WHERE hasPosition IS NULL OR hasPosition = ''"
  },
  {
    "db_id": "computer_student",
    "question": "What courses are being taught by students with at least 1 year of program experience?",
    "evidence": "",
    "SQL": "SELECT T1.course_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T2.p_id = T3.p_id WHERE T3.inPhase = 'yearsInProgram' AND T3.yearsInProgram != '0'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the average number of courses taught by professors who teach basic undergraduate courses?",
    "evidence": "",
    "SQL": "SELECT CAST(COUNT(T1.course_id) AS REAL) / COUNT(DISTINCT T2.p_id) FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T1.courseLevel = 'Level_100'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the level of the course taught by the professor with ID 3?",
    "evidence": "",
    "SQL": "SELECT courseLevel FROM course INNER JOIN taughtBy ON course.course_id = taughtBy.course_id WHERE taughtBy.p_id = 3"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of professors and students who taught in a course with a course ID less than 5?",
    "evidence": "",
    "SQL": "SELECT COUNT(T1.p_id) AS TotalCount, COUNT(T2.p_id) AS StudentCount FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T2.course_id WHERE T3.course_id < 5"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses taught by professors who are also students in the program?",
    "evidence": "",
    "SQL": "SELECT T3.course_id, T3.courseLevel FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T1.course_id WHERE T2.student = 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the highest level of the courses taught by professors who have been teaching for more than 2 years?",
    "evidence": "",
    "SQL": "SELECT MAX(courseLevel) FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T2.p_id = T3.p_id WHERE T3.yearsInProgram > 2"
  },
  {
    "db_id": "computer_student",
    "question": "What courses has more than one professor taught?",
    "evidence": "",
    "SQL": "SELECT course_id FROM taughtBy GROUP BY course_id HAVING COUNT(p_id) > 1"
  },
  {
    "db_id": "computer_student",
    "question": "Who are the professors teaching courses with level higher than Level_300?",
    "evidence": "",
    "SQL": "SELECT T2.p_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T1.courseLevel > 'Level_300'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the minimum years of experience of faculty members who teach at least one course at the Level_400 or Level_500 level?",
    "evidence": "",
    "SQL": "SELECT MIN(yearsInProgram) FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id WHERE T2.course_id IN (SELECT course_id FROM course WHERE courseLevel = 'Level_400' OR courseLevel = 'Level_500') AND T1.hasPosition = 'Faculty_eme'"
  },
  {
    "db_id": "computer_student",
    "question": "How many students are advised to teach by a professor who teaches basic courses?",
    "evidence": "",
    "SQL": "SELECT COUNT(DISTINCT T4.p_id) FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T2.course_id INNER JOIN advisedBy AS T4 ON T4.p_id = T1.p_id WHERE T1.professor = 1 AND T3.courseLevel = 'Level_200'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of courses taught by a professor with 'professor' status in the course level of 'Level_100'?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T1.course_id = T3.course_id WHERE T2.hasPosition = 'professor' AND T3.courseLevel = 'Level_100'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the course level for all courses taught by a professor who has been in the program for more than 10 years?",
    "evidence": "",
    "SQL": "SELECT T1.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T2.p_id = T3.p_id WHERE T3.yearsInProgram > 10"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses taught by professors who are faculty employees and at the level of 500?",
    "evidence": "",
    "SQL": "SELECT T3.course_id, T3.courseLevel FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T1.course_id WHERE T2.hasPosition = 'Faculty_eme' AND T3.courseLevel = 'Level_500'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the number of students who are being advised by a person who is also teaching a course?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id_dummy INNER JOIN taughtBy AS T3 ON T2.p_id = T3.p_id WHERE T1.student = 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the list of all professors who have advised at least one student?",
    "evidence": "",
    "SQL": "SELECT p_id FROM person WHERE hasPosition = 'Professor' INTERSECT SELECT p_id FROM advisedBy"
  },
  {
    "db_id": "computer_student",
    "question": "Which students are not advised by a professor?",
    "evidence": "",
    "SQL": "SELECT p_id FROM person WHERE p_id NOT IN (SELECT p_id FROM advisedBy)"
  },
  {
    "db_id": "computer_student",
    "question": "What is the average number of courses taught by professors who have a Ph.D.?",
    "evidence": "",
    "SQL": "SELECT AVG(T1.course_id) FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T3.p_id = T2.p_id WHERE T3.hasPosition = 'Ph.D.'"
  },
  {
    "db_id": "computer_student",
    "question": "What course levels do professors with advisor positions have taught?",
    "evidence": "",
    "SQL": "SELECT DISTINCT T1.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T2.p_id = T3.p_id WHERE T3.hasPosition = 'Advisor' ORDER BY T1.courseLevel"
  },
  {
    "db_id": "computer_student",
    "question": "What is the name of courses taught by professors with more than 3 students?",
    "evidence": "",
    "SQL": "SELECT C.course_id, C.courseLevel FROM course AS C INNER JOIN taughtBy AS T ON C.course_id = T.course_id INNER JOIN person AS P ON T.p_id = P.p_id GROUP BY C.course_id, C.courseLevel HAVING COUNT(P.student) > 3"
  },
  {
    "db_id": "computer_student",
    "question": "What is the list of courses taught by professors with more than 2 years of experience?",
    "evidence": "",
    "SQL": "SELECT course_id FROM taughtBy, person WHERE taughtBy.p_id = person.p_id AND person.hasPosition='professor' AND person.yearsInProgram > '2'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the level of the course that Professor No. 80 is teaching?",
    "evidence": "",
    "SQL": "SELECT courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T2.p_id = 80"
  },
  {
    "db_id": "computer_student",
    "question": "Who are the students in Year 3 of the program and do they have a position?",
    "evidence": "",
    "SQL": "SELECT T1.p_id, T1.hasPosition FROM person AS T1 WHERE T1.yearsInProgram = 'Year_3' AND T1.student = 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of students in the Level_200 program?",
    "evidence": "",
    "SQL": "SELECT COUNT(p_id) FROM person AS T1 INNER JOIN course AS T2 ON T1.student = 1 WHERE T2.course_id IN (SELECT course_id FROM course WHERE courseLevel = 'Level_200')"
  },
  {
    "db_id": "computer_student",
    "question": "List the courses taught by professors in Phase 1?",
    "evidence": "",
    "SQL": "SELECT course.course_id, course.courseLevel FROM course INNER JOIN taughtBy ON course.course_id = taughtBy.course_id INNER JOIN person ON taughtBy.p_id = person.p_id WHERE person.inPhase = 'Phase 1' ORDER BY course.courseLevel"
  },
  {
    "db_id": "computer_student",
    "question": "What is the average number of years a student stays in a program?",
    "evidence": "",
    "SQL": "SELECT AVG(CAST(yearsInProgram AS REAL)) AS avgyears FROM person WHERE hasPosition = 'student'"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses taught by professors who have been in the program for at least 5 years?",
    "evidence": "",
    "SQL": "SELECT DISTINCT T2.course_id FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id WHERE T1.professor = 1 AND T1.yearsInProgram > 5"
  },
  {
    "db_id": "computer_student",
    "question": "What are the names of all professors who taught a basic or medium undergraduate course?",
    "evidence": "",
    "SQL": "SELECT T1.p_id, T1.professor FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T2.course_id WHERE T3.courseLevel IN ('Level_100', 'Level_200')"
  },
  {
    "db_id": "computer_student",
    "question": "Which students are advised by professors who teach Level_400 courses?",
    "evidence": "",
    "SQL": "SELECT distinct p_id FROM person as T1 WHERE p_id in (SELECT p_id FROM taughtBy as T2 where T2.course_id in (SELECT course_id FROM course as T3 where T3.courseLevel = 'Level_400')) AND p_id in (SELECT p_id FROM advisedBy as T4)"
  },
  {
    "db_id": "computer_student",
    "question": "What professors have taught courses in the 4th year of the program?",
    "evidence": "",
    "SQL": "SELECT p_id FROM taughtBy AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T2.courseLevel = '4th Year' GROUP BY p_id"
  },
  {
    "db_id": "computer_student",
    "question": "What courses were taught by the professor who taught a course that a person with eighth year of program and position status in faculty took?",
    "evidence": "",
    "SQL": "SELECT T1.course_id FROM taughtBy AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id INNER JOIN advisedBy AS T3 ON T2.course_id = T3.p_id_dummy INNER JOIN person AS T4 ON T3.p_id = T4.p_id WHERE T4.yearsInProgram = 'Year_8' AND T4.hasPosition = 'position status in faculty'"
  },
  {
    "db_id": "computer_student",
    "question": "List all courses taught by a professor with a 'hasPosition' of 'Professor'?",
    "evidence": "",
    "SQL": "SELECT C.courseLevel FROM course C INNER JOIN taughtBy T ON C.course_id = T.course_id INNER JOIN person P ON T.p_id = P.p_id WHERE P.hasPosition = 'Professor'"
  },
  {
    "db_id": "computer_student",
    "question": "List the IDs and names of students in the first phase of program who have taken a course that has been taught by a professor with the position of Department Chair",
    "evidence": "",
    "SQL": "SELECT P.p_id, P.student FROM person P JOIN advisedBy AB ON P.p_id = AB.p_id_dummy JOIN course C ON AB.p_id = C.course_id JOIN taughtBy TB ON C.course_id = TB.course_id WHERE P.inPhase = 'Phase_1' AND TB.p_id IN (SELECT p_id FROM person WHERE hasPosition = 'Department_Chair')"
  },
  {
    "db_id": "computer_student",
    "question": "Which students are advised by a professor who has taught course ID 104?",
    "evidence": "",
    "SQL": "SELECT S.p_id FROM person AS S INNER JOIN advisedBy AS AB ON S.p_id = AB.p_id_dummy INNER JOIN taughtBy AS T ON AB.p_id = T.p_id WHERE T.course_id = 104"
  },
  {
    "db_id": "computer_student",
    "question": "What are all the professors that advise students in Level 400 courses?",
    "evidence": "",
    "SQL": "SELECT P.p_id FROM person AS P INNER JOIN advisedBy AS AB ON P.p_id = AB.p_id INNER JOIN course AS C ON C.course_id = AB.p_id_dummy WHERE C.courseLevel = 'Level_400'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the count of courses that are taught by a professor who has been a member of faculty for more than 5 years?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id WHERE T1.professor = 1 AND T1.yearsInProgram > '5' GROUP BY T1.p_id"
  },
  {
    "db_id": "computer_student",
    "question": "What course do professors who have been in the program for more than 5 years teach?",
    "evidence": "",
    "SQL": "SELECT T1.course_id FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.yearsInProgram LIKE '%Year_5%' GROUP BY T1.course_id HAVING COUNT(T1.course_id) > 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the ID of the first course with level 'Undergraduate' and the professor who teaches it?",
    "evidence": "",
    "SQL": "SELECT T1.course_id, T1.courseLevel, T2.p_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T1.courseLevel = 'Undergraduate' ORDER BY T1.course_id LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What are all the courses taught by a faculty member who has a student advisee in phase 1?",
    "evidence": "",
    "SQL": "SELECT course_id FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.hasPosition = 1 AND T2.inPhase = 'Phase_1'"
  },
  {
    "db_id": "computer_student",
    "question": "What are all the courses taught by professors who advise students in the 3rd year?",
    "evidence": "",
    "SQL": "SELECT T2.course_id, T2.courseLevel FROM taughtBy AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id INNER JOIN advisedBy AS T3 ON T2.course_id = T3.p_id_dummy INNER JOIN person AS T4 ON T3.p_id = T4.p_id WHERE T4.yearsInProgram = 'Year_3'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of courses taught by students and what is the average course level for these courses?",
    "evidence": "",
    "SQL": "SELECT COUNT(T2.course_id) AS Total_Courses, AVG(T3.courseLevel) AS Avg_Course_Level FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T2.course_id WHERE T1.student = 1 GROUP BY T1.student"
  },
  {
    "db_id": "computer_student",
    "question": "What is the maximum number of students a professor advises?",
    "evidence": "",
    "SQL": "SELECT MAX(T2.p_id) FROM person AS T2 WHERE hasPosition = 'professor' AND student IS NOT NULL"
  },
  {
    "db_id": "computer_student",
    "question": "What is the number of professors who teach more than one course?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id GROUP BY T2.p_id HAVING COUNT(T2.course_id) > 1"
  },
  {
    "db_id": "computer_student",
    "question": "What courses are taught by the professors who are currently in their fourth year?",
    "evidence": "",
    "SQL": "SELECT course.course_id FROM course INNER JOIN taughtBy ON course.course_id = taughtBy.course_id INNER JOIN person ON taughtBy.p_id = person.p_id WHERE person.inPhase = '4th_year'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the average number of courses taught by each professor?",
    "evidence": "",
    "SQL": "SELECT AVG(T2.p_id) FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id"
  },
  {
    "db_id": "computer_student",
    "question": "What is the average number of students a professor advises?",
    "evidence": "",
    "SQL": "SELECT CAST(COUNT(DISTINCT T1.p_id) AS REAL) / COUNT(DISTINCT T2.p_id) AS num FROM person AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of students and professors in the university?",
    "evidence": "",
    "SQL": "SELECT COUNT(p_id) AS Total_People FROM person WHERE inPhase = 'notGraduated'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the name of the professor who taught the most number of courses and what is the person's phase in the university?",
    "evidence": "",
    "SQL": "SELECT T1.p_id, T1.inPhase FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id GROUP BY T1.p_id ORDER BY COUNT(T2.course_id) DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What are the names of the students who are not in their last phase of the program?",
    "evidence": "",
    "SQL": "SELECT inPhase FROM person WHERE yearsInProgram != inPhase"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses that have been taught by both professor John and professor Jane?",
    "evidence": "",
    "SQL": "SELECT course.course_id, course.courseLevel FROM course INNER JOIN taughtBy AS T1 ON course.course_id = T1.course_id WHERE T1.p_id IN (SELECT p_id FROM person WHERE p_id = 'John' OR p_id = 'Jane') GROUP BY course.course_id, course.courseLevel HAVING COUNT(DISTINCT T1.p_id) = 2"
  },
  {
    "db_id": "computer_student",
    "question": "Which students are advised by a faculty member who teaches a course of level Level_400 or higher?",
    "evidence": "",
    "SQL": "SELECT distinct T1.p_id FROM person AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id INNER JOIN taughtBy AS T3 ON T2.p_id_dummy = T3.p_id INNER JOIN course AS T4 ON T3.course_id = T4.course_id WHERE T4.courseLevel = 'Level_400' OR T4.courseLevel = 'Level_500'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the number of students who have at least one course taught by a professor with a 'Professionally Oriented' level of course?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM advisedBy AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T3.courseLevel = 'Professionally Oriented'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the average number of years students have been in the program?",
    "evidence": "",
    "SQL": "SELECT AVG(yearsInProgram) FROM person WHERE inPhase = 'Graduated'"
  },
  {
    "db_id": "computer_student",
    "question": "What are the course IDs for courses taught by person ID 50?",
    "evidence": "",
    "SQL": "SELECT course_id FROM taughtBy WHERE p_id = 50"
  },
  {
    "db_id": "computer_student",
    "question": "List the ID of all students in a master/graduate phase",
    "evidence": "",
    "SQL": "SELECT p_id FROM person WHERE inPhase = 'Master/Graduate'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the course level for all courses taught by Professor 1?",
    "evidence": "",
    "SQL": "SELECT course.courseLevel FROM course INNER JOIN taughtBy ON course.course_id = taughtBy.course_id INNER JOIN person ON taughtBy.p_id = person.p_id WHERE person.professor = 1"
  },
  {
    "db_id": "computer_student",
    "question": "Who is the professor that teaches the most courses?",
    "evidence": "",
    "SQL": "SELECT p_id, COUNT(*) as total_courses FROM taughtBy GROUP BY p_id ORDER BY total_courses DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses taught by professors who are not students?",
    "evidence": "",
    "SQL": "SELECT DISTINCT T1.course_id FROM taughtBy AS T1 JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.student = 0"
  },
  {
    "db_id": "computer_student",
    "question": "What is the number of courses taught by each professor who has taught at least one undergraduate course?",
    "evidence": "",
    "SQL": "SELECT T1.p_id, COUNT(T2.course_id) AS course_count FROM person AS T1 LEFT JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T3.courseLevel = 'Level_200' OR T3.courseLevel = 'Level_300' OR T3.courseLevel = 'Level_400' GROUP BY T1.p_id"
  },
  {
    "db_id": "computer_student",
    "question": "What is the number of students who are taking a course taught by a professor in the 5th year of their program?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM taughtBy AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T1.p_id = T3.p_id WHERE T3.yearsInProgram = 'Year_5'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the average number of years in the program for students who are in a phase?",
    "evidence": "",
    "SQL": "SELECT AVG(yearsInProgram) FROM person WHERE inPhase != 'Phase-null' AND student = 1"
  },
  {
    "db_id": "computer_student",
    "question": "What are the names of all students in their first year of the program?",
    "evidence": "",
    "SQL": "SELECT * FROM person WHERE yearsInProgram = 'Year_1'"
  },
  {
    "db_id": "computer_student",
    "question": "What are the names of all courses taught by professors in the faculty of engineering?",
    "evidence": "",
    "SQL": "SELECT T3.course_id, T3.courseLevel FROM course AS T3 INNER JOIN taughtBy AS T2 ON T3.course_id = T2.course_id INNER JOIN person AS T1 ON T2.p_id = T1.p_id WHERE T1.hasPosition = 'Faculty_eng' GROUP BY T3.course_id, T3.courseLevel ORDER BY T3.course_id"
  },
  {
    "db_id": "computer_student",
    "question": "What is the number of faculty employees who taught at least two courses for undergraduate students?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id GROUP BY T1.p_id HAVING COUNT(T2.course_id) >= 2"
  },
  {
    "db_id": "computer_student",
    "question": "Which professors are teaching more than one course?",
    "evidence": "",
    "SQL": "SELECT p_id FROM (SELECT p_id, COUNT(*) AS num_courses FROM taughtBy GROUP BY p_id) AS T WHERE num_courses > 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the highest level of course taught by a faculty member who has been a professor for at least 5 years?",
    "evidence": "",
    "SQL": "SELECT MAX(T1.courseLevel) FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T2.p_id = T3.p_id WHERE T3.professor = 1 AND T3.yearsInProgram >= '5_Year'"
  },
  {
    "db_id": "computer_student",
    "question": "What are the total number of students in the university who have a professor and a student?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person WHERE student = 1 AND professor = 1"
  },
  {
    "db_id": "computer_student",
    "question": "Which teachers are teaching courses that are at the intermediate level?",
    "evidence": "",
    "SQL": "SELECT T1.p_id FROM taughtBy AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T2.courseLevel = 'Intermediate'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the number of students who are in phase 'Phase B'?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person WHERE inPhase = 'Phase B' AND student = 1"
  },
  {
    "db_id": "computer_student",
    "question": "Who taught a course that a student who gave advice to another student taught?",
    "evidence": "",
    "SQL": "SELECT T1.p_id FROM taughtBy AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id_dummy INNER JOIN taughtBy AS T3 ON T2.p_id = T3.p_id WHERE T1.course_id IN (SELECT course_id FROM taughtBy WHERE p_id IN (SELECT p_id FROM advisedBy WHERE p_id = T3.p_id)) GROUP BY T1.p_id"
  },
  {
    "db_id": "computer_student",
    "question": "What are the total number of students enrolled in the courses taught by a professor and not teaching any other course?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.student = 1 AND NOT EXISTS (SELECT 1 FROM taughtBy AS T3 WHERE T3.p_id = T1.p_id)"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of students enrolled in courses taught by professors who have advised more than 5 others to teach?",
    "evidence": "",
    "SQL": "SELECT COUNT(student) FROM person AS T1 JOIN taughtBy AS T2 ON T1.p_id = T2.p_id JOIN advisedBy AS T3 ON T1.p_id = T3.p_id_dummy GROUP BY T1.student HAVING COUNT(T3.p_id_dummy) > 5"
  },
  {
    "db_id": "computer_student",
    "question": "How many courses taught by Professor 2 are on the level of Level_200?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM taughtBy AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T1.p_id = 2 AND T2.courseLevel = 'Level_200'"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses taught by both 'Professor A' and 'Professor B'?",
    "evidence": "",
    "SQL": "SELECT DISTINCT T1.course_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE (T2.p_id IN (SELECT p_id FROM person WHERE hasPosition = 'Professor A')) AND (T2.p_id IN (SELECT p_id FROM person WHERE hasPosition = 'Professor B'))"
  },
  {
    "db_id": "computer_student",
    "question": "What are all the professors who advised a student who is also a professor?",
    "evidence": "",
    "SQL": "SELECT p1.p_id FROM person AS p1 INNER JOIN advisedBy AS p2 ON p1.p_id = p2.p_id_dummy INNER JOIN person AS p3 ON p2.p_id = p3.p_id WHERE p3.professor IS NOT NULL"
  },
  {
    "db_id": "computer_student",
    "question": "What are the IDs of the students who are not advised by their professors?",
    "evidence": "",
    "SQL": "SELECT person.p_id FROM person LEFT JOIN advisedBy ON person.p_id = advisedBy.p_id WHERE advisedBy.p_id IS NULL"
  },
  {
    "db_id": "computer_student",
    "question": "What courses are taught by professors who have been in the program for more than 3 years?",
    "evidence": "",
    "SQL": "SELECT course_id FROM taughtBy WHERE p_id IN (SELECT p_id FROM person WHERE yearsInProgram NOT LIKE '%0%') GROUP BY course_id"
  },
  {
    "db_id": "computer_student",
    "question": "What is the maximum number of courses taught by a professor?",
    "evidence": "",
    "SQL": "SELECT MAX(T2.course_id) FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id"
  },
  {
    "db_id": "computer_student",
    "question": "What courses are taught by professors who have a 'student' status?",
    "evidence": "",
    "SQL": "SELECT T3.course_id, T3.courseLevel FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T1.course_id WHERE T2.student = 'student'"
  },
  {
    "db_id": "computer_student",
    "question": "Which professors taught courses that have both Level_300 and Level_400 courses?",
    "evidence": "",
    "SQL": "SELECT DISTINCT p_id FROM taughtBy WHERE course_id IN (SELECT course_id FROM course WHERE courseLevel = 'Level_300') AND course_id IN (SELECT course_id FROM course WHERE courseLevel = 'Level_400')"
  },
  {
    "db_id": "computer_student",
    "question": "What are the names of students who are being advised by a professor who taught more than one course?",
    "evidence": "",
    "SQL": "SELECT T1.p_id, T1.student FROM person AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id_dummy INNER JOIN (SELECT p_id, COUNT(*) AS course_count FROM taughtBy GROUP BY p_id HAVING COUNT(*) > 1) AS T3 ON T1.p_id = T3.p_id"
  },
  {
    "db_id": "computer_student",
    "question": "What is the name of the professor who teaches most courses?",
    "evidence": "",
    "SQL": "SELECT p_id FROM taughtBy GROUP BY p_id ORDER BY COUNT(course_id) DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What are the names of all faculty employees who teach a course with the course ID greater than 17?",
    "evidence": "",
    "SQL": "SELECT T3.p_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T3.p_id = T2.p_id WHERE T1.course_id > 17 AND T3.hasPosition = 'Faculty_eme'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the number of students advised by the professors who taught course 'Introduction to Computer Science'?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T3.courseLevel = 'Introduction to Computer Science' AND T1.student = 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the list of students who are advised by a professor who has been teaching for more than 5 years?",
    "evidence": "",
    "SQL": "SELECT T2.p_id FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN taughtBy AS T3 ON T2.p_id = T3.p_id INNER JOIN course AS T4 ON T3.course_id = T4.course_id WHERE T4.courseLevel = 'Level_500' GROUP BY T2.p_id"
  },
  {
    "db_id": "computer_student",
    "question": "Which students are advised by a professor who taught a course of level 'Level_400'?",
    "evidence": "",
    "SQL": "SELECT T1.p_id FROM person AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id INNER JOIN taughtBy AS T3 ON T2.p_id_dummy = T3.p_id INNER JOIN course AS T4 ON T3.course_id = T4.course_id WHERE T4.courseLevel = 'Level_400'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of years of experience of all professors in the program?",
    "evidence": "",
    "SQL": "SELECT SUM(LENGTH(yearsInProgram) - LENGTH(REPLACE(yearsInProgram, ' ', ''))) / LENGTH('y') AS totalYears FROM person WHERE professor = 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the number of students that are advised by a professor who taught a course with course ID less than 10 and a course level of 'Level_400'?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id INNER JOIN taughtBy AS T3 ON T2.p_id = T3.p_id INNER JOIN course AS T4 ON T3.course_id = T4.course_id WHERE T4.courseLevel = 'Level_400' AND T4.course_id < 10"
  },
  {
    "db_id": "computer_student",
    "question": "What are the IDs of all professors who teach courses in Level 300 and above?",
    "evidence": "",
    "SQL": "SELECT T1.p_id FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T2.course_id WHERE T3.courseLevel >= 'Level_300'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the course level of the course taught by Professor with ID 30?",
    "evidence": "",
    "SQL": "SELECT T1.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T2.p_id = 30"
  },
  {
    "db_id": "computer_student",
    "question": "What is the list of courses taught by a specific professor?",
    "evidence": "",
    "SQL": "SELECT course_id FROM taughtBy WHERE p_id = (SELECT p_id FROM person WHERE professor = 1)"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of courses taught by professors with the degree of Level_500?",
    "evidence": "",
    "SQL": "SELECT COUNT(T2.course_id) FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T1.courseLevel = 'Level_500'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the name of the course taught by a professor who has taught at least 3 courses at the level 400?",
    "evidence": "",
    "SQL": "SELECT course.course_id, course.courseLevel FROM course INNER JOIN taughtBy ON course.course_id = taughtBy.course_id GROUP BY course.course_id, course.courseLevel HAVING COUNT(taughtBy.p_id) >= 3"
  },
  {
    "db_id": "computer_student",
    "question": "Which students are advised by the same advisor?",
    "evidence": "",
    "SQL": "SELECT p2.p_id, p1.p_id FROM person AS p1 INNER JOIN advisedBy AS ab ON p1.p_id = ab.p_id_dummy INNER JOIN person AS p2 ON p2.p_id = ab.p_id WHERE p1.inPhase = 'Phase_1' AND p2.inPhase = 'Phase_1'"
  },
  {
    "db_id": "computer_student",
    "question": "Who are the students who have the same mentor?",
    "evidence": "",
    "SQL": "SELECT DISTINCT T1.p_id, T2.p_id FROM advisedBy AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id_dummy = T2.p_id_dummy WHERE T1.p_id != T2.p_id"
  },
  {
    "db_id": "computer_student",
    "question": "What are the names of all students who have at least one advisor?",
    "evidence": "",
    "SQL": "SELECT s.p_id FROM person s JOIN advisedBy a ON s.p_id = a.p_id_dummy WHERE s.student = 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the list of courses taught by professors with more than 5 years of experience?",
    "evidence": "",
    "SQL": "SELECT T1.course_id, T1.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T3.p_id = T2.p_id WHERE T3.yearsInProgram > 5"
  },
  {
    "db_id": "computer_student",
    "question": "What professors teach Level 400 courses?",
    "evidence": "",
    "SQL": "SELECT T2.p_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T1.courseLevel = 'Level_400'"
  },
  {
    "db_id": "computer_student",
    "question": "What are all the course IDs taught by a professor who has less than 5 years of experience in the program?",
    "evidence": "",
    "SQL": "SELECT DISTINCT T1.course_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T2.p_id = T3.p_id WHERE T3.yearsInProgram < 5"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of professors who teach courses in the Level_400 category?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T2.p_id IN (SELECT p_id FROM person WHERE professor = 1) AND T1.courseLevel = 'Level_400'"
  },
  {
    "db_id": "computer_student",
    "question": "What are the IDs of students who are in their first year and being advised by at least one professor?",
    "evidence": "",
    "SQL": "SELECT distinct P2.p_id FROM person AS P1 INNER JOIN advisedBy AS P2 ON P1.p_id = P2.p_id WHERE P1.student = 1 GROUP BY P2.p_id HAVING COUNT(P2.p_id_dummy) > 0"
  },
  {
    "db_id": "computer_student",
    "question": "Who taught the most number of professional or master/graduate courses?",
    "evidence": "",
    "SQL": "SELECT T2.p_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T1.courseLevel = 'Level_500' GROUP BY T2.p_id ORDER BY COUNT(T2.course_id) DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the course id of the courses taught by a professor with a professor id greater than 10 and less than or equal to 15?",
    "evidence": "",
    "SQL": "SELECT course_id FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.professor BETWEEN 10 AND 15"
  },
  {
    "db_id": "computer_student",
    "question": "Which students are being advised by a professor who teaches the 'Introduction to Data Structures' course?",
    "evidence": "",
    "SQL": "SELECT T1.p_id FROM person AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id_dummy INNER JOIN taughtBy AS T3 ON T2.p_id = T3.p_id INNER JOIN course AS T4 ON T3.course_id = T4.course_id WHERE T4.courseLevel = 'Introduction to Data Structures' AND T1.student = 1"
  },
  {
    "db_id": "computer_student",
    "question": "What are the IDs of the students who are advised by Professor ID 9?",
    "evidence": "",
    "SQL": "SELECT T2.p_id FROM person AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id_dummy WHERE T2.p_id = 9"
  },
  {
    "db_id": "computer_student",
    "question": "List the IDs of students who have a professor with the position Faculty_aff",
    "evidence": "",
    "SQL": "SELECT T1.p_id FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN person AS T3 ON T3.p_id = T2.p_id WHERE T3.hasPosition = 'Faculty_aff'"
  },
  {
    "db_id": "computer_student",
    "question": "How many courses has a professor with the last name 'Smith' taught?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.hasPosition = 'Professor' AND T2.student IS NULL AND T2.p_id IN (SELECT p_id FROM person WHERE professor = 1 AND hasPosition = 'Smith')"
  },
  {
    "db_id": "computer_student",
    "question": "What is the number of students who have a professor who teaches the course ID 121 to 130 of basic undergraduate courses?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id_dummy INNER JOIN taughtBy AS T3 ON T3.p_id = T2.p_id WHERE T3.course_id > 121 AND T3.course_id < 130 AND T1.student = 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of students in Year 3 who have a professor advisor and have never had a position?",
    "evidence": "",
    "SQL": "SELECT COUNT(T1.p_id) FROM person AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id WHERE T1.yearsInProgram = 'Year_3' AND T1.hasPosition = 'never_had'"
  },
  {
    "db_id": "computer_student",
    "question": "Which professors are teaching the course 'Computer Science'?",
    "evidence": "",
    "SQL": "SELECT T1.p_id FROM taughtBy AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T2.courseLevel = 'Computer Science'"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses taught by professors who are also students?",
    "evidence": "",
    "SQL": "SELECT C.course_id, C.courseLevel FROM course C INNER JOIN taughtBy T ON C.course_id = T.course_id INNER JOIN person P ON T.p_id = P.p_id WHERE P.student = 1"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of courses taught by professors who have taught more than three high-level or harder undergraduate courses?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM ( SELECT T2.p_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T1.courseLevel = 'Level_400' GROUP BY T2.p_id HAVING COUNT(DISTINCT T1.course_id) > 3 ) AS T3"
  },
  {
    "db_id": "computer_student",
    "question": "What are the names of all students who are advised to teach by a professor teaching a course with a level of 'Level_300'? ",
    "evidence": "",
    "SQL": "SELECT p.student FROM person AS p INNER JOIN advisedBy AS a ON p.p_id = a.p_id INNER JOIN taughtBy AS t ON a.p_id_dummy = t.p_id INNER JOIN course AS c ON t.course_id = c.course_id WHERE c.courseLevel = 'Level_300' GROUP BY p.student"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of professors that teaches a course in a department?",
    "evidence": "",
    "SQL": "SELECT COUNT(DISTINCT T2.p_id) FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses taught by professors who are not in the faculty?",
    "evidence": "",
    "SQL": "SELECT T3.course_id, T3.courseLevel FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T1.course_id WHERE T2.hasPosition != 'Faculty_eme'"
  },
  {
    "db_id": "computer_student",
    "question": "Which professors have advised at least two students in the 3rd year of the program?",
    "evidence": "",
    "SQL": "SELECT DISTINCT T2.p_id FROM person AS T2 INNER JOIN advisedBy AS T1 ON T2.p_id = T1.p_id WHERE T2.hasPosition = 'student' AND T1.p_id_dummy IN (SELECT p_id FROM person WHERE yearsInProgram = 'Year_3') GROUP BY T2.p_id HAVING COUNT(DISTINCT T1.p_id) >= 2"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses taught by the professors who have both 'Professor' and 'Student' roles?",
    "evidence": "",
    "SQL": "SELECT DISTINCT T3.course_id FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T1.professor = 1 AND T1.student = 1"
  },
  {
    "db_id": "computer_student",
    "question": "Which professors teach the majority of advanced undergraduate courses?",
    "evidence": "",
    "SQL": "SELECT T3.p_id, COUNT(*) AS numCourses FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T3.p_id = T2.p_id WHERE T1.courseLevel = 'Level_400' GROUP BY T3.p_id ORDER BY numCourses DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses taught by the professors with most number of advisors?",
    "evidence": "",
    "SQL": "SELECT C.course_id, C.courseLevel FROM course AS C INNER JOIN taughtBy AS T ON C.course_id = T.course_id INNER JOIN person AS P ON T.p_id = P.p_id GROUP BY T.course_id, C.courseLevel ORDER BY COUNT(P.p_id) DESC"
  },
  {
    "db_id": "computer_student",
    "question": "Which courses were taught by a student?",
    "evidence": "",
    "SQL": "SELECT DISTINCT course_id FROM taughtBy WHERE p_id IN (SELECT p_id FROM person WHERE student = 1)"
  },
  {
    "db_id": "computer_student",
    "question": "What are all the courses taught by the professors who have taught courses at level 400 or higher?",
    "evidence": "",
    "SQL": "SELECT C.course_id FROM course C, taughtBy T WHERE C.course_id = T.course_id AND T.p_id IN (SELECT p_id FROM person WHERE p_id IN (SELECT p_id FROM course WHERE courseLevel = 'Level_400' OR courseLevel = 'Level_500' OR courseLevel = 'Level_600' OR courseLevel = 'Level_700' OR courseLevel = 'Level_800' OR courseLevel = 'Level_900') )"
  },
  {
    "db_id": "computer_student",
    "question": "Which professors teach the most students in undergraduate courses?",
    "evidence": "",
    "SQL": "SELECT T1.p_id, COUNT(*) AS studentCount FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T2.course_id WHERE T3.courseLevel = 'Level_300' GROUP BY T1.p_id ORDER BY studentCount DESC"
  },
  {
    "db_id": "computer_student",
    "question": "What are the IDs of students who are not professors and not in their last year of the program?",
    "evidence": "",
    "SQL": "SELECT student FROM person WHERE student IS NOT NULL AND hasPosition != 'Position_4' AND inPhase != 'Last_year'"
  },
  {
    "db_id": "computer_student",
    "question": "Which professors have advised at least two students?",
    "evidence": "",
    "SQL": "SELECT T1.p_id FROM advisedBy AS T1 GROUP BY T1.p_id HAVING COUNT(T1.p_id) > 1"
  },
  {
    "db_id": "computer_student",
    "question": "Which courses are taught by more than one professor?",
    "evidence": "",
    "SQL": "SELECT * FROM course WHERE course_id IN (SELECT T1.course_id FROM taughtBy AS T1 GROUP BY T1.course_id HAVING COUNT(DISTINCT T1.p_id) > 1)"
  },
  {
    "db_id": "computer_student",
    "question": "Which courses are taught by professors who are also students?",
    "evidence": "",
    "SQL": "SELECT DISTINCT T1.courseLevel, T1.course_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T2.p_id = T3.p_id WHERE T3.student = 1"
  },
  {
    "db_id": "computer_student",
    "question": "What courses are affiliated with professors who have taught at least one course in the Level_300 and have a professor ID?",
    "evidence": "",
    "SQL": "SELECT T1.course_id, T1.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T1.courseLevel = 'Level_300' AND T2.p_id IS NOT NULL GROUP BY T1.course_id, T1.courseLevel"
  },
  {
    "db_id": "computer_student",
    "question": "What is the number of students who have a professor as their advisor?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person WHERE professor = 1 AND hasPosition = 'advisor'"
  },
  {
    "db_id": "computer_student",
    "question": "What courses are taught by full-time professors?",
    "evidence": "",
    "SQL": "SELECT course.course_id FROM course INNER JOIN taughtBy ON course.course_id = taughtBy.course_id INNER JOIN person ON taughtBy.p_id = person.p_id WHERE person.hasPosition = 'Faculty_fulltime'"
  },
  {
    "db_id": "computer_student",
    "question": "Which students in Phase 1 are advised by professors who also teach Level 500 courses?",
    "evidence": "",
    "SQL": "SELECT T2.p_id FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN taughtBy AS T3 ON T2.p_id = T3.p_id WHERE T2.inPhase = 'Phase 1' AND T3.course_id IN (SELECT course_id FROM course WHERE courseLevel = 'Level_500')"
  },
  {
    "db_id": "computer_student",
    "question": "What courses are taught by professors with more than one position?",
    "evidence": "",
    "SQL": "SELECT DISTINCT T1.course_id FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.hasPosition != 'student' AND T2.hasPosition != 'professor' AND T2.hasPosition != 'Both' GROUP BY T1.course_id HAVING COUNT(T2.hasPosition) > 1"
  },
  {
    "db_id": "computer_student",
    "question": "How many students are there in total?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person WHERE yearsInProgram != 'YearsInProgram'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of students and professors combined in the university?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person WHERE (student IS NOT NULL OR professor IS NOT NULL)"
  },
  {
    "db_id": "computer_student",
    "question": "What is the name of the student who is in the 3rd year of their program and has a professor who teaches a course of level 'PostGraduate'?",
    "evidence": "",
    "SQL": "SELECT p.student FROM person p JOIN advisedBy ab ON p.p_id = ab.p_id_dummy JOIN taughtBy tb ON ab.p_id = tb.p_id JOIN course c ON tb.course_id = c.course_id WHERE p.inPhase = 'Year_3' AND c.courseLevel = 'PostGraduate' LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What are the IDs of students who are advised by professors who teach in both harder undergraduate course and master/graduate courses?",
    "evidence": "",
    "SQL": "SELECT DISTINCT T2.p_id FROM course AS T1 INNER JOIN taughtBy AS T3 ON T1.course_id = T3.course_id INNER JOIN advisedBy AS T2 ON T3.p_id = T2.p_id WHERE T1.courseLevel = 'Level_400' OR T1.courseLevel = 'Level_500' GROUP BY T2.p_id HAVING COUNT(T2.p_id) > 1"
  },
  {
    "db_id": "computer_student",
    "question": "What are the IDs and course levels of the courses taught by all professors who are also students in the program?",
    "evidence": "",
    "SQL": "SELECT T1.course_id, T1.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T2.p_id = T3.p_id WHERE T3.inPhase = 'inPhase' AND T3.yearsInProgram != '0'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the average number of students per course for professors who have taught both level 1 and level 2 courses?",
    "evidence": "",
    "SQL": "SELECT CAST(COUNT(*) AS REAL) / COUNT(DISTINCT course_id) AS avgnum FROM taughtBy WHERE p_id IN (SELECT p_id FROM taughtBy WHERE course_id IN (SELECT course_id FROM course WHERE courseLevel='Level_1') GROUP BY p_id HAVING COUNT(DISTINCT course_id)>1) AND p_id IN (SELECT p_id FROM taughtBy WHERE course_id IN (SELECT course_id FROM course WHERE courseLevel='Level_2') GROUP BY p_id HAVING COUNT(DISTINCT course_id)>1)"
  },
  {
    "db_id": "computer_student",
    "question": "Which students are currently advised by a teacher who teaches a course at the advanced level?",
    "evidence": "",
    "SQL": "SELECT T2.student FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN taughtBy AS T3 ON T1.p_id = T3.p_id INNER JOIN course AS T4 ON T3.course_id = T4.course_id WHERE T4.courseLevel = 'Advanced'"
  },
  {
    "db_id": "computer_student",
    "question": "What is the name of the course taught by professors who also advised students for more than 1 year?",
    "evidence": "",
    "SQL": "SELECT T1.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T2.p_id = T3.p_id WHERE T3.hasPosition = 'Professor' AND T3.yearsInProgram = 'Year_1' GROUP BY T1.courseLevel"
  },
  {
    "db_id": "computer_student",
    "question": "What are all the courses taught by professors who are also students?",
    "evidence": "",
    "SQL": "SELECT DISTINCT T1.course_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T2.p_id IN (SELECT p_id FROM person WHERE inPhase='undergraduate')"
  },
  {
    "db_id": "computer_student",
    "question": "Which teacher has taught the most undergraduate courses?",
    "evidence": "",
    "SQL": "SELECT p_id, COUNT(*) AS numCourses FROM taughtBy GROUP BY p_id ORDER BY numCourses DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses that were taught by students in Level_400 courses?",
    "evidence": "",
    "SQL": "SELECT T3.course_id, T3.courseLevel FROM course AS T3 INNER JOIN taughtBy AS T1 ON T3.course_id = T1.course_id INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.student = 1 AND T3.courseLevel = 'Level_400'"
  },
  {
    "db_id": "computer_student",
    "question": "Which students are also professors?",
    "evidence": "",
    "SQL": "SELECT DISTINCT p.student FROM person AS p WHERE p.student IS NOT NULL AND p.student IN (SELECT p_id FROM person WHERE hasPosition='Professor')"
  },
  {
    "db_id": "computer_student",
    "question": "What percentage of courses has 'Level_400' as their level?",
    "evidence": "",
    "SQL": "SELECT CAST(SUM(CASE WHEN courseLevel = 'Level_400' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) AS per FROM course"
  },
  {
    "db_id": "computer_student",
    "question": "Which professors teach both basic and advanced undergraduate courses?",
    "evidence": "",
    "SQL": "SELECT DISTINCT T2.p_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T1.courseLevel IN ('Level_200', 'Level_400')"
  },
  {
    "db_id": "computer_student",
    "question": "What are the names of students who are being advised by a professor who teaches a 'Level_400' course?",
    "evidence": "",
    "SQL": "SELECT P1.student FROM person AS P1 INNER JOIN advisedBy AS P2 ON P1.p_id = P2.p_id_dummy INNER JOIN taughtBy AS P3 ON P3.p_id = P2.p_id_dummy INNER JOIN course AS P4 ON P4.course_id = P3.course_id WHERE P4.courseLevel = 'Level_400'"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses taught by all the advisors?",
    "evidence": "",
    "SQL": "SELECT course_id FROM taughtBy AS T1 INNER JOIN advisedBy AS T2 ON T1.p_id = T2.p_id"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses taught by professors who have 5 or more years of experience?",
    "evidence": "",
    "SQL": "SELECT course_id FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.yearsInProgram = '5-10' OR T2.yearsInProgram = '10-15' OR T2.yearsInProgram = '15-20' OR T2.yearsInProgram = '20+'"
  },
  {
    "db_id": "computer_student",
    "question": "Which professors have taught at least one course of Level_300 or higher?",
    "evidence": "",
    "SQL": "SELECT DISTINCT p_id FROM taughtBy WHERE course_id IN (SELECT course_id FROM course WHERE courseLevel = 'Level_300')"
  },
  {
    "db_id": "computer_student",
    "question": "What is the level of course taught by both professor and student with ID 297?",
    "evidence": "",
    "SQL": "SELECT T1.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T2.p_id = 297 UNION SELECT T3.courseLevel FROM course AS T3 INNER JOIN person AS T4 ON T3.course_id = T4.p_id AND T4.p_id = 297"
  },
  {
    "db_id": "computer_student",
    "question": "Which professor advises the most students?",
    "evidence": "",
    "SQL": "SELECT T2.p_id FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id GROUP BY T2.p_id ORDER BY COUNT(T1.p_id) DESC LIMIT 1"
  },
  {
    "db_id": "computer_student",
    "question": "List the IDs of the students who are in their second phase and have been advised by a professor with a certain position.",
    "evidence": "",
    "SQL": "SELECT T2.p_id FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.inPhase = 'Phase_2' AND T1.p_id IN (SELECT p_id FROM person WHERE hasPosition = 'Position_X')"
  },
  {
    "db_id": "computer_student",
    "question": "How many faculty employees teach medium undergraduate courses?",
    "evidence": "",
    "SQL": "SELECT COUNT(p_id) FROM taughtBy INNER JOIN course ON taughtBy.course_id = course.course_id WHERE courseLevel = 'Level_300' AND taughtBy.p_id IN (SELECT p_id FROM person WHERE hasPosition = 'Faculty_eme')"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of courses taught by professors who have advised more than one student?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN advisedBy AS T3 ON T2.p_id = T3.p_id_dummy GROUP BY T3.p_id_dummy HAVING COUNT(DISTINCT T3.p_id) > 1"
  },
  {
    "db_id": "computer_student",
    "question": "Which students are in their first year and what are the courses they are taking?",
    "evidence": "",
    "SQL": "SELECT person.p_id, course.course_id FROM person INNER JOIN advisedBy ON person.p_id = advisedBy.p_id_dummy INNER JOIN taughtBy ON taughtBy.p_id = advisedBy.p_id INNER JOIN course ON taughtBy.course_id = course.course_id WHERE person.inPhase = '1st_year'"
  },
  {
    "db_id": "computer_student",
    "question": "How many courses does a professor on average teach?",
    "evidence": "",
    "SQL": "SELECT AVG(count) FROM (SELECT p_id, COUNT(course_id) as count FROM taughtBy GROUP BY p_id) AS T"
  },
  {
    "db_id": "computer_student",
    "question": "What is the number of faculty professors who teach a master/undergraduate course?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T2.course_id WHERE T1.hasPosition = 'Faculty_aff' AND T3.courseLevel = 'Level_500'"
  },
  {
    "db_id": "computer_student",
    "question": "What are the names of students who are being taught by the professor who advises student with ID 5?",
    "evidence": "",
    "SQL": "SELECT person.p_id, person.student FROM person INNER JOIN advisedBy ON person.p_id = advisedBy.p_id INNER JOIN taughtBy ON person.p_id = taughtBy.p_id INNER JOIN course ON taughtBy.course_id = course.course_id WHERE advisedBy.p_id_dummy = 5"
  },
  {
    "db_id": "computer_student",
    "question": "What is the total number of courses taught by professors who have taught more than 5 courses?",
    "evidence": "",
    "SQL": "SELECT COUNT(*) AS total_courses FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id GROUP BY T2.p_id HAVING COUNT(T1.course_id) > 5"
  },
  {
    "db_id": "computer_student",
    "question": "What is the list of students taught by professor with ID 7?",
    "evidence": "",
    "SQL": "SELECT p_id FROM person WHERE p_id IN (SELECT p_id FROM taughtBy WHERE p_id = 7)"
  },
  {
    "db_id": "computer_student",
    "question": "What is the course level of the course taught by the professor with ID 7?",
    "evidence": "",
    "SQL": "SELECT T1.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T2.p_id = 7"
  },
  {
    "db_id": "computer_student",
    "question": "What is the ID of a professor who taught a course that has a courseLevel 'Level_500'?",
    "evidence": "",
    "SQL": "SELECT p_id FROM person NATURAL JOIN taughtBy NATURAL JOIN course WHERE courseLevel = 'Level_500'"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses taught by professors who advise students with no advisory position?",
    "evidence": "",
    "SQL": "SELECT T3.course_id FROM advisedBy AS T1 LEFT JOIN person AS T2 ON T1.p_id = T2.p_id LEFT JOIN taughtBy AS T3 ON T2.p_id = T3.p_id WHERE T2.hasPosition IS NULL"
  },
  {
    "db_id": "computer_student",
    "question": "What are the courses that a professor who taught at least one course at the Level_200 and Level_300 levels is qualified to teach?",
    "evidence": "",
    "SQL": "SELECT DISTINCT T3.course_id FROM taughtBy AS T1 INNER JOIN course AS T3 ON T1.course_id = T3.course_id WHERE T1.p_id IN (SELECT p_id FROM person WHERE hasPosition = 'Faculty_eme') AND T3.courseLevel IN ('Level_200', 'Level_300')"
  }
]