1sf/bird-sql-train-with-schema huggingface dataset:
Database: cs_semester
Tables: course, prof, RA, registration, student
Columns (table index, column name): -1, *, 0, course_id, 0, name, 0, credit, 0, diff, 1, prof_id, 1, gender, 1, first_name, 1, last_name, 1, email, 1, popularity, 1, teachingability, 1, graduate_from, 2, student_id, 2, capability, 2, prof_id, 2, salary, 3, course_id, 3, student_id, 3, grade, 3, sat, 4, student_id, 4, f_name, 4, l_name, 4, phone_number, 4, email, 4, intelligence, 4, gpa, 4, type
Question: Among the professors with more than average teaching ability, list the full name and email address of the professors who advise two or more students.
Evidence: more than average teaching ability refers to teachingability > AVG(teachingability); full_name of the professor = first_name, last_name; email address of the professor refers to email; advises two or more students refers to COUNT(student_id) > = 2;

SQL: SELECT T2.first_name, T2.last_name, T2.email FROM RA AS T1 INNER JOIN prof AS T2 ON T1.prof_id = T2.prof_id WHERE T2.teachingability > ( SELECT AVG(teachingability) FROM prof ) GROUP BY T2.prof_id HAVING COUNT(T1.student_id) >= 2
Database: cs_semester
Tables: course, prof, RA, registration, student
Columns (table index, column name): -1, *, 0, course_id, 0, name, 0, credit, 0, diff, 1, prof_id, 1, gender, 1, first_name, 1, last_name, 1, email, 1, popularity, 1, teachingability, 1, graduate_from, 2, student_id, 2, capability, 2, prof_id, 2, salary, 3, course_id, 3, student_id, 3, grade, 3, sat, 4, student_id, 4, f_name, 4, l_name, 4, phone_number, 4, email, 4, intelligence, 4, gpa, 4, type
Question: What percentage of students are highly satisfied with the Intro to Database 2 course?
Evidence: percentage = MULTIPLY(DIVIDE(COUNT(MAX(sat)), (COUNT(student_id))), 1.0); highly satisfied refers to MAX(sat);
SQL: SELECT CAST(( SELECT COUNT(*) FROM course WHERE name = 'Intro to Database 2' AND course_id IN ( SELECT course_id FROM registration WHERE sat = ( SELECT MAX(sat) FROM registration ) ) ) AS REAL) * 100  / COUNT(T1.student_id) FROM registration AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T2.name = 'Intro to Database 2'
Database: cs_semester
Tables: course, prof, RA, registration, student
Columns (table index, column name): -1, *, 0, course_id, 0, name, 0, credit, 0, diff, 1, prof_id, 1, gender, 1, first_name, 1, last_name, 1, email, 1, popularity, 1, teachingability, 1, graduate_from, 2, student_id, 2, capability, 2, prof_id, 2, salary, 3, course_id, 3, student_id, 3, grade, 3, sat, 4, student_id, 4, f_name, 4, l_name, 4, phone_number, 4, email, 4, intelligence, 4, gpa, 4, type
Question: What is the first and last name of students with highest gpa?
Evidence: first name refers of students refers to f_name; last name of students refers to l_name; highest gpa refers to MAX(gpa);
SQL: SELECT f_name, l_name FROM student WHERE gpa = ( SELECT MAX(gpa) FROM student )
Database: cs_semester
Tables: course, prof, RA, registration, student
Columns (table index, column name): -1, *, 0, course_id, 0, name, 0, credit, 0, diff, 1, prof_id, 1, gender, 1, first_name, 1, last_name, 1, email, 1, popularity, 1, teachingability, 1, graduate_from, 2, student_id, 2, capability, 2, prof_id, 2, salary, 3, course_id, 3, student_id, 3, grade, 3, sat, 4, student_id, 4, f_name, 4, l_name, 4, phone_number, 4, email, 4, intelligence, 4, gpa, 4, type
Question: Among professors with the highest teachability, how many of their students have high salary?
Evidence: highest teachability refers to MAX(teachability); high salary refers to salary = 'high';
SQL: SELECT COUNT(T1.student_id) FROM RA AS T1 INNER JOIN prof AS T2 ON T1.prof_id = T2.prof_id WHERE T1.salary = 'high' ORDER BY T2.teachingability DESC LIMIT 1
Database: cs_semester
Tables: course, prof, RA, registration, student
Columns (table index, column name): -1, *, 0, course_id, 0, name, 0, credit, 0, diff, 1, prof_id, 1, gender, 1, first_name, 1, last_name, 1, email, 1, popularity, 1, teachingability, 1, graduate_from, 2, student_id, 2, capability, 2, prof_id, 2, salary, 3, course_id, 3, student_id, 3, grade, 3, sat, 4, student_id, 4, f_name, 4, l_name, 4, phone_number, 4, email, 4, intelligence, 4, gpa, 4, type
Question: What is the salary range of the student with an email of grosellg@hku.hk?
Evidence: salary range refers to salary;
SQL: SELECT T1.salary FROM RA AS T1 INNER JOIN student AS T2 ON T1.student_id = T2.student_id WHERE T2.email = 'grosellg@hku.hk'
Database: cs_semester
Tables: course, prof, RA, registration, student
Columns (table index, column name): -1, *, 0, course_id, 0, name, 0, credit, 0, diff, 1, prof_id, 1, gender, 1, first_name, 1, last_name, 1, email, 1, popularity, 1, teachingability, 1, graduate_from, 2, student_id, 2, capability, 2, prof_id, 2, salary, 3, course_id, 3, student_id, 3, grade, 3, sat, 4, student_id, 4, f_name, 4, l_name, 4, phone_number, 4, email, 4, intelligence, 4, gpa, 4, type
Question: Among students that gave satisfaction of value 4 for the course named "Statistical Learning", how many of them have a gpa of 3.8?
Evidence: satisfaction refers to sat;

sat = 4; gpa = 3.8 
SQL: SELECT COUNT(T1.student_id) FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T3.name = 'Statistical learning' AND T2.sat = 4 AND T1.gpa = 3.8
Database: cs_semester
Tables: course, prof, RA, registration, student
Columns (table index, column name): -1, *, 0, course_id, 0, name, 0, credit, 0, diff, 1, prof_id, 1, gender, 1, first_name, 1, last_name, 1, email, 1, popularity, 1, teachingability, 1, graduate_from, 2, student_id, 2, capability, 2, prof_id, 2, salary, 3, course_id, 3, student_id, 3, grade, 3, sat, 4, student_id, 4, f_name, 4, l_name, 4, phone_number, 4, email, 4, intelligence, 4, gpa, 4, type
Question: Among courses with difficulty of 3, how many students have intellegence level of 2?
Evidence: difficulty of 3 refers to diff = 3; intelligence = 2
SQL: SELECT COUNT(T1.student_id) FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T3.diff = 3 AND T1.intelligence = 2
Database: cs_semester
Tables: course, prof, RA, registration, student
Columns (table index, column name): -1, *, 0, course_id, 0, name, 0, credit, 0, diff, 1, prof_id, 1, gender, 1, first_name, 1, last_name, 1, email, 1, popularity, 1, teachingability, 1, graduate_from, 2, student_id, 2, capability, 2, prof_id, 2, salary, 3, course_id, 3, student_id, 3, grade, 3, sat, 4, student_id, 4, f_name, 4, l_name, 4, phone_number, 4, email, 4, intelligence, 4, gpa, 4, type
Question: List the student's first and last name that got a C in the course named "Applied Deep Learning".
Evidence: student's first name refers to f_name; student's last name refers to l_name; got a C refers to grade = 'C';
SQL: SELECT T1.f_name, T1.l_name FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T3.name = 'Applied Deep Learning ' AND T2.grade = 'C'
Database: cs_semester
Tables: course, prof, RA, registration, student
Columns (table index, column name): -1, *, 0, course_id, 0, name, 0, credit, 0, diff, 1, prof_id, 1, gender, 1, first_name, 1, last_name, 1, email, 1, popularity, 1, teachingability, 1, graduate_from, 2, student_id, 2, capability, 2, prof_id, 2, salary, 3, course_id, 3, student_id, 3, grade, 3, sat, 4, student_id, 4, f_name, 4, l_name, 4, phone_number, 4, email, 4, intelligence, 4, gpa, 4, type
Question: Among research postgraduate students, give the name of the course with the student satisfaction value of 1.
Evidence: research postgraduate students refers to type = 'RPG'; name of the course refers to name; satisfaction refers to sat; sat = 1;
SQL: SELECT T3.name FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T2.sat = 1 AND T1.type = 'RPG'
Database: cs_semester
Tables: course, prof, RA, registration, student
Columns (table index, column name): -1, *, 0, course_id, 0, name, 0, credit, 0, diff, 1, prof_id, 1, gender, 1, first_name, 1, last_name, 1, email, 1, popularity, 1, teachingability, 1, graduate_from, 2, student_id, 2, capability, 2, prof_id, 2, salary, 3, course_id, 3, student_id, 3, grade, 3, sat, 4, student_id, 4, f_name, 4, l_name, 4, phone_number, 4, email, 4, intelligence, 4, gpa, 4, type
Question: Among the students with a capability below 3, what is the difference of undergraduate students from research postgraduate students?
Evidence: capability < 3; difference = subtract(count(type = 'UG')), (count(type = 'RPG')); undergraduate students refers to type = 'UG'; research postgraduate students refers to type = 'RPG';
SQL: SELECT SUM(CASE WHEN T2.type = 'UG' THEN 1 ELSE 0 END) - SUM(CASE WHEN T2.type = 'RPG' THEN 1 ELSE 0 END) FROM RA AS T1 INNER JOIN student AS T2 ON T1.student_id = T2.student_id WHERE T1.capability < 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 students for each advisor?
Evidence: students refers to advisedBy.p_id; advisor refers to p_id_dummy; average number = avg(count(advisedBy.p_id))
SQL: SELECT CAST(COUNT(p_id) AS REAL) / COUNT(DISTINCT p_id_dummy) AS avgnum FROM advisedBy GROUP BY p_id_dummy
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 are teaching course ID 18?
Evidence: professors refers to taughtBy.p_id; course ID 18 refers to taughtBy.course_id
SQL: SELECT COUNT(DISTINCT 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: List all the course IDs for professional or master/graduate courses.
Evidence: professional or master/graduate courses refers to courseLevel = 'Level_500'
SQL: SELECT course_id 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 courses are there for basic or medium undergraduate courses?
Evidence: basic or medium undergraduate courses refers to courseLevel = 'Level_300'; courses refers to course.course_id
SQL: SELECT COUNT(course_id) FROM course WHERE 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: List the ID of all professors who are not faculty member along with the courses taught by him/her.
Evidence: ID of all professors refers to person.p_id where professor = 1; not faculty member refers to hasPosition = 0; courses refers to taughtBy.course_id
SQL: SELECT T2.p_id, 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.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: Provide the ID of professors who are teaching high-level or harder undergraduate course.
Evidence: ID of professors refers to taughtBy.p_id; high-level or harder undergraduate course refers to courseLevel = 'Level_400'
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'
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 are the courses taught by the advisors who gave advice to student with ID 376?
Evidence: courses refers to course_id; advisors refers to p_id_dummy and taughtBy.p_id; student with ID 376 refers to advisedBy.p_id = 376
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 = 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: Name the advisors for students in Year 3 of the program.
Evidence: advisors refers to p_id_dummy; students in Year 3 of the program refers to yearsInProgram = 'Year_3'
SQL: SELECT T1.p_id 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: Which level of courses is taught by professor ID 297?
Evidence: professor ID 297 refers to taughtBy.p_id = 297
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
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 level is course 165? List the professors who teach the course.
Evidence: course 165 refers to course_id = 165; professors refers to taughtBy.p_id
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 = 165
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 ID and years in program for students taught by advisor with ID 5.
Evidence: advisor with ID 5 refers to p_id_dummy = 5
SQL: SELECT T1.p_id, T2.yearsInProgram FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T1.p_id_dummy = 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: State the courses and level of courses by professors who are faculty employees.
Evidence: professors who are faculty employees refers to professor = 1; faculty employees refers to hasPosition = 'Faculty_eme'
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'
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 ID of advisor of student ID 80 and state the level of courses taught by him/her.
Evidence: ID of advisor refers to p_id_dummy; student ID 80 refers to advisedBy.p_id = 80; level of courses refers to courseLevel
SQL: SELECT T1.p_id_dummy, 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 = 80
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 ID of professors who teach in both harder undergraduate course and master/graduate courses.
Evidence: harder undergraduate course refers to courseLevel = 'Level_400'; master/graduate courses refers to courseLevel = 'Level_500'; ID of professors refers to taughtBy.p_id
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' OR T1.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 professors who gave advice to students in the 12th years of program?
Evidence: professors refers to p_id_dummy; 12th years of program refers to yearsInProgram = 'Year_12'
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_12'
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 are the courses with the most number of professors? State the course ID and the level of the course.
Evidence: courses refers taughtBy.course_id; most number of professors  refers to max(count(taughtBy.p_id)); level of the course refers to courseLevel
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 ORDER BY COUNT(T1.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: How many basic and medium undergraduate courses are there?
Evidence: basic and medium undergraduate courses refers to courseLevel = 'Level_300' and courses refers to course.course_id
SQL: SELECT COUNT(*) FROM course WHERE 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: How many people teaches course no.11?
Evidence: people refers to taughtBy.p_id; course no.11 refers to course_id = 11
SQL: SELECT COUNT(*) FROM taughtBy WHERE course_id = 11
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 course has more teachers, course no.16 or course no.18?
Evidence: teachers refers to taughtBy.p_id; course no.16 refers to course_id = 16; course no.18 refers to course_id = 18
SQL: SELECT course_id FROM taughtBy WHERE course_id = 11 OR course_id = 18 GROUP BY course_id ORDER BY COUNT(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: How many teachers are faculty employees?
Evidence: teachers refers to professor = 1; faculty employees refers to hasPosition = 'Faculty_eme'
SQL: SELECT COUNT(*) FROM person 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: Please list the IDs of the teachers who have advised more than 4 others to teach.
Evidence: teachers refers to p_id_dummy; have advised more than 4 others refers to count(advisedBy.p_id) > 4
SQL: SELECT p_id_dummy FROM advisedBy GROUP BY p_id_dummy HAVING COUNT(p_id_dummy) > 4
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 basic or medium undergraduate courses are taught by a professor?
Evidence: basic or medium undergraduate courses refers to courseLevel = 'Level_300'; professor refers to professor = 1
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 T3.p_id = T2.p_id WHERE T1.courseLevel = 'Level_300' AND T3.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: Please list the IDs of all the faculty employees who teaches a basic or medium undergraduate course.
Evidence: faculty employees refers to hasPosition = 'Faculty_eme'; basic or medium undergraduate course refers to courseLevel = 'Level_300'
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_300' AND T3.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: Is the teacher who teaches course no.9 a faculty member?
Evidence: teacher refers to taughtBy.p_id; course no.9 refers to taughtBy.course_id = 9; faculty member refers to hasPosition ! = 0
SQL: SELECT T2.hasPosition FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T1.course_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: Please list the levels of the all courses taught by teacher no.79.
Evidence: levels of the all courses refers to courseLevel; teacher no.79 refers to taughtBy.p_id = 79
SQL: SELECT T1.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T2.p_id = 79