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: Give the student's last name that gave the highest student satisfaction for the course "Intro to Database 2".
Evidence: student's last name refers to l_name; satisfaction refers to sat; highest satisfaction refers to MAX(sat);
SQL: SELECT 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 = 'Intro to Database 2' ORDER BY T2.sat 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: Among the students with high salary, what is total number of students with a GPA higher than 3?
Evidence: high salary refers to salary = 'high'; GPA higher than 3 refers to gpa > 3;
SQL: SELECT COUNT(T1.student_id) FROM RA AS T1 INNER JOIN student AS T2 ON T1.student_id = T2.student_id WHERE T1.salary = 'high' AND T2.gpa > 3
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 undergraduate students, list the name of the course with the highest student satisfaction.
Evidence: Undergraduate students refers to type = 'UG'; satisfaction refers to sat; highest satisfaction refers to MAX(sat);
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 T1.type = 'UG' ORDER BY T2.sat 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: List the capability of research postgraduate students with an intellegence level of 4 and above.
Evidence: research postgraduate students refers to type = 'RPG'; intelligence level of 4 and above refers to intelligence > = 4;
SQL: SELECT T1.capability FROM RA AS T1 INNER JOIN student AS T2 ON T1.student_id = T2.student_id WHERE T2.type = 'RPG' AND T2.intelligence >= 4
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: In students with a grade of B, how many of them have an intellegence level of 3?
SQL: SELECT COUNT(T1.student_id) FROM registration AS T1 INNER JOIN student AS T2 ON T1.student_id = T2.student_id WHERE T1.grade = 'B' AND T2.intelligence = 3
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 difficulty of the course in which a student with level of intellengence of 5 got an A grade?
Evidence: difficulty of the course refers to diff;
SQL: SELECT T3.diff 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.grade = 'A' AND T1.intelligence = 5
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 popularity, how many of their students have research capability of 5?
Evidence: highest popularity refers to MAX(popularity); research capability refers to capability; capability = 5;
SQL: SELECT COUNT(T1.student_id) FROM RA AS T1 INNER JOIN prof AS T2 ON T1.prof_id = T2.prof_id WHERE T1.capability = 5 ORDER BY T2.popularity 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: List the course's name where students acquired a grade of D.
SQL: SELECT T1.name FROM course AS T1 INNER JOIN registration AS T2 ON T1.course_id = T2.course_id WHERE T2.grade = 'D'
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 capability on research of the student named Alvera McQuillin?
Evidence: capability on research refers to capability;
SQL: SELECT T2.capability FROM student AS T1 INNER JOIN RA AS T2 ON T1.student_id = T2.student_id WHERE T1.f_name = 'Alvera' AND T1.l_name = 'McQuillin'
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: Of courses with 3 credit, how many students have GPA of 3.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.credit = 3 AND T1.gpa = 3.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: Among students with low salary, how many of them have a gpa of 3.5?
Evidence: low salary refers to salary = 'low';
SQL: SELECT COUNT(T1.student_id) FROM RA AS T1 INNER JOIN student AS T2 ON T1.student_id = T2.student_id WHERE T2.gpa = 3.5 AND T1.salary = 'low'
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 email with grade of B in a course with difficulty greater than the 80% of average difficulty of all courses.
Evidence: difficulty refers to diff; course with difficulty greater than the 80% of average difficulty refers to diff > MULTIPLY(AVG(diff), 80%);
SQL: SELECT T2.email FROM registration AS T1 INNER JOIN student AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T1.course_id = T3.course_id WHERE T1.grade = 'B' GROUP BY T3.diff HAVING T3.diff > AVG(T3.diff) * 0.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 the professors with a teachability of 3 and below, what is the percentage of their student advisees with a low salary?
Evidence: teachability < = 3; percentage = MULTIPLY(DIVIDE(COUNT(salary = 'low'), COUNT(salary)), 1.0);
SQL: SELECT CAST(SUM(CASE WHEN T1.salary = 'low' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.salary) FROM RA AS T1 INNER JOIN prof AS T2 ON T1.prof_id = T2.prof_id WHERE T2.teachingability < 3
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: Find the most important and most difficult courses.
Evidence: most important refers to MAX(credit); most difficult refers to MAX(diff);
SQL: SELECT name FROM course WHERE credit = ( SELECT MAX(credit) FROM course ) AND diff = ( SELECT MAX(diff) FROM course )
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 average teaching ability of the most popular professors?
Evidence: average = AVG(teachingability); most popular professor refers to MAX(popularity);
SQL: SELECT CAST(SUM(teachingability) AS REAL) / COUNT(prof_id) FROM prof WHERE popularity = ( SELECT MAX(popularity) FROM prof )
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: Calculate the average satisfaction of the good students with their courses.
Evidence: average satisfaction = DIVIDE(SUM(sat), COUNT(course_id)); satisfaction refers to sat; good student refers to grade = 'B';
SQL: SELECT CAST(SUM(sat) AS REAL) / COUNT(course_id) FROM registration WHERE grade = 'B'
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 less than four intelligence, list the full name and phone number of students with a greater than 3 GPA.
Evidence: intelligence < 4; full name = f_name, l_name; gpa > 3;
SQL: SELECT f_name, l_name, phone_number FROM student WHERE gpa > 3 AND intelligence < 4
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: Name the students with above-average capability.
Evidence: name of the students = f_name, l_name; above average-capability refers to capability > AVG(capability);
SQL: SELECT T1.f_name, T1.l_name FROM student AS T1 INNER JOIN RA AS T2 ON T1.student_id = T2.student_id WHERE T2.capability > ( SELECT AVG(capability) FROM RA )
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: For the students with an intelligence of 5, list the full name and courses taken by them who have less than a 3 GPA.
Evidence: full name of the students = f_name, l_name; gpa < 3;
SQL: SELECT T1.f_name, T1.l_name, 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 T1.intelligence = 5 AND T1.gpa < 3
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 average capability of students with less than a 2.5 GPA?
Evidence: average capability = AVG(capability); gpa < 2.5;
SQL: SELECT CAST(SUM(T1.capability) AS REAL) / COUNT(T1.student_id) FROM RA AS T1 INNER JOIN student AS T2 ON T1.student_id = T2.student_id WHERE T2.gpa < 2.5
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 full name of the professors who advised students with intelligence 1.
Evidence: full name of the professors = first_name, last_name;
SQL: SELECT T1.first_name, T1.last_name FROM prof AS T1 INNER JOIN RA AS T2 ON T1.prof_id = T2.prof_id INNER JOIN student AS T3 ON T2.student_id = T3.student_id WHERE T3.intelligence = 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 difference in the average GPA of students who took the hardest and easiest courses?
Evidence: difference in the average gpa = SUBTRACT(AVG(gpa WHERE MAX(diff)), AVG(gpa where min(diff))); difficulty of the course refers to diff; hardest course refers to MAX(diff); easiest course refers to MIN(diff);
SQL: SELECT AVG(T1.gpa) 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 IN (2, 1) GROUP BY T3.diff
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: Give the full name and capability of students who failed in any courses.
Evidence: full name of students = f_name, l_name; failed refers to grade IS NULL;
SQL: SELECT T2.f_name, T2.l_name, T1.capability FROM RA AS T1 INNER JOIN student AS T2 ON T2.student_id = T1.student_id INNER JOIN registration AS T3 ON T2.student_id = T3.student_id WHERE T3.grade IS NULL OR T3.grade = ''
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: Of the students with high salaries, how many took the computer vision course?
Evidence: high salaries refers to salary = 'High';
SQL: SELECT COUNT(T1.student_id) FROM RA AS T1 INNER JOIN registration AS T2 ON T2.student_id = T1.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T1.salary = 'high' AND T3.name = 'Computer Vision'
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: Find the full name and popularity of the professor who advises the most number of students.
Evidence: full name of the professor = first_name, last_name; most number of students refers to MAX(COUNT(student_id));
SQL: SELECT T1.first_name, T1.last_name, T1.popularity FROM prof AS T1 INNER JOIN RA AS T2 ON T1.prof_id = T2.prof_id GROUP BY T1.prof_id ORDER BY COUNT(T2.student_id) 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: Please give the name of the course in which most numbers of the students got an A. Also, list the full name of the students who got an A in this course.
Evidence: most number of students got an A refers MAX(COUNT(student_id WHERE grade = 'A')); full name = f_name, l_name; got an A refers to grade = 'A';
SQL: SELECT T3.name, T2.f_name, T2.l_name FROM registration AS T1 INNER JOIN student AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T1.course_id = T3.course_id WHERE T1.grade = 'A' GROUP BY T3.name ORDER BY COUNT(T1.student_id) 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: Calculate the difference between the average satisfaction of the students with high salaries and no salary.
Evidence: average satisfaction difference = SUBTRACT(AVG(sat where salary = 'high')), (AVG(sat where salary = 'free')); satisfaction refers to sat; no salary refers to salary = 'free';
SQL: SELECT AVG(T2.sat) - ( SELECT AVG(T2.sat) FROM RA AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id WHERE T1.salary = 'free' ) AS diff FROM RA AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id WHERE T1.salary = 'high'
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: Find the university from which the professor who advised most undergraduate students graduated.
Evidence: university from which the professor graduated refers to graduate_from; undergraduate students refers to type = 'UG';
SQL: SELECT T1.graduate_from FROM prof AS T1 INNER JOIN RA AS T2 ON T1.prof_id = T2.prof_id INNER JOIN student AS T3 ON T2.student_id = T3.student_id WHERE T3.type = 'UG' GROUP BY T1.prof_id ORDER BY COUNT(T2.student_id) DESC LIMIT 1