problem
stringlengths 121
422
| db_id
stringclasses 69
values | solution
stringlengths 23
804
|
---|---|---|
Write SQL query to solve given problem: What is the name of the most difficult course?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | cs_semester | SELECT name FROM course WHERE diff = ( SELECT MAX(diff) FROM course ) |
Write SQL query to solve given problem: Among the students with a gpa of 3.1 to 3.7, how many of them are undergraduate students?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | cs_semester | SELECT COUNT(student_id) FROM student WHERE gpa BETWEEN 3.1 AND 3.7 AND type = 'UG' |
Write SQL query to solve given problem: What is the credit of the course named "Computer Vision"?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | cs_semester | SELECT credit FROM course WHERE name = 'Computer Vision' |
Write SQL query to solve given problem: Give the student's ID of students with 2.5 GPA and enrolled in C for Programmers.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | cs_semester | SELECT T2.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 = 'C for Programmers' AND T1.gpa = 2.5 |
Write SQL query to solve given problem: Give the student's last name that gave the highest student satisfaction for the course "Intro to Database 2".. Keep the solution inside sql tag ```sql [SQL-Query] ``` | cs_semester | 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 |
Write SQL query to solve given problem: Among the students with high salary, what is total number of students with a GPA higher than 3?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | cs_semester | 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 |
Write SQL query to solve given problem: Among undergraduate students, list the name of the course with the highest student satisfaction.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | cs_semester | 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 |
Write SQL query to solve given problem: List the capability of research postgraduate students with an intellegence level of 4 and above.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | cs_semester | 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 |
Write SQL query to solve given problem: In students with a grade of B, how many of them have an intellegence level of 3?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | cs_semester | 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 |
Write SQL query to solve given problem: What is the difficulty of the course in which a student with level of intellengence of 5 got an A grade?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | cs_semester | 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 |
Write SQL query to solve given problem: Among professors with the highest popularity, how many of their students have research capability of 5?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | cs_semester | 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 |
Write SQL query to solve given problem: List the course's name where students acquired a grade of D.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | cs_semester | SELECT T1.name FROM course AS T1 INNER JOIN registration AS T2 ON T1.course_id = T2.course_id WHERE T2.grade = 'D' |
Write SQL query to solve given problem: What is the capability on research of the student named Alvera McQuillin?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | cs_semester | 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' |
Write SQL query to solve given problem: Of courses with 3 credit, how many students have GPA of 3.2?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | cs_semester | 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 |
Write SQL query to solve given problem: Among students with low salary, how many of them have a gpa of 3.5?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | cs_semester | 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' |
Write SQL query to solve given problem: List the student's email with grade of B in a course with difficulty greater than the 80% of average difficulty of all courses.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | cs_semester | 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 |
Write SQL query to solve given problem: Among the professors with a teachability of 3 and below, what is the percentage of their student advisees with a low salary?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | cs_semester | 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 |
Write SQL query to solve given problem: Find the most important and most difficult courses.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | cs_semester | SELECT name FROM course WHERE credit = ( SELECT MAX(credit) FROM course ) AND diff = ( SELECT MAX(diff) FROM course ) |
Write SQL query to solve given problem: What is the average teaching ability of the most popular professors?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | cs_semester | SELECT CAST(SUM(teachingability) AS REAL) / COUNT(prof_id) FROM prof WHERE popularity = ( SELECT MAX(popularity) FROM prof ) |
Write SQL query to solve given problem: Calculate the average satisfaction of the good students with their courses.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | cs_semester | SELECT CAST(SUM(sat) AS REAL) / COUNT(course_id) FROM registration WHERE grade = 'B' |
Write SQL query to solve given problem: Among the students with less than four intelligence, list the full name and phone number of students with a greater than 3 GPA.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | cs_semester | SELECT f_name, l_name, phone_number FROM student WHERE gpa > 3 AND intelligence < 4 |
Write SQL query to solve given problem: Name the students with above-average capability.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | cs_semester | 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 ) |
Write SQL query to solve given problem: For the students with an intelligence of 5, list the full name and courses taken by them who have less than a 3 GPA.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | cs_semester | 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 |
Write SQL query to solve given problem: What is the average capability of students with less than a 2.5 GPA?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | cs_semester | 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 |
Write SQL query to solve given problem: List the full name of the professors who advised students with intelligence 1.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | cs_semester | 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 |
Write SQL query to solve given problem: What is the difference in the average GPA of students who took the hardest and easiest courses?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | cs_semester | 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 |
Write SQL query to solve given problem: Give the full name and capability of students who failed in any courses.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | cs_semester | 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 = '' |
Write SQL query to solve given problem: Of the students with high salaries, how many took the computer vision course?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | cs_semester | 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' |
Write SQL query to solve given problem: Find the full name and popularity of the professor who advises the most number of students.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | cs_semester | 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 |
Write SQL query to solve given problem: 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.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | cs_semester | 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 |
Write SQL query to solve given problem: Calculate the difference between the average satisfaction of the students with high salaries and no salary.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | cs_semester | 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' |
Write SQL query to solve given problem: Find the university from which the professor who advised most undergraduate students graduated.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | cs_semester | 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 |
Write SQL query to solve given problem: 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.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | cs_semester | 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 |
Write SQL query to solve given problem: What percentage of students are highly satisfied with the Intro to Database 2 course?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | cs_semester | 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' |
Write SQL query to solve given problem: What is the first and last name of students with highest gpa?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | cs_semester | SELECT f_name, l_name FROM student WHERE gpa = ( SELECT MAX(gpa) FROM student ) |
Write SQL query to solve given problem: Among professors with the highest teachability, how many of their students have high salary?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | cs_semester | 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 |
Write SQL query to solve given problem: What is the salary range of the student with an email of [email protected]?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | cs_semester | SELECT T1.salary FROM RA AS T1 INNER JOIN student AS T2 ON T1.student_id = T2.student_id WHERE T2.email = '[email protected]' |
Write SQL query to solve given problem: Among students that gave satisfaction of value 4 for the course named "Statistical Learning", how many of them have a gpa of 3.8?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | cs_semester | 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 |
Write SQL query to solve given problem: Among courses with difficulty of 3, how many students have intellegence level of 2?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | cs_semester | 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 |
Write SQL query to solve given problem: List the student's first and last name that got a C in the course named "Applied Deep Learning".. Keep the solution inside sql tag ```sql [SQL-Query] ``` | cs_semester | 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' |
Write SQL query to solve given problem: Among research postgraduate students, give the name of the course with the student satisfaction value of 1.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | cs_semester | 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' |
Write SQL query to solve given problem: Among the students with a capability below 3, what is the difference of undergraduate students from research postgraduate students?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | cs_semester | 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 |
Write SQL query to solve given problem: What is the average number of students for each advisor?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | computer_student | SELECT CAST(COUNT(p_id) AS REAL) / COUNT(DISTINCT p_id_dummy) AS avgnum FROM advisedBy GROUP BY p_id_dummy |
Write SQL query to solve given problem: How many professors are teaching course ID 18?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | computer_student | SELECT COUNT(DISTINCT p_id) FROM taughtBy WHERE course_id = 18 |
Write SQL query to solve given problem: List all the course IDs for professional or master/graduate courses.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | computer_student | SELECT course_id FROM course WHERE courseLevel = 'Level_500' |
Write SQL query to solve given problem: How many courses are there for basic or medium undergraduate courses?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | computer_student | SELECT COUNT(course_id) FROM course WHERE courseLevel = 'Level_300' |
Write SQL query to solve given problem: List the ID of all professors who are not faculty member along with the courses taught by him/her.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | computer_student | 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 |
Write SQL query to solve given problem: Provide the ID of professors who are teaching high-level or harder undergraduate course.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | computer_student | 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' |
Write SQL query to solve given problem: What are the courses taught by the advisors who gave advice to student with ID 376?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | computer_student | 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 |
Write SQL query to solve given problem: Name the advisors for students in Year 3 of the program.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | computer_student | 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' |
Write SQL query to solve given problem: Which level of courses is taught by professor ID 297?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | computer_student | SELECT T1.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T2.p_id = 297 |
Write SQL query to solve given problem: What level is course 165? List the professors who teach the course.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | computer_student | 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 |
Write SQL query to solve given problem: List the ID and years in program for students taught by advisor with ID 5.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | computer_student | 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 |
Write SQL query to solve given problem: State the courses and level of courses by professors who are faculty employees.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | computer_student | 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' |
Write SQL query to solve given problem: Find the ID of advisor of student ID 80 and state the level of courses taught by him/her.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | computer_student | 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 |
Write SQL query to solve given problem: Provide the ID of professors who teach in both harder undergraduate course and master/graduate courses.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | computer_student | 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' |
Write SQL query to solve given problem: Who are the professors who gave advice to students in the 12th years of program?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | computer_student | 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' |
Write SQL query to solve given problem: Which are the courses with the most number of professors? State the course ID and the level of the course.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | computer_student | 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 |
Write SQL query to solve given problem: How many basic and medium undergraduate courses are there?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | computer_student | SELECT COUNT(*) FROM course WHERE courseLevel = 'Level_300' |
Write SQL query to solve given problem: How many people teaches course no.11?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | computer_student | SELECT COUNT(*) FROM taughtBy WHERE course_id = 11 |
Write SQL query to solve given problem: Which course has more teachers, course no.16 or course no.18?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | computer_student | 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 |
Write SQL query to solve given problem: How many teachers are faculty employees?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | computer_student | SELECT COUNT(*) FROM person WHERE hasPosition = 'Faculty_eme' |
Write SQL query to solve given problem: Please list the IDs of the teachers who have advised more than 4 others to teach.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | computer_student | SELECT p_id_dummy FROM advisedBy GROUP BY p_id_dummy HAVING COUNT(p_id_dummy) > 4 |
Write SQL query to solve given problem: How many basic or medium undergraduate courses are taught by a professor?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | computer_student | 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 |
Write SQL query to solve given problem: Please list the IDs of all the faculty employees who teaches a basic or medium undergraduate course.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | computer_student | 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' |
Write SQL query to solve given problem: Is the teacher who teaches course no.9 a faculty member?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | computer_student | SELECT T2.hasPosition FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T1.course_id = 9 |
Write SQL query to solve given problem: Please list the levels of the all courses taught by teacher no.79.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | computer_student | SELECT T1.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T2.p_id = 79 |
Write SQL query to solve given problem: Please list the IDs of the advisors of the students who are in the 5th year of their program.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | computer_student | 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' |
Write SQL query to solve given problem: How many students are advised to teach by a professor teaching basic or medium undergraduate courses?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | computer_student | 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' |
Write SQL query to solve given problem: Among the courses that are basic or medium undergraduate courses, how many of them are taught by a faculty member?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | computer_student | 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' |
Write SQL query to solve given problem: For the professor who advised student no.6, please list the IDs of the courses he or she teaches.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | computer_student | 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 |
Write SQL query to solve given problem: What is the level of the course with the most number of teachers?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | computer_student | 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 |
Write SQL query to solve given problem: Please list the IDs of the professors that teaches more than 3 courses.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | computer_student | 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 |
Write SQL query to solve given problem: Please list the IDs of the top 3 professors that teaches the most courses.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | computer_student | 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 |
Write SQL query to solve given problem: In total, all the students in the 3rd year of their program are advised by how many professors?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | computer_student | 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' |
Write SQL query to solve given problem: What is the average number of courses taught by a professor?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | computer_student | 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 |
Write SQL query to solve given problem: What is the ratio of professors and students?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | computer_student | 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 |
Write SQL query to solve given problem: Calculate the percentage of high-level undergraduate course.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | computer_student | SELECT CAST(SUM(CASE WHEN courseLevel = 'Level_400' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) AS per FROM course |
Write SQL query to solve given problem: List down all the person IDs who taught course ID of 18.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | computer_student | SELECT p_id FROM taughtBy WHERE course_id = 18 |
Write SQL query to solve given problem: Provide the position status and IDs of professor who advised student ID "303".. Keep the solution inside sql tag ```sql [SQL-Query] ``` | computer_student | 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 |
Write SQL query to solve given problem: List the person IDs and course levels of the affiliated professors in faculty.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | computer_student | 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' |
Write SQL query to solve given problem: Describe the year in program and in phase status for the student with most number in advisor.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | computer_student | 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 |
Write SQL query to solve given problem: List down the advised student IDs and IDs of employing professor in faculty.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | computer_student | 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' |
Write SQL query to solve given problem: List the course IDs and levels of person IDs from 40 to 50.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | computer_student | 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 |
Write SQL query to solve given problem: Describe the course level and list of person IDs who taught course ID of 147.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | computer_student | 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 |
Write SQL query to solve given problem: Mention the person ID of faculty professor who taught course ID 104 and the course level.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | computer_student | 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 |
Write SQL query to solve given problem: Find the professor ID and position in faculty who taught high-level undergraduate course of less than 10 in ID.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | computer_student | 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 |
Write SQL query to solve given problem: List the professor ID who taught the course ID from 121 to 130 of basic undergraduate courses.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | computer_student | 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 |
Write SQL query to solve given problem: List the advisor IDs for students with eighth year of program and position status in faculty of those professors.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | computer_student | 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' |
Write SQL query to solve given problem: List any five of course IDs with professor IDs who taught master courses.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | computer_student | 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 |
Write SQL query to solve given problem: How many students are under advisor 415?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | computer_student | SELECT COUNT(*) FROM advisedBy WHERE p_id_dummy = 415 |
Write SQL query to solve given problem: How many professional or master/graduate courses are there?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | computer_student | SELECT COUNT(*) FROM course WHERE courseLevel = 'Level_500' |
Write SQL query to solve given problem: How many non-faculty members are not undergoing the phase of qualifications?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | computer_student | SELECT COUNT(*) FROM person WHERE hasPosition = 0 AND inPhase = 0 |
Write SQL query to solve given problem: Which professor taught the least amount of courses?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | computer_student | SELECT p_id FROM taughtBy GROUP BY p_id ORDER BY COUNT(course_id) ASC LIMIT 1 |
Write SQL query to solve given problem: Among the students being advised by Advisor 5, how many students are in the 5th year?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | computer_student | 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' |
Write SQL query to solve given problem: Which professor teaches the highest number of professional or master/graduate courses?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | computer_student | 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 |
Write SQL query to solve given problem: Among the faculty affiliated professor, how many professors teaches professional or master/undergraduate courses?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | computer_student | 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' |
Write SQL query to solve given problem: Who are the top 5 professors who teaches the highest number of professional or master/undergraduate courses?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | computer_student | 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 |
Write SQL query to solve given problem: How many advisors are in charge of advising all the students in 1st year?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | computer_student | 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 |
Write SQL query to solve given problem: How many professors teaches no more than two high-level or harder undergraduate courses?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | computer_student | 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 ) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.