input
stringlengths
201
2.7k
output
stringlengths
24
744
[INST] Here is a database schema: prof : prof_id [ INTEGER ] primary_key gender [ TEXT ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] popularity [ INTEGER ] teachingability [ INTEGER ] graduate_from [ TEXT ] Please write me a SQL statement that answers the following question: How many of the professors are fe...
SELECT COUNT(prof_id) FROM prof WHERE gender = 'Female';
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] Please write me a SQL statement that answers the following question: What is the name of the most difficult course? [/INST] [/INST]
SELECT name FROM course WHERE diff = ( SELECT MAX(diff) FROM course );
[INST] Here is a database schema: student : student_id [ INTEGER ] primary_key f_name [ TEXT ] l_name [ TEXT ] phone_number [ TEXT ] email [ TEXT ] intelligence [ INTEGER ] gpa [ REAL ] type [ TEXT ] Please write me a SQL statement that answers the following question: Among the students with a gpa of 3.1 to 3.7, how m...
SELECT COUNT(student_id) FROM student WHERE gpa BETWEEN 3.1 AND 3.7 AND type = 'UG';
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] Please write me a SQL statement that answers the following question: What is the credit of the course named "Computer Vision"? [/INST] [/INST]
SELECT credit FROM course WHERE name = 'Computer Vision';
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] student : stude...
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;
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] student : stude...
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;
[INST] Here is a database schema: RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER ] RA.prof_id = prof.prof_id salary [ TEXT ] student : student_id [ INTEGER ] primary_key f_name [ TEXT ] l_name [ TEXT ] phone_number [ TEXT ] email [ TEXT ] intelligence [ INTEGER ]...
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;
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] student : stude...
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;
[INST] Here is a database schema: RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER ] RA.prof_id = prof.prof_id salary [ TEXT ] student : student_id [ INTEGER ] primary_key f_name [ TEXT ] l_name [ TEXT ] phone_number [ TEXT ] email [ TEXT ] intelligence [ INTEGER ]...
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;
[INST] Here is a database schema: registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] student : student_id [ INTEGER ] primary_key f_name [ TEXT ] l_name [ TEXT ] phone_number [ TEXT ] email [ T...
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;
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] student : stude...
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;
[INST] Here is a database schema: prof : prof_id [ INTEGER ] primary_key gender [ TEXT ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] popularity [ INTEGER ] teachingability [ INTEGER ] graduate_from [ TEXT ] RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER...
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;
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] Please write m...
SELECT T1.name FROM course AS T1 INNER JOIN registration AS T2 ON T1.course_id = T2.course_id WHERE T2.grade = 'D';
[INST] Here is a database schema: RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER ] RA.prof_id = prof.prof_id salary [ TEXT ] student : student_id [ INTEGER ] primary_key f_name [ TEXT ] l_name [ TEXT ] phone_number [ TEXT ] email [ TEXT ] intelligence [ INTEGER ]...
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';
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] student : stude...
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;
[INST] Here is a database schema: RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER ] RA.prof_id = prof.prof_id salary [ TEXT ] student : student_id [ INTEGER ] primary_key f_name [ TEXT ] l_name [ TEXT ] phone_number [ TEXT ] email [ TEXT ] intelligence [ INTEGER ]...
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';
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] student : stude...
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;
[INST] Here is a database schema: prof : prof_id [ INTEGER ] primary_key gender [ TEXT ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] popularity [ INTEGER ] teachingability [ INTEGER ] graduate_from [ TEXT ] RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER...
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;
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] Please write me a SQL statement that answers the following question: Find the most important and most difficult courses. [/INST] [/INST]
SELECT name FROM course WHERE credit = ( SELECT MAX(credit) FROM course ) AND diff = ( SELECT MAX(diff) FROM course );
[INST] Here is a database schema: prof : prof_id [ INTEGER ] primary_key gender [ TEXT ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] popularity [ INTEGER ] teachingability [ INTEGER ] graduate_from [ TEXT ] Please write me a SQL statement that answers the following question: What is the average teaching abil...
SELECT CAST(SUM(teachingability) AS REAL) / COUNT(prof_id) FROM prof WHERE popularity = ( SELECT MAX(popularity) FROM prof );
[INST] Here is a database schema: registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] Please write me a SQL statement that answers the following question: Calculate the average satisfaction of ...
SELECT CAST(SUM(sat) AS REAL) / COUNT(course_id) FROM registration WHERE grade = 'B';
[INST] Here is a database schema: student : student_id [ INTEGER ] primary_key f_name [ TEXT ] l_name [ TEXT ] phone_number [ TEXT ] email [ TEXT ] intelligence [ INTEGER ] gpa [ REAL ] type [ TEXT ] Please write me a SQL statement that answers the following question: Among the students with less than four intelligenc...
SELECT f_name, l_name, phone_number FROM student WHERE gpa > 3 AND intelligence < 4;
[INST] Here is a database schema: RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER ] RA.prof_id = prof.prof_id salary [ TEXT ] student : student_id [ INTEGER ] primary_key f_name [ TEXT ] l_name [ TEXT ] phone_number [ TEXT ] email [ TEXT ] intelligence [ INTEGER ]...
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 );
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] student : stude...
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;
[INST] Here is a database schema: RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER ] RA.prof_id = prof.prof_id salary [ TEXT ] student : student_id [ INTEGER ] primary_key f_name [ TEXT ] l_name [ TEXT ] phone_number [ TEXT ] email [ TEXT ] intelligence [ INTEGER ]...
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;
[INST] Here is a database schema: prof : prof_id [ INTEGER ] primary_key gender [ TEXT ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] popularity [ INTEGER ] teachingability [ INTEGER ] graduate_from [ TEXT ] RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER...
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;
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] student : stude...
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;
[INST] Here is a database schema: RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER ] RA.prof_id = prof.prof_id salary [ TEXT ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.st...
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 = '';
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER ] RA.prof_id = prof.prof_id salary [ TEXT ] registration : course_id [ INTEGER ] registra...
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';
[INST] Here is a database schema: prof : prof_id [ INTEGER ] primary_key gender [ TEXT ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] popularity [ INTEGER ] teachingability [ INTEGER ] graduate_from [ TEXT ] RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER...
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;
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] student : stude...
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;
[INST] Here is a database schema: RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER ] RA.prof_id = prof.prof_id salary [ TEXT ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.st...
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';
[INST] Here is a database schema: prof : prof_id [ INTEGER ] primary_key gender [ TEXT ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] popularity [ INTEGER ] teachingability [ INTEGER ] graduate_from [ TEXT ] RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER...
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;
[INST] Here is a database schema: prof : prof_id [ INTEGER ] primary_key gender [ TEXT ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] popularity [ INTEGER ] teachingability [ INTEGER ] graduate_from [ TEXT ] RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER...
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;
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] Please write m...
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 = '...
[INST] Here is a database schema: student : student_id [ INTEGER ] primary_key f_name [ TEXT ] l_name [ TEXT ] phone_number [ TEXT ] email [ TEXT ] intelligence [ INTEGER ] gpa [ REAL ] type [ TEXT ] Please write me a SQL statement that answers the following question: What is the first and last name of students with h...
SELECT f_name, l_name FROM student WHERE gpa = ( SELECT MAX(gpa) FROM student );
[INST] Here is a database schema: prof : prof_id [ INTEGER ] primary_key gender [ TEXT ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] popularity [ INTEGER ] teachingability [ INTEGER ] graduate_from [ TEXT ] RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER...
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;
[INST] Here is a database schema: RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER ] RA.prof_id = prof.prof_id salary [ TEXT ] student : student_id [ INTEGER ] primary_key f_name [ TEXT ] l_name [ TEXT ] phone_number [ TEXT ] email [ TEXT ] intelligence [ INTEGER ]...
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';
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] student : stude...
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;
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] student : stude...
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;
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] student : stude...
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';
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key name [ TEXT ] credit [ INTEGER ] diff [ INTEGER ] registration : course_id [ INTEGER ] registration.course_id = course.course_id student_id [ INTEGER ] registration.student_id = student.student_id grade [ TEXT ] sat [ INTEGER ] student : stude...
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';
[INST] Here is a database schema: RA : student_id [ INTEGER ] RA.student_id = student.student_id capability [ INTEGER ] prof_id [ INTEGER ] RA.prof_id = prof.prof_id salary [ TEXT ] student : student_id [ INTEGER ] primary_key f_name [ TEXT ] l_name [ TEXT ] phone_number [ TEXT ] email [ TEXT ] intelligence [ INTEGER ]...
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;
[INST] Here is a database schema: advisedBy : p_id [ INTEGER ] advisedBy.p_id = person.p_id p_id_dummy [ INTEGER ] advisedBy.p_id_dummy = person.p_id Please write me a SQL statement that answers the following question: What is the average number of students for each advisor? [/INST] [/INST]
SELECT CAST(COUNT(p_id) AS REAL) / COUNT(DISTINCT p_id_dummy) AS avgnum FROM advisedBy GROUP BY p_id_dummy;
[INST] Here is a database schema: taughtBy : course_id [ INTEGER ] taughtBy.course_id = course.course_id p_id [ INTEGER ] taughtBy.p_id = person.p_id Please write me a SQL statement that answers the following question: How many professors are teaching course ID 18? [/INST] [/INST]
SELECT COUNT(DISTINCT p_id) FROM taughtBy WHERE course_id = 18;
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key courseLevel [ TEXT ] Please write me a SQL statement that answers the following question: List all the course IDs for professional or master/graduate courses. [/INST] [/INST]
SELECT course_id FROM course WHERE courseLevel = 'Level_500';
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key courseLevel [ TEXT ] Please write me a SQL statement that answers the following question: How many courses are there for basic or medium undergraduate courses? [/INST] [/INST]
SELECT COUNT(course_id) FROM course WHERE courseLevel = 'Level_300';
[INST] Here is a database schema: person : p_id [ INTEGER ] primary_key professor [ INTEGER ] student [ INTEGER ] hasPosition [ TEXT ] inPhase [ TEXT ] yearsInProgram [ TEXT ] taughtBy : course_id [ INTEGER ] taughtBy.course_id = course.course_id p_id [ INTEGER ] taughtBy.p_id = person.p_id Please write me a SQL state...
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;
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key courseLevel [ TEXT ] taughtBy : course_id [ INTEGER ] taughtBy.course_id = course.course_id p_id [ INTEGER ] taughtBy.p_id = person.p_id Please write me a SQL statement that answers the following question: Provide the ID of professors who are...
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';
[INST] Here is a database schema: person : p_id [ INTEGER ] primary_key professor [ INTEGER ] student [ INTEGER ] hasPosition [ TEXT ] inPhase [ TEXT ] yearsInProgram [ TEXT ] advisedBy : p_id [ INTEGER ] advisedBy.p_id = person.p_id p_id_dummy [ INTEGER ] advisedBy.p_id_dummy = person.p_id taughtBy : course_id [ INTEG...
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;
[INST] Here is a database schema: person : p_id [ INTEGER ] primary_key professor [ INTEGER ] student [ INTEGER ] hasPosition [ TEXT ] inPhase [ TEXT ] yearsInProgram [ TEXT ] advisedBy : p_id [ INTEGER ] advisedBy.p_id = person.p_id p_id_dummy [ INTEGER ] advisedBy.p_id_dummy = person.p_id Please write me a SQL state...
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';
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key courseLevel [ TEXT ] taughtBy : course_id [ INTEGER ] taughtBy.course_id = course.course_id p_id [ INTEGER ] taughtBy.p_id = person.p_id Please write me a SQL statement that answers the following question: Which level of courses is taught by ...
SELECT T1.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T2.p_id = 297;
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key courseLevel [ TEXT ] taughtBy : course_id [ INTEGER ] taughtBy.course_id = course.course_id p_id [ INTEGER ] taughtBy.p_id = person.p_id Please write me a SQL statement that answers the following question: What level is course 165? List the p...
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;
[INST] Here is a database schema: person : p_id [ INTEGER ] primary_key professor [ INTEGER ] student [ INTEGER ] hasPosition [ TEXT ] inPhase [ TEXT ] yearsInProgram [ TEXT ] advisedBy : p_id [ INTEGER ] advisedBy.p_id = person.p_id p_id_dummy [ INTEGER ] advisedBy.p_id_dummy = person.p_id Please write me a SQL state...
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;
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key courseLevel [ TEXT ] person : p_id [ INTEGER ] primary_key professor [ INTEGER ] student [ INTEGER ] hasPosition [ TEXT ] inPhase [ TEXT ] yearsInProgram [ TEXT ] taughtBy : course_id [ INTEGER ] taughtBy.course_id = course.course_id p_id [ IN...
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';
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key courseLevel [ TEXT ] advisedBy : p_id [ INTEGER ] advisedBy.p_id = person.p_id p_id_dummy [ INTEGER ] advisedBy.p_id_dummy = person.p_id taughtBy : course_id [ INTEGER ] taughtBy.course_id = course.course_id p_id [ INTEGER ] taughtBy.p_id = pe...
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;
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key courseLevel [ TEXT ] taughtBy : course_id [ INTEGER ] taughtBy.course_id = course.course_id p_id [ INTEGER ] taughtBy.p_id = person.p_id Please write me a SQL statement that answers the following question: Provide the ID of professors who tea...
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';
[INST] Here is a database schema: person : p_id [ INTEGER ] primary_key professor [ INTEGER ] student [ INTEGER ] hasPosition [ TEXT ] inPhase [ TEXT ] yearsInProgram [ TEXT ] advisedBy : p_id [ INTEGER ] advisedBy.p_id = person.p_id p_id_dummy [ INTEGER ] advisedBy.p_id_dummy = person.p_id Please write me a SQL state...
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';
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key courseLevel [ TEXT ] taughtBy : course_id [ INTEGER ] taughtBy.course_id = course.course_id p_id [ INTEGER ] taughtBy.p_id = person.p_id Please write me a SQL statement that answers the following question: Which are the courses with the most ...
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;
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key courseLevel [ TEXT ] Please write me a SQL statement that answers the following question: How many basic and medium undergraduate courses are there? [/INST] [/INST]
SELECT COUNT(*) FROM course WHERE courseLevel = 'Level_300';
[INST] Here is a database schema: taughtBy : course_id [ INTEGER ] taughtBy.course_id = course.course_id p_id [ INTEGER ] taughtBy.p_id = person.p_id Please write me a SQL statement that answers the following question: How many people teaches course no.11? [/INST] [/INST]
SELECT COUNT(*) FROM taughtBy WHERE course_id = 11;
[INST] Here is a database schema: taughtBy : course_id [ INTEGER ] taughtBy.course_id = course.course_id p_id [ INTEGER ] taughtBy.p_id = person.p_id Please write me a SQL statement that answers the following question: Which course has more teachers, course no.16 or course no.18? [/INST] [/INST]
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;
[INST] Here is a database schema: person : p_id [ INTEGER ] primary_key professor [ INTEGER ] student [ INTEGER ] hasPosition [ TEXT ] inPhase [ TEXT ] yearsInProgram [ TEXT ] Please write me a SQL statement that answers the following question: How many teachers are faculty employees? [/INST] [/INST]
SELECT COUNT(*) FROM person WHERE hasPosition = 'Faculty_eme';
[INST] Here is a database schema: advisedBy : p_id [ INTEGER ] advisedBy.p_id = person.p_id p_id_dummy [ INTEGER ] advisedBy.p_id_dummy = person.p_id Please write me a SQL statement that answers the following question: Please list the IDs of the teachers who have advised more than 4 others to teach. [/INST] [/INST]
SELECT p_id_dummy FROM advisedBy GROUP BY p_id_dummy HAVING COUNT(p_id_dummy) > 4;
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key courseLevel [ TEXT ] person : p_id [ INTEGER ] primary_key professor [ INTEGER ] student [ INTEGER ] hasPosition [ TEXT ] inPhase [ TEXT ] yearsInProgram [ TEXT ] taughtBy : course_id [ INTEGER ] taughtBy.course_id = course.course_id p_id [ IN...
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;
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key courseLevel [ TEXT ] person : p_id [ INTEGER ] primary_key professor [ INTEGER ] student [ INTEGER ] hasPosition [ TEXT ] inPhase [ TEXT ] yearsInProgram [ TEXT ] taughtBy : course_id [ INTEGER ] taughtBy.course_id = course.course_id p_id [ IN...
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';
[INST] Here is a database schema: person : p_id [ INTEGER ] primary_key professor [ INTEGER ] student [ INTEGER ] hasPosition [ TEXT ] inPhase [ TEXT ] yearsInProgram [ TEXT ] taughtBy : course_id [ INTEGER ] taughtBy.course_id = course.course_id p_id [ INTEGER ] taughtBy.p_id = person.p_id Please write me a SQL state...
SELECT T2.hasPosition FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T1.course_id = 9;
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key courseLevel [ TEXT ] taughtBy : course_id [ INTEGER ] taughtBy.course_id = course.course_id p_id [ INTEGER ] taughtBy.p_id = person.p_id Please write me a SQL statement that answers the following question: Please list the levels of the all co...
SELECT T1.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T2.p_id = 79;
[INST] Here is a database schema: person : p_id [ INTEGER ] primary_key professor [ INTEGER ] student [ INTEGER ] hasPosition [ TEXT ] inPhase [ TEXT ] yearsInProgram [ TEXT ] advisedBy : p_id [ INTEGER ] advisedBy.p_id = person.p_id p_id_dummy [ INTEGER ] advisedBy.p_id_dummy = person.p_id Please write me a SQL state...
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';
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key courseLevel [ TEXT ] person : p_id [ INTEGER ] primary_key professor [ INTEGER ] student [ INTEGER ] hasPosition [ TEXT ] inPhase [ TEXT ] yearsInProgram [ TEXT ] advisedBy : p_id [ INTEGER ] advisedBy.p_id = person.p_id p_id_dummy [ INTEGER ]...
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';
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key courseLevel [ TEXT ] person : p_id [ INTEGER ] primary_key professor [ INTEGER ] student [ INTEGER ] hasPosition [ TEXT ] inPhase [ TEXT ] yearsInProgram [ TEXT ] taughtBy : course_id [ INTEGER ] taughtBy.course_id = course.course_id p_id [ IN...
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';
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key courseLevel [ TEXT ] advisedBy : p_id [ INTEGER ] advisedBy.p_id = person.p_id p_id_dummy [ INTEGER ] advisedBy.p_id_dummy = person.p_id taughtBy : course_id [ INTEGER ] taughtBy.course_id = course.course_id p_id [ INTEGER ] taughtBy.p_id = pe...
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;
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key courseLevel [ TEXT ] taughtBy : course_id [ INTEGER ] taughtBy.course_id = course.course_id p_id [ INTEGER ] taughtBy.p_id = person.p_id Please write me a SQL statement that answers the following question: What is the level of the course with...
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;
[INST] Here is a database schema: person : p_id [ INTEGER ] primary_key professor [ INTEGER ] student [ INTEGER ] hasPosition [ TEXT ] inPhase [ TEXT ] yearsInProgram [ TEXT ] taughtBy : course_id [ INTEGER ] taughtBy.course_id = course.course_id p_id [ INTEGER ] taughtBy.p_id = person.p_id Please write me a SQL state...
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;
[INST] Here is a database schema: person : p_id [ INTEGER ] primary_key professor [ INTEGER ] student [ INTEGER ] hasPosition [ TEXT ] inPhase [ TEXT ] yearsInProgram [ TEXT ] taughtBy : course_id [ INTEGER ] taughtBy.course_id = course.course_id p_id [ INTEGER ] taughtBy.p_id = person.p_id Please write me a SQL state...
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;
[INST] Here is a database schema: person : p_id [ INTEGER ] primary_key professor [ INTEGER ] student [ INTEGER ] hasPosition [ TEXT ] inPhase [ TEXT ] yearsInProgram [ TEXT ] advisedBy : p_id [ INTEGER ] advisedBy.p_id = person.p_id p_id_dummy [ INTEGER ] advisedBy.p_id_dummy = person.p_id Please write me a SQL state...
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';
[INST] Here is a database schema: person : p_id [ INTEGER ] primary_key professor [ INTEGER ] student [ INTEGER ] hasPosition [ TEXT ] inPhase [ TEXT ] yearsInProgram [ TEXT ] taughtBy : course_id [ INTEGER ] taughtBy.course_id = course.course_id p_id [ INTEGER ] taughtBy.p_id = person.p_id Please write me a SQL state...
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;
[INST] Here is a database schema: person : p_id [ INTEGER ] primary_key professor [ INTEGER ] student [ INTEGER ] hasPosition [ TEXT ] inPhase [ TEXT ] yearsInProgram [ TEXT ] Please write me a SQL statement that answers the following question: What is the ratio of professors and students? [/INST] [/INST]
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;
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key courseLevel [ TEXT ] Please write me a SQL statement that answers the following question: Calculate the percentage of high-level undergraduate course. [/INST] [/INST]
SELECT CAST(SUM(CASE WHEN courseLevel = 'Level_400' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) AS per FROM course;
[INST] Here is a database schema: taughtBy : course_id [ INTEGER ] taughtBy.course_id = course.course_id p_id [ INTEGER ] taughtBy.p_id = person.p_id Please write me a SQL statement that answers the following question: List down all the person IDs who taught course ID of 18. [/INST] [/INST]
SELECT p_id FROM taughtBy WHERE course_id = 18;
[INST] Here is a database schema: person : p_id [ INTEGER ] primary_key professor [ INTEGER ] student [ INTEGER ] hasPosition [ TEXT ] inPhase [ TEXT ] yearsInProgram [ TEXT ] advisedBy : p_id [ INTEGER ] advisedBy.p_id = person.p_id p_id_dummy [ INTEGER ] advisedBy.p_id_dummy = person.p_id Please write me a SQL state...
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;
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key courseLevel [ TEXT ] person : p_id [ INTEGER ] primary_key professor [ INTEGER ] student [ INTEGER ] hasPosition [ TEXT ] inPhase [ TEXT ] yearsInProgram [ TEXT ] taughtBy : course_id [ INTEGER ] taughtBy.course_id = course.course_id p_id [ IN...
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';
[INST] Here is a database schema: person : p_id [ INTEGER ] primary_key professor [ INTEGER ] student [ INTEGER ] hasPosition [ TEXT ] inPhase [ TEXT ] yearsInProgram [ TEXT ] advisedBy : p_id [ INTEGER ] advisedBy.p_id = person.p_id p_id_dummy [ INTEGER ] advisedBy.p_id_dummy = person.p_id Please write me a SQL state...
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;
[INST] Here is a database schema: person : p_id [ INTEGER ] primary_key professor [ INTEGER ] student [ INTEGER ] hasPosition [ TEXT ] inPhase [ TEXT ] yearsInProgram [ TEXT ] advisedBy : p_id [ INTEGER ] advisedBy.p_id = person.p_id p_id_dummy [ INTEGER ] advisedBy.p_id_dummy = person.p_id Please write me a SQL state...
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';
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key courseLevel [ TEXT ] taughtBy : course_id [ INTEGER ] taughtBy.course_id = course.course_id p_id [ INTEGER ] taughtBy.p_id = person.p_id Please write me a SQL statement that answers the following question: List the course IDs and levels of pe...
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;
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key courseLevel [ TEXT ] taughtBy : course_id [ INTEGER ] taughtBy.course_id = course.course_id p_id [ INTEGER ] taughtBy.p_id = person.p_id Please write me a SQL statement that answers the following question: Describe the course level and list o...
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;
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key courseLevel [ TEXT ] person : p_id [ INTEGER ] primary_key professor [ INTEGER ] student [ INTEGER ] hasPosition [ TEXT ] inPhase [ TEXT ] yearsInProgram [ TEXT ] taughtBy : course_id [ INTEGER ] taughtBy.course_id = course.course_id p_id [ IN...
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;
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key courseLevel [ TEXT ] person : p_id [ INTEGER ] primary_key professor [ INTEGER ] student [ INTEGER ] hasPosition [ TEXT ] inPhase [ TEXT ] yearsInProgram [ TEXT ] taughtBy : course_id [ INTEGER ] taughtBy.course_id = course.course_id p_id [ IN...
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;
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key courseLevel [ TEXT ] taughtBy : course_id [ INTEGER ] taughtBy.course_id = course.course_id p_id [ INTEGER ] taughtBy.p_id = person.p_id Please write me a SQL statement that answers the following question: List the professor ID who taught the...
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;
[INST] Here is a database schema: person : p_id [ INTEGER ] primary_key professor [ INTEGER ] student [ INTEGER ] hasPosition [ TEXT ] inPhase [ TEXT ] yearsInProgram [ TEXT ] advisedBy : p_id [ INTEGER ] advisedBy.p_id = person.p_id p_id_dummy [ INTEGER ] advisedBy.p_id_dummy = person.p_id Please write me a SQL state...
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';
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key courseLevel [ TEXT ] taughtBy : course_id [ INTEGER ] taughtBy.course_id = course.course_id p_id [ INTEGER ] taughtBy.p_id = person.p_id Please write me a SQL statement that answers the following question: List any five of course IDs with pro...
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;
[INST] Here is a database schema: advisedBy : p_id [ INTEGER ] advisedBy.p_id = person.p_id p_id_dummy [ INTEGER ] advisedBy.p_id_dummy = person.p_id Please write me a SQL statement that answers the following question: How many students are under advisor 415? [/INST] [/INST]
SELECT COUNT(*) FROM advisedBy WHERE p_id_dummy = 415;
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key courseLevel [ TEXT ] Please write me a SQL statement that answers the following question: How many professional or master/graduate courses are there? [/INST] [/INST]
SELECT COUNT(*) FROM course WHERE courseLevel = 'Level_500';
[INST] Here is a database schema: person : p_id [ INTEGER ] primary_key professor [ INTEGER ] student [ INTEGER ] hasPosition [ TEXT ] inPhase [ TEXT ] yearsInProgram [ TEXT ] Please write me a SQL statement that answers the following question: How many non-faculty members are not undergoing the phase of qualification...
SELECT COUNT(*) FROM person WHERE hasPosition = 0 AND inPhase = 0;
[INST] Here is a database schema: taughtBy : course_id [ INTEGER ] taughtBy.course_id = course.course_id p_id [ INTEGER ] taughtBy.p_id = person.p_id Please write me a SQL statement that answers the following question: Which professor taught the least amount of courses? [/INST] [/INST]
SELECT p_id FROM taughtBy GROUP BY p_id ORDER BY COUNT(course_id) ASC LIMIT 1;
[INST] Here is a database schema: person : p_id [ INTEGER ] primary_key professor [ INTEGER ] student [ INTEGER ] hasPosition [ TEXT ] inPhase [ TEXT ] yearsInProgram [ TEXT ] advisedBy : p_id [ INTEGER ] advisedBy.p_id = person.p_id p_id_dummy [ INTEGER ] advisedBy.p_id_dummy = person.p_id Please write me a SQL state...
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';
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key courseLevel [ TEXT ] taughtBy : course_id [ INTEGER ] taughtBy.course_id = course.course_id p_id [ INTEGER ] taughtBy.p_id = person.p_id Please write me a SQL statement that answers the following question: Which professor teaches the highest ...
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;
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key courseLevel [ TEXT ] person : p_id [ INTEGER ] primary_key professor [ INTEGER ] student [ INTEGER ] hasPosition [ TEXT ] inPhase [ TEXT ] yearsInProgram [ TEXT ] taughtBy : course_id [ INTEGER ] taughtBy.course_id = course.course_id p_id [ IN...
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';
[INST] Here is a database schema: course : course_id [ INTEGER ] primary_key courseLevel [ TEXT ] taughtBy : course_id [ INTEGER ] taughtBy.course_id = course.course_id p_id [ INTEGER ] taughtBy.p_id = person.p_id Please write me a SQL statement that answers the following question: Who are the top 5 professors who tea...
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;
[INST] Here is a database schema: person : p_id [ INTEGER ] primary_key professor [ INTEGER ] student [ INTEGER ] hasPosition [ TEXT ] inPhase [ TEXT ] yearsInProgram [ TEXT ] advisedBy : p_id [ INTEGER ] advisedBy.p_id = person.p_id p_id_dummy [ INTEGER ] advisedBy.p_id_dummy = person.p_id Please write me a SQL state...
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;