1sf/bird-sql-train-with-schema huggingface dataset:
Database: computer_student
Tables: course, person, advisedBy, taughtBy
Columns (table index, column name): -1, *, 0, course_id, 0, courseLevel, 1, p_id, 1, professor, 1, student, 1, hasPosition, 1, inPhase, 1, yearsInProgram, 2, p_id, 2, p_id_dummy, 3, course_id, 3, p_id
Question: Please list the IDs of the advisors of the students who are in the 5th year of their program.
Evidence: IDs of the advisors refers to p_id_dummy; in the 5th year of their program refers to yearsInProgram = 'Year_5'
SQL: SELECT T1.p_id_dummy FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.yearsInProgram = 'Year_5'
Database: computer_student
Tables: course, person, advisedBy, taughtBy
Columns (table index, column name): -1, *, 0, course_id, 0, courseLevel, 1, p_id, 1, professor, 1, student, 1, hasPosition, 1, inPhase, 1, yearsInProgram, 2, p_id, 2, p_id_dummy, 3, course_id, 3, p_id
Question: How many students are advised to teach by a professor teaching basic or medium undergraduate courses?
Evidence: students refers to advisedBy.p_id; professor refers to p_id_dummy and taughtBy.p_id and professor = 1; basic or medium undergraduate courses refers to courseLevel = 'Level_300'
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_300'
Database: computer_student
Tables: course, person, advisedBy, taughtBy
Columns (table index, column name): -1, *, 0, course_id, 0, courseLevel, 1, p_id, 1, professor, 1, student, 1, hasPosition, 1, inPhase, 1, yearsInProgram, 2, p_id, 2, p_id_dummy, 3, course_id, 3, p_id
Question: Among the courses that are basic or medium undergraduate courses, how many of them are taught by a faculty member?
Evidence: courses that are basic or medium undergraduate courses refers to courseLevel = 'Level_300'; faculty member refers to hasPosition ! = 0
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.professor = 1 AND T1.courseLevel = 'Level_300'
Database: computer_student
Tables: course, person, advisedBy, taughtBy
Columns (table index, column name): -1, *, 0, course_id, 0, courseLevel, 1, p_id, 1, professor, 1, student, 1, hasPosition, 1, inPhase, 1, yearsInProgram, 2, p_id, 2, p_id_dummy, 3, course_id, 3, p_id
Question: For the professor who advised student no.6, please list the IDs of the courses he or she teaches.
Evidence: professor refers to p_id_dummy and professor = 1; student no.6 refers to advisedBy.p_id = 6; IDs of the courses refers to taughtBy.course_id
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 WHERE T1.p_id = 9
Database: computer_student
Tables: course, person, advisedBy, taughtBy
Columns (table index, column name): -1, *, 0, course_id, 0, courseLevel, 1, p_id, 1, professor, 1, student, 1, hasPosition, 1, inPhase, 1, yearsInProgram, 2, p_id, 2, p_id_dummy, 3, course_id, 3, p_id
Question: What is the level of the course with the most number of teachers?
Evidence: level of the course refers to courseLevel; course with most number of teachers refers to course_id = max(count(taughtBy.p_id))
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 COUNT(T2.p_id) DESC LIMIT 1
Database: computer_student
Tables: course, person, advisedBy, taughtBy
Columns (table index, column name): -1, *, 0, course_id, 0, courseLevel, 1, p_id, 1, professor, 1, student, 1, hasPosition, 1, inPhase, 1, yearsInProgram, 2, p_id, 2, p_id_dummy, 3, course_id, 3, p_id
Question: Please list the IDs of the professors that teaches more than 3 courses.
Evidence: IDs of the professors refers to taughtBy.p_id and professor = 1; teaches more than 3 courses  refers to count(course_id) > 3
SQL: SELECT T1.p_id FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.professor = 1 GROUP BY T1.p_id HAVING COUNT(DISTINCT T1.course_id) > 3
Database: computer_student
Tables: course, person, advisedBy, taughtBy
Columns (table index, column name): -1, *, 0, course_id, 0, courseLevel, 1, p_id, 1, professor, 1, student, 1, hasPosition, 1, inPhase, 1, yearsInProgram, 2, p_id, 2, p_id_dummy, 3, course_id, 3, p_id
Question: Please list the IDs of the top 3 professors that teaches the most courses.
Evidence: IDs of the professors refers to taughtBy.p_id and professor = 1; teaches the most courses refers to max(count(course_id))
SQL: SELECT T1.p_id FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.professor = 1 GROUP BY T1.p_id ORDER BY COUNT(*) DESC LIMIT 3
Database: computer_student
Tables: course, person, advisedBy, taughtBy
Columns (table index, column name): -1, *, 0, course_id, 0, courseLevel, 1, p_id, 1, professor, 1, student, 1, hasPosition, 1, inPhase, 1, yearsInProgram, 2, p_id, 2, p_id_dummy, 3, course_id, 3, p_id
Question: In total, all the students in the 3rd year of their program are advised by how many professors?
Evidence: 3rd year of their program refers to yearsInProgram = 'Year_3'; professors refers to p_id_dummy
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.yearsInProgram = 'Year_3'
Database: computer_student
Tables: course, person, advisedBy, taughtBy
Columns (table index, column name): -1, *, 0, course_id, 0, courseLevel, 1, p_id, 1, professor, 1, student, 1, hasPosition, 1, inPhase, 1, yearsInProgram, 2, p_id, 2, p_id_dummy, 3, course_id, 3, p_id
Question: What is the average number of courses taught by a professor?
Evidence: professor refers to professor = 1; average number of courses = divide(count(taughtBy.course_id), count(taughtBy.p_id) where professor = 1 )
SQL: SELECT CAST(COUNT(T1.course_id) AS REAL) / COUNT(DISTINCT T2.p_id) AS num FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.professor = 1
Database: computer_student
Tables: course, person, advisedBy, taughtBy
Columns (table index, column name): -1, *, 0, course_id, 0, courseLevel, 1, p_id, 1, professor, 1, student, 1, hasPosition, 1, inPhase, 1, yearsInProgram, 2, p_id, 2, p_id_dummy, 3, course_id, 3, p_id
Question: What is the ratio of professors and students?
Evidence: professors refers to professor = 1; students refers to student = 1; ratio = divide(count(person.p_id) when professor = 1, count(person.p_id) when student = 1)
SQL: SELECT CAST(SUM(CASE  WHEN professor = 1 THEN 1 ELSE 0 END) AS REAL) * 100 / SUM(CASE  WHEN student = 1 THEN 1 ELSE 0 END) AS per FROM person
Database: computer_student
Tables: course, person, advisedBy, taughtBy
Columns (table index, column name): -1, *, 0, course_id, 0, courseLevel, 1, p_id, 1, professor, 1, student, 1, hasPosition, 1, inPhase, 1, yearsInProgram, 2, p_id, 2, p_id_dummy, 3, course_id, 3, p_id
Question: Calculate the percentage of high-level undergraduate course.
Evidence: high-level undergraduate course refers to courseLevel = 'Level_400'; percentage = divide(count(course.course_id) when courseLevel = 'Level_400', count(course.course_id)) * 100%
SQL: SELECT CAST(SUM(CASE  WHEN courseLevel = 'Level_400' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) AS per FROM course
Database: computer_student
Tables: course, person, advisedBy, taughtBy
Columns (table index, column name): -1, *, 0, course_id, 0, courseLevel, 1, p_id, 1, professor, 1, student, 1, hasPosition, 1, inPhase, 1, yearsInProgram, 2, p_id, 2, p_id_dummy, 3, course_id, 3, p_id
Question: List down all the person IDs who taught course ID of 18.
Evidence: person IDs refers to taughtBy.p_id; course ID of 18  refers to taughtBy.course_id = 18
SQL: SELECT p_id FROM taughtBy WHERE course_id = 18
Database: computer_student
Tables: course, person, advisedBy, taughtBy
Columns (table index, column name): -1, *, 0, course_id, 0, courseLevel, 1, p_id, 1, professor, 1, student, 1, hasPosition, 1, inPhase, 1, yearsInProgram, 2, p_id, 2, p_id_dummy, 3, course_id, 3, p_id
Question: Provide the position status and IDs of professor who advised student ID "303".
Evidence: position status refers to hasPosition; IDs of professor refers to p_id_dummy; student ID "303" refers to advisedBy.p_id = 303
SQL: SELECT T2.hasPosition, T1.p_id_dummy FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id_dummy = T2.p_id WHERE T1.p_id = 303
Database: computer_student
Tables: course, person, advisedBy, taughtBy
Columns (table index, column name): -1, *, 0, course_id, 0, courseLevel, 1, p_id, 1, professor, 1, student, 1, hasPosition, 1, inPhase, 1, yearsInProgram, 2, p_id, 2, p_id_dummy, 3, course_id, 3, p_id
Question: List the person IDs and course levels of the affiliated professors in faculty.
Evidence: person IDs refers to person.p_id; affiliated professors in faculty refers to professor = 1 and hasPosition = 'Faculty_aff'
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 T1.hasPosition = 'Faculty_aff'
Database: computer_student
Tables: course, person, advisedBy, taughtBy
Columns (table index, column name): -1, *, 0, course_id, 0, courseLevel, 1, p_id, 1, professor, 1, student, 1, hasPosition, 1, inPhase, 1, yearsInProgram, 2, p_id, 2, p_id_dummy, 3, course_id, 3, p_id
Question: Describe the year in program and in phase status for the student with most number in advisor.
Evidence: student refers to advisedBy.p_id; most number in advisor refers to max(count(p_id_dummy))
SQL: SELECT T2.yearsInProgram, T2.inPhase FROM advisedBy 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
Database: computer_student
Tables: course, person, advisedBy, taughtBy
Columns (table index, column name): -1, *, 0, course_id, 0, courseLevel, 1, p_id, 1, professor, 1, student, 1, hasPosition, 1, inPhase, 1, yearsInProgram, 2, p_id, 2, p_id_dummy, 3, course_id, 3, p_id
Question: List down the advised student IDs and IDs of employing professor in faculty.
Evidence: advised student IDs refers to person.p_id; IDs of employing professor in faculty refers to p_id_dummy and hasPosition = 'Faculty_eme'
SQL: SELECT T1.p_id, T2.p_id FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id_dummy = T2.p_id WHERE hasPosition = 'Faculty_eme'
Database: computer_student
Tables: course, person, advisedBy, taughtBy
Columns (table index, column name): -1, *, 0, course_id, 0, courseLevel, 1, p_id, 1, professor, 1, student, 1, hasPosition, 1, inPhase, 1, yearsInProgram, 2, p_id, 2, p_id_dummy, 3, course_id, 3, p_id
Question: List the course IDs and levels of person IDs from 40 to 50.
Evidence: course IDs and levels refers to course.course_id and courseLevel; person IDs from 40 to 50 refers to taughtBy.p_id between 40 and 50
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 40 AND 50
Database: computer_student
Tables: course, person, advisedBy, taughtBy
Columns (table index, column name): -1, *, 0, course_id, 0, courseLevel, 1, p_id, 1, professor, 1, student, 1, hasPosition, 1, inPhase, 1, yearsInProgram, 2, p_id, 2, p_id_dummy, 3, course_id, 3, p_id
Question: Describe the course level and list of person IDs who taught course ID of 147.
Evidence: person IDs refers to taughtBy.p_id; course ID of 147 refers to course.course_id = 147
SQL: SELECT T1.courseLevel, T1.course_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T2.p_id = 141
Database: computer_student
Tables: course, person, advisedBy, taughtBy
Columns (table index, column name): -1, *, 0, course_id, 0, courseLevel, 1, p_id, 1, professor, 1, student, 1, hasPosition, 1, inPhase, 1, yearsInProgram, 2, p_id, 2, p_id_dummy, 3, course_id, 3, p_id
Question: Mention the person ID of faculty professor who taught course ID 104 and the course level.
Evidence: person ID refers to person.p_id; faculty professor refers to professor = 1 and hasPosition ! = 0
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 = 104 AND T1.hasPosition <> 0
Database: computer_student
Tables: course, person, advisedBy, taughtBy
Columns (table index, column name): -1, *, 0, course_id, 0, courseLevel, 1, p_id, 1, professor, 1, student, 1, hasPosition, 1, inPhase, 1, yearsInProgram, 2, p_id, 2, p_id_dummy, 3, course_id, 3, p_id
Question: Find the professor ID and position in faculty who taught high-level undergraduate course of less than 10 in ID.
Evidence: professor ID refers to person.p_id when professor = 1; position in faculty refers to hasPosition; high-level undergraduate course refers to courseLevel = 'Level_400'; less than 10 in ID refers to course.course_id < 10
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 T3.course_id = T2.course_id WHERE T3.courseLevel = 'Level_400' AND T2.course_id < 10
Database: computer_student
Tables: course, person, advisedBy, taughtBy
Columns (table index, column name): -1, *, 0, course_id, 0, courseLevel, 1, p_id, 1, professor, 1, student, 1, hasPosition, 1, inPhase, 1, yearsInProgram, 2, p_id, 2, p_id_dummy, 3, course_id, 3, p_id
Question: List the professor ID who taught the course ID from 121 to 130 of basic undergraduate courses.
Evidence: professor ID refers to taughtBy.p_id; course ID from 121 to 130 of basic undergraduate courses refers to courseLevel = 'Level_300' and course.course_id between 121 and 130
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' AND T1.course_id > 121 AND T1.course_id < 130
Database: computer_student
Tables: course, person, advisedBy, taughtBy
Columns (table index, column name): -1, *, 0, course_id, 0, courseLevel, 1, p_id, 1, professor, 1, student, 1, hasPosition, 1, inPhase, 1, yearsInProgram, 2, p_id, 2, p_id_dummy, 3, course_id, 3, p_id
Question: List the advisor IDs for students with eighth year of program and position status in faculty of those professors.
Evidence: advisor IDs refers to p_id_dummy and person.p_id where professor = 1; eighth year of program refers to yearsInprogram = 'Year_8'; position status in faculty of those professors refers to hasPosition
SQL: SELECT T1.p_id_dummy, T2.hasPosition FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.yearsInProgram = 'Year_8'
Database: computer_student
Tables: course, person, advisedBy, taughtBy
Columns (table index, column name): -1, *, 0, course_id, 0, courseLevel, 1, p_id, 1, professor, 1, student, 1, hasPosition, 1, inPhase, 1, yearsInProgram, 2, p_id, 2, p_id_dummy, 3, course_id, 3, p_id
Question: List any five of course IDs with professor IDs who taught master courses.
Evidence: professor IDs refers to taughtBy.p_id; master course refers to courseLevel = 'Level_500'
SQL: SELECT T1.course_id, 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
Database: computer_student
Tables: course, person, advisedBy, taughtBy
Columns (table index, column name): -1, *, 0, course_id, 0, courseLevel, 1, p_id, 1, professor, 1, student, 1, hasPosition, 1, inPhase, 1, yearsInProgram, 2, p_id, 2, p_id_dummy, 3, course_id, 3, p_id
Question: How many students are under advisor 415?
Evidence: advisor 415 refers to p_id_dummy = 415
SQL: SELECT COUNT(*) FROM advisedBy WHERE p_id_dummy = 415
Database: computer_student
Tables: course, person, advisedBy, taughtBy
Columns (table index, column name): -1, *, 0, course_id, 0, courseLevel, 1, p_id, 1, professor, 1, student, 1, hasPosition, 1, inPhase, 1, yearsInProgram, 2, p_id, 2, p_id_dummy, 3, course_id, 3, p_id
Question: How many professional or master/graduate courses are there?
Evidence: professional or master/graduate courses refers to courseLevel = 'Level_500'
SQL: SELECT COUNT(*) FROM course WHERE courseLevel = 'Level_500'
Database: computer_student
Tables: course, person, advisedBy, taughtBy
Columns (table index, column name): -1, *, 0, course_id, 0, courseLevel, 1, p_id, 1, professor, 1, student, 1, hasPosition, 1, inPhase, 1, yearsInProgram, 2, p_id, 2, p_id_dummy, 3, course_id, 3, p_id
Question: How many non-faculty members are not undergoing the phase of qualifications?
Evidence: non-faculty members refers to hasPosition = 0; are not undergoing the phase of qualifications refers to inPhase = 0
SQL: SELECT COUNT(*) FROM person WHERE hasPosition = 0 AND inPhase = 0
Database: computer_student
Tables: course, person, advisedBy, taughtBy
Columns (table index, column name): -1, *, 0, course_id, 0, courseLevel, 1, p_id, 1, professor, 1, student, 1, hasPosition, 1, inPhase, 1, yearsInProgram, 2, p_id, 2, p_id_dummy, 3, course_id, 3, p_id
Question: Which professor taught the least amount of courses?
Evidence: professor refers to taughtBy.p_id; least amount of courses refers to min(count(course_id))
SQL: SELECT p_id FROM taughtBy GROUP BY p_id ORDER BY COUNT(course_id) ASC LIMIT 1
Database: computer_student
Tables: course, person, advisedBy, taughtBy
Columns (table index, column name): -1, *, 0, course_id, 0, courseLevel, 1, p_id, 1, professor, 1, student, 1, hasPosition, 1, inPhase, 1, yearsInProgram, 2, p_id, 2, p_id_dummy, 3, course_id, 3, p_id
Question: Among the students being advised by Advisor 5, how many students are in the 5th year?
Evidence: Advisor 5 refers to p_id_dummy = 5; are in the 5th year refers to yearsInProgram = 'Year_5'
SQL: SELECT COUNT(*) FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T1.p_id_dummy = 5 AND T2.student = 1 AND T2.yearsInProgram = 'Year_5'
Database: computer_student
Tables: course, person, advisedBy, taughtBy
Columns (table index, column name): -1, *, 0, course_id, 0, courseLevel, 1, p_id, 1, professor, 1, student, 1, hasPosition, 1, inPhase, 1, yearsInProgram, 2, p_id, 2, p_id_dummy, 3, course_id, 3, p_id
Question: Which professor teaches the highest number of professional or master/graduate courses?
Evidence: professor refers to taughtBy.p_id; highest number of professional or master/graduate courses refers to max(count(taughtBy.course_id)) where courseLevel = 'Level_500'
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
Database: computer_student
Tables: course, person, advisedBy, taughtBy
Columns (table index, column name): -1, *, 0, course_id, 0, courseLevel, 1, p_id, 1, professor, 1, student, 1, hasPosition, 1, inPhase, 1, yearsInProgram, 2, p_id, 2, p_id_dummy, 3, course_id, 3, p_id
Question: Among the faculty affiliated professor, how many professors teaches professional or master/undergraduate courses?
Evidence: faculty affiliated professor refers to professor = 1 and hasPosition = 'Faculty_aff'; professional or master/undergraduate courses refers to courseLevel = 'Level_500'
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 T1.professor = 1 AND T3.courseLevel = 'Level_500'
Database: computer_student
Tables: course, person, advisedBy, taughtBy
Columns (table index, column name): -1, *, 0, course_id, 0, courseLevel, 1, p_id, 1, professor, 1, student, 1, hasPosition, 1, inPhase, 1, yearsInProgram, 2, p_id, 2, p_id_dummy, 3, course_id, 3, p_id
Question: Who are the top 5 professors who teaches the highest number of professional or master/undergraduate courses?
Evidence: professors refers to course.p_id; highest number of professional or master/undergraduate courses refers to max(count(course.course_id)) where courseLevel = 'Level_500'
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.p_id) DESC LIMIT 5
Database: computer_student
Tables: course, person, advisedBy, taughtBy
Columns (table index, column name): -1, *, 0, course_id, 0, courseLevel, 1, p_id, 1, professor, 1, student, 1, hasPosition, 1, inPhase, 1, yearsInProgram, 2, p_id, 2, p_id_dummy, 3, course_id, 3, p_id
Question: How many advisors are in charge of advising all the students in 1st year?
Evidence: advisors refers to p_id_dummy; students in 1st year refers to student = 1 and yearsInProgram = 'Year_1'
SQL: SELECT COUNT(T1.p_id_dummy) 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
Database: computer_student
Tables: course, person, advisedBy, taughtBy
Columns (table index, column name): -1, *, 0, course_id, 0, courseLevel, 1, p_id, 1, professor, 1, student, 1, hasPosition, 1, inPhase, 1, yearsInProgram, 2, p_id, 2, p_id_dummy, 3, course_id, 3, p_id
Question: How many professors teaches no more than two high-level or harder undergraduate courses?
Evidence: professors refers to taughtBy.p_id; high-level or harder undergraduate courses  refers to courseLevel = 'Level_400' ; no more than two refers to count(taughtBy.course_id) < = 2
SQL: SELECT COUNT(*) FROM ( SELECT COUNT(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) <= 2 )
Database: computer_student
Tables: course, person, advisedBy, taughtBy
Columns (table index, column name): -1, *, 0, course_id, 0, courseLevel, 1, p_id, 1, professor, 1, student, 1, hasPosition, 1, inPhase, 1, yearsInProgram, 2, p_id, 2, p_id_dummy, 3, course_id, 3, p_id
Question: Between the faculty employee professors, how many teaches high-level or harder undergraduate courses? Indicate each of the professors unique identifying number.
Evidence: faculty employee professors refers to hasPosition = 'Faculty_eme' and professor = 1; high-level or harder undergraduate courses refers to courseLevel = 'Level_400'; professors unique identifying number refers to person.p_id
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 T1.professor = 1 AND T3.courseLevel = 'Level_400'
Database: computer_student
Tables: course, person, advisedBy, taughtBy
Columns (table index, column name): -1, *, 0, course_id, 0, courseLevel, 1, p_id, 1, professor, 1, student, 1, hasPosition, 1, inPhase, 1, yearsInProgram, 2, p_id, 2, p_id_dummy, 3, course_id, 3, p_id
Question: What is the position in the faculty of the professor who teaches the highest number of courses?
Evidence: position in the faculty refers to hasPosition; professor refers to professor = 1; teaches the highest number of courses refers to max(count(taughtBy.course_id))
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 ORDER BY COUNT(T2.course_id) DESC LIMIT 1
Database: computer_student
Tables: course, person, advisedBy, taughtBy
Columns (table index, column name): -1, *, 0, course_id, 0, courseLevel, 1, p_id, 1, professor, 1, student, 1, hasPosition, 1, inPhase, 1, yearsInProgram, 2, p_id, 2, p_id_dummy, 3, course_id, 3, p_id
Question: What year in the program do the students with more than 2 advisors are in?
Evidence: students refers to student = 1; more than 2 advisors refers to count(p_id_dummy) > 2
SQL: SELECT T2.yearsInProgram 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