Chinastark/bird_dataset huggingface dataset:
Database: cs_semester
Note: research assistant refers to the student who serves for research where the abbreviation is ra; taught postgraduate student refers to type = 'TPG'; DIVIDE(COUNT(student_id where type = 'TPG' and first_name = 'Ogdon', last_name = 'Zywicki'), COUNT(first_name = 'Ogdon', last_name = 'Zywicki')) as percentage;
Question: What is the percentage of Professor Ogdon Zywicki's research assistants are taught postgraduate students?
SQL: SELECT cast(sum(CASE WHEN student.type = 'TPG' THEN 1 ELSE 0 END) AS REAL) * 100 / count(ra.student_id) FROM ra INNER JOIN prof ON ra.prof_id = prof.prof_id INNER JOIN student ON ra.student_id = student.student_id WHERE prof.first_name = 'Ogdon' AND prof.last_name = 'Zywicki'
Database: cs_semester
Note: DIVIDE(COUNT(student_id(grade = 'B' and name = 'Computer Network')), COUNT(student_id where name = ' Computer Network')) as percentage;
Question: What is the percentage of students who get a "B" in the course "Computer Network"?
SQL: SELECT cast(sum(CASE WHEN registration.grade = 'B' THEN 1 ELSE 0 END) AS REAL) * 100 / count(registration.student_id) FROM registration INNER JOIN course ON registration.course_id = course.course_id WHERE course.name = 'Computer Network'
Database: cs_semester
Note: diff refers to difficulty; diff is higher means the course is more difficult in which highest difficulty is expessed as diff = 5;
Question: How many courses have the highest difficulty?
SQL: SELECT count(course_id) FROM course WHERE diff = 5
Database: cs_semester
Note: Ivy League school is assembled by 8 universities: Brown University, Columbia University, Cornell University, Dartmouth College, Harvard University, Princeton University, University of Pennsylvania and Yale University;
Question: What is the full name of the professor who graduated from an Ivy League School?
SQL: SELECT first_name, last_name FROM prof WHERE graduate_from IN ( 'Brown University',  'Columbia University',  'Cornell University',  'Dartmouth College',  'Harvard University',  'Princeton University',  'University of Pennsylvania',  'Yale University' )
Database: cs_semester
Note: Higher credit means more important in which most important refers to MAX(credit); diff refers to difficulty; the most difficult course refers to MAX(diff);
Question: Among the most important courses, what is the name of the most difficult course?
SQL: SELECT name FROM course WHERE credit = ( SELECT max(credit) FROM course ) AND diff = ( SELECT max(diff) FROM course )
Database: cs_semester
Note: bachelor's degree is an undergraduate degree in which type = 'UG'; the highest intelligence refers to MAX(intelligence);
Question: How many students have the highest intelligence among those taking a bachelor's degree?
SQL: SELECT count(student_id) FROM student WHERE TYPE = 'UG' AND intelligence = ( SELECT max(intelligence) FROM student )
Database: cs_semester
Note: the most popular professors refers to prof_id where MAX(popularity); female refers to gender;
Question: Among the most popular professors, how many are females?
SQL: SELECT count(prof_id) FROM prof WHERE gender = 'Female' AND popularity = ( SELECT max(popularity) FROM prof )
Database: cs_semester
Note: research postgraduate student refers to type = 'RPG';
Question: How many research postgraduate students are there?
SQL: SELECT count(student_id) FROM student WHERE TYPE = 'RPG'
Database: cs_semester
Note: A refers to an excellent grade in which grade = 'A' for the course;
Question: How many students got an A in Applied Deep Learning?
SQL: SELECT count(registration.student_id) FROM course INNER JOIN registration ON course.course_id = registration.course_id WHERE registration.grade = 'A' AND course.name = 'Applied Deep Learning '
Database: cs_semester
Note: Unpaid Research Assistants undertake their work without payment in which salary = 'free';
Question: What are the GPAs of the unpaid Research Assistants?
SQL: SELECT student.gpa FROM ra INNER JOIN student ON ra.student_id = student.student_id WHERE ra.salary = 'free'
Database: cs_semester
Note: diff refers to difficulty; the easiest courses refers to diff = 1; A refers to an excellent grade in which grade = 'A' for the course;
Question: Among the easiest courses, what is the name of the course where most students got an A?
SQL: SELECT course.name FROM registration INNER JOIN course ON registration.course_id = course.course_id WHERE registration.grade = 'A' AND course.diff = 1 GROUP BY course.name ORDER BY count(registration.student_id) DESC LIMIT 1
Database: cs_semester
Note: student with the highest gpa refers to student_id where MAX(gpa);
Question: How many courses does the student with the highest GPA this semester take?
SQL: SELECT count(course_id) FROM registration WHERE student_id IN ( SELECT student_id FROM student WHERE gpa = ( SELECT max(gpa) FROM student ) )
Database: cs_semester
Note: Ogdon Zywicki is a professor;
Question: How many students does Ogdon Zywicki advise?
SQL: SELECT count(ra.student_id) FROM ra INNER JOIN prof ON ra.prof_id = prof.prof_id WHERE prof.first_name = 'Ogdon' AND prof.last_name = 'Zywicki'
Database: cs_semester
Note: sat refers to student's satisfaction degree with the course where sat = 5 stands for the highest satisfaction;
Question: What is the name of the course with the highest satisfaction from students?
SQL: SELECT DISTINCT course.name FROM registration INNER JOIN course ON registration.course_id = course.course_id WHERE registration.sat = 5
Database: cs_semester
Note: lower intelligence refers to intelligence = 1; sat refers to student's satisfaction degree with the course where least satisfaction refers to sat = 1;
Question: What are the names of the courses that the students with the lowest intelligence are least satisfied with?
SQL: SELECT course.name FROM student INNER JOIN registration ON student.student_id = registration.student_id INNER JOIN course ON registration.course_id = course.course_id WHERE registration.sat = 1 AND student.intelligence = 1
Database: cs_semester
Note: A refers to an excellent grade in which grade = 'A';
Question: Which of the two courses, "Advanced Operating System" or "Intro to BlockChain', did most of the students receive an A in?
SQL: SELECT course.name FROM registration INNER JOIN course ON registration.course_id = course.course_id WHERE registration.grade = 'A' AND course.name IN ('Advanced Operating System', 'Intro to BlockChain') GROUP BY course.name ORDER BY count(registration.student_id) DESC LIMIT 1
Database: cs_semester
Note: professor with the highest research ability refers to prof_id where MAX(capability);
Question: What is the popularity of the professor who advises the highest number of students with the highest research ability?
SQL: SELECT prof.popularity FROM ra INNER JOIN prof ON ra.prof_id = prof.prof_id GROUP BY ra.prof_id, ra.capability ORDER BY count(ra.student_id) DESC, ra.capability DESC LIMIT 1
Database: cs_semester
Note: diff refers to difficulty; DIVIDE(COUNT(student_id where diff = 4), COUNT(course_id where diff = 4));
Question: What is the average number of students who registered for the courses with a difficulty of 4?
SQL: SELECT cast(count(registration.student_id) AS REAL) / count(DISTINCT course.course_id) FROM registration INNER JOIN course ON registration.course_id = course.course_id WHERE course.diff = 4
Database: cs_semester
Note: gpa is an abbreviated name of grade Point Average where gpa between 3 to 4 refers to gpa BETWEEN 3 AND 4; If grade is null or empty, it means that this student fails to pass this course;
Question: How many students, who have a GPA between 3 to 4, failed a course?
SQL: SELECT count(registration.student_id) FROM student INNER JOIN registration ON student.student_id = registration.student_id WHERE registration.grade IS NULL AND student.gpa BETWEEN 3 AND 4
Database: cs_semester
Note: bachelor's degree is an undergraduate degree in which type = 'UG'; A refers to an excellent grade in which grade = 'A';
Question: How many students taking a bachelor's degree received an A in all of the courses that they took?
SQL: SELECT count(registration.student_id) FROM student INNER JOIN registration ON student.student_id = registration.student_id WHERE registration.grade = 'A' AND student.type = 'UG'
Database: cs_semester
Note: the highest research capability refers to capability = 5; high salary refers to salary = 'high'; prof_id refers to professor’s ID; gpa is an abbreviated name of grade Point Average where average gpa refers to AVG(gpa);
Question: What is the average GPA of the students with the highest research capability and high salary? List the full names of the students.
SQL: SELECT avg(student.gpa), student.f_name, student.l_name FROM ra INNER JOIN student ON ra.student_id = student.student_id WHERE ra.salary = 'high' AND ra.capability = 5 GROUP BY student.student_id
Database: cs_semester
Note: the lowest research ability refers to MIN(capability); professor’s ID refers to prof_id;
Question: List the professors' IDs and students' IDs with the lowest research ability.
SQL: SELECT prof_id, student_id FROM ra WHERE capability = ( SELECT min(capability) FROM ra )
Database: cs_semester
Note: name the professor refers to full name which includes f_name and l_name;
Question: Name the professor who got graduation from the University of Boston.
SQL: SELECT first_name, last_name FROM prof WHERE graduate_from = 'University of Boston'
Database: cs_semester
Note: If grade is null or empty, it means that this student fails to pass the course;
Question: List the courses' IDs and students' IDs who failed to pass the course.
SQL: SELECT course_id, student_id FROM registration WHERE grade IS NULL OR grade = ''
Database: cs_semester
Note: DIVIDE(COUNT(prof_id where gender = 'Male'), COUNT(prof_id where gender = 'Female'));
Question: What is the male and female ratio among the professors?
SQL: SELECT cast(sum(CASE WHEN gender = 'Male' THEN 1 ELSE 0 END) AS REAL) / sum(CASE WHEN gender = 'Female' THEN 1 ELSE 0 END) FROM prof
Database: cs_semester
Note: diff refers to difficulty; the least difficult courses refer to MIN(diff);
Question: Describe the names and credits of the least difficult courses.
SQL: SELECT name, credit FROM course WHERE diff = ( SELECT min(diff) FROM course )
Database: cs_semester
Note: student's full names = f_name, l_name; most popular refers to MAX(popularity);
Question: Describe the students' full names and GPAs under the supervision of the most popular professor.
SQL: SELECT student.f_name, student.l_name, student.gpa FROM prof INNER JOIN ra ON prof.prof_id = ra.prof_id INNER JOIN student ON ra.student_id = student.student_id ORDER BY prof.popularity DESC LIMIT 1
Database: cs_semester
Note: full names = f_name, l_name; research assistant refers to the student who serves for research where the abbreviation is ra; unpaid research assistant refers to salary = 'free';
Question: Provide the full names and emails of unpaid research assistants.
SQL: SELECT student.f_name, student.l_name, student.email FROM ra INNER JOIN student ON ra.student_id = student.student_id WHERE ra.salary = 'free'
Database: cs_semester
Note: research assistant refers to the student who serves for research where the abbreviation is ra; full names = f_name, l_name;
Question: List the research assistants' full names, capabilities and GPAs who were under the supervision of Merwyn Conkay.
SQL: SELECT student.f_name, student.l_name, ra.capability, student.gpa FROM prof INNER JOIN ra ON prof.prof_id = ra.prof_id INNER JOIN student ON ra.student_id = student.student_id WHERE prof.first_name = 'Merwyn' AND prof.last_name = 'Conkay'
Database: cs_semester
Note: student's full names = f_name, l_name;
Question: Describe the students' full names and grades in Intro to BlockChain course.
SQL: SELECT student.f_name, student.l_name, registration.grade FROM student INNER JOIN registration ON student.student_id = registration.student_id INNER JOIN course ON registration.course_id = course.course_id WHERE course.name = 'Intro to BlockChain'
Database: cs_semester
Note: difficulty refers to diff; most difficult course refers to MAX(diff); student's full names = f_name, l_name;
Question: Among students registered for the most difficult course, list the students' full names who got grade A.
SQL: SELECT student.f_name, student.l_name FROM student INNER JOIN registration ON student.student_id = registration.student_id INNER JOIN course ON registration.course_id = course.course_id WHERE registration.grade = 'A' ORDER BY course.diff DESC LIMIT 1
Database: cs_semester
Note: full names of the professors = first_name, last_name; graduated universities of the professors refers to graduate_from;
Question: Describe the full names and graduated universities of the professors who advised Olia Rabier.
SQL: SELECT prof.first_name, prof.last_name, prof.graduate_from FROM prof INNER JOIN ra ON prof.prof_id = ra.prof_id INNER JOIN student ON ra.student_id = student.student_id WHERE student.f_name = 'Olia' AND student.l_name = 'Rabier'
Database: cs_semester
Note: full the students = f_name, l_name; course refers to name; satisfaction refers to sat; highest satisfaction refers to MAX(sat);
Question: Name the students of the Advanced Database Systems course with the highest satisfaction.
SQL: SELECT student.f_name, student.l_name FROM student INNER JOIN registration ON student.student_id = registration.student_id INNER JOIN course ON registration.course_id = course.course_id WHERE course.name = 'Advanced Database Systems' ORDER BY registration.sat DESC LIMIT 1
Database: cs_semester
Note: gpa of the semester = DIVIDE(SUM(MULTIPLY(credit, grade)), SUM(credit)); grade 'A' refers to gpa = 4; grade 'B' refers to gpa = 3; grade 'C' refers to gpa = 2; grade 'D' refers to gpa = 1;
Question: Calculate the GPA of the semester for Laughton Antonio.
SQL: SELECT cast(sum(course.credit * CASE registration.grade WHEN 'A' THEN 4 WHEN 'B' THEN 3 WHEN 'C' THEN 2 WHEN 'D' THEN 1 ELSE 1 END) AS REAL) / count(course.credit) FROM registration INNER JOIN student ON registration.student_id = student.student_id INNER JOIN course ON registration.course_id = course.course_id WHERE student.f_name = 'Laughton' AND student.l_name = 'Antonio'
Database: cs_semester
Note: Undergraduate students refers to type = 'UG'; gpa of 3.7 and above refers to gpa > 3.7;
Question: Provide the registered courses' names by undergraduate students with GPA of 3.7 and above.
SQL: SELECT DISTINCT student.f_name FROM student INNER JOIN registration ON student.student_id = registration.student_id INNER JOIN course ON registration.course_id = course.course_id WHERE student.type = 'UG' AND student.gpa > 3.7
Database: cs_semester
Note: names of the students = f_name, l_name;
Question: Describe the names and capability of the students who were advised by professors from the University of Washington.
SQL: SELECT student.f_name, student.l_name, ra.capability FROM prof INNER JOIN ra ON prof.prof_id = ra.prof_id INNER JOIN student ON ra.student_id = student.student_id WHERE prof.graduate_from = 'University of Washington'
Database: cs_semester
Note: full names of the students = f_name; l_name; highest capability refers to MAX(capability); highest salary refers to salary = 'high';
Question: Describe the full names, emails and intelligence of the students with the highest capability and salary.
SQL: SELECT f_name, l_name, email, intelligence FROM student WHERE student_id IN ( SELECT student_id FROM ra WHERE salary = 'high' AND capability = ( SELECT max(capability) FROM ra ) )
Database: cs_semester
Note: female refers to gender = 'Female'; highest teaching ability refers to MAX(teachingability);
Question: Mention the names and credits of course registered by the students who were under the supervision of female professor with the highest teaching ability.
SQL: SELECT course.name, course.credit FROM ra INNER JOIN prof ON ra.prof_id = prof.prof_id INNER JOIN student ON ra.student_id = student.student_id INNER JOIN registration ON student.student_id = registration.student_id INNER JOIN course ON registration.course_id = course.course_id WHERE prof.gender = 'Female' ORDER BY prof.teachingability DESC LIMIT 1
Database: cs_semester
Note: female refers to gender = 'Female';
Question: How many of the professors are female?
SQL: SELECT count(prof_id) FROM prof WHERE gender = 'Female'
Database: cs_semester
Note: difficulty of a course refers to diff; most difficult course refers to MAX(diff);
Question: What is the name of the most difficult course?
SQL: SELECT name FROM course WHERE diff = ( SELECT max(diff) FROM course )
Database: cs_semester
Note: gpa of 3.1 to 3.7 refers to gpa BETWEEN 3.1 AND 3.7; undergraduate students refers to type = 'UG';
Question: Among the students with a gpa of 3.1 to 3.7, how many of them are undergraduate students?
SQL: SELECT count(student_id) FROM student WHERE gpa BETWEEN 3.1 AND 3.7 AND TYPE = 'UG'
Database: cs_semester
Question: What is the credit of the course named "Computer Vision"?
SQL: SELECT credit FROM course WHERE name = 'Computer Vision'
Database: cs_semester
Question: Give the student's ID of students with 2.5 GPA and enrolled in C for Programmers.
SQL: SELECT registration.student_id FROM student INNER JOIN registration ON student.student_id = registration.student_id INNER JOIN course ON registration.course_id = course.course_id WHERE course.name = 'C for Programmers' AND student.gpa = 2.5
Database: cs_semester
Note: student's last name refers to l_name; satisfaction refers to sat; highest satisfaction refers to MAX(sat);
Question: Give the student's last name that gave the highest student satisfaction for the course "Intro to Database 2".
SQL: SELECT student.l_name FROM student INNER JOIN registration ON student.student_id = registration.student_id INNER JOIN course ON registration.course_id = course.course_id WHERE course.name = 'Intro to Database 2' ORDER BY registration.sat DESC LIMIT 1
Database: cs_semester
Note: high salary refers to salary = 'high'; gpa higher than 3 refers to gpa > 3;
Question: Among the students with high salary, what is total number of students with a GPA higher than 3?
SQL: SELECT count(ra.student_id) FROM ra INNER JOIN student ON ra.student_id = student.student_id WHERE ra.salary = 'high' AND student.gpa > 3
Database: cs_semester
Note: Undergraduate students refers to type = 'UG'; satisfaction refers to sat; highest satisfaction refers to MAX(sat);
Question: Among undergraduate students, list the name of the course with the highest student satisfaction.
SQL: SELECT course.name FROM student INNER JOIN registration ON student.student_id = registration.student_id INNER JOIN course ON registration.course_id = course.course_id WHERE student.type = 'UG' ORDER BY registration.sat DESC LIMIT 1
Database: cs_semester
Note: research postgraduate students refers to type = 'RPG'; intelligence level of 4 and above refers to intelligence >= 4;
Question: List the capability of research postgraduate students with an intellegence level of 4 and above.
SQL: SELECT ra.capability FROM ra INNER JOIN student ON ra.student_id = student.student_id WHERE student.type = 'RPG' AND student.intelligence >= 4
Database: cs_semester
Question: In students with a grade of B, how many of them have an intellegence level of 3?
SQL: SELECT count(registration.student_id) FROM registration INNER JOIN student ON registration.student_id = student.student_id WHERE registration.grade = 'B' AND student.intelligence = 3
Database: cs_semester
Note: difficulty of the course refers to diff;
Question: What is the difficulty of the course in which a student with level of intellengence of 5 got an A grade?
SQL: SELECT course.diff FROM student INNER JOIN registration ON student.student_id = registration.student_id INNER JOIN course ON registration.course_id = course.course_id WHERE registration.grade = 'A' AND student.intelligence = 5
Database: cs_semester
Note: highest popularity refers to MAX(popularity); research capability refers to capability; capability = 5;
Question: Among professors with the highest popularity, how many of their students have research capability of 5?
SQL: SELECT count(ra.student_id) FROM ra INNER JOIN prof ON ra.prof_id = prof.prof_id WHERE ra.capability = 5 ORDER BY prof.popularity DESC LIMIT 1
Database: cs_semester
Question: List the course's name where students acquired a grade of D.
SQL: SELECT course.name FROM course INNER JOIN registration ON course.course_id = registration.course_id WHERE registration.grade = 'D'
Database: cs_semester
Note: capability on research refers to capability;
Question: What is the capability on research of the student named Alvera McQuillin?
SQL: SELECT ra.capability FROM student INNER JOIN ra ON student.student_id = ra.student_id WHERE student.f_name = 'Alvera' AND student.l_name = 'McQuillin'
Database: cs_semester
Question: Of courses with 3 credit, how many students have GPA of 3.2?
SQL: SELECT count(student.student_id) FROM student INNER JOIN registration ON student.student_id = registration.student_id INNER JOIN course ON registration.course_id = course.course_id WHERE course.credit = 3 AND student.gpa = 3.2
Database: cs_semester
Note: low salary refers to salary = 'low';
Question: Among students with low salary, how many of them have a gpa of 3.5?
SQL: SELECT count(ra.student_id) FROM ra INNER JOIN student ON ra.student_id = student.student_id WHERE student.gpa = 3.5 AND ra.salary = 'low'
Database: cs_semester
Note: difficulty refers to diff; course with difficulty greater than the 80% of average difficulty refers to diff > MULTIPLY(AVG(diff), 80%);
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.
SQL: SELECT student.email FROM registration INNER JOIN student ON registration.student_id = student.student_id INNER JOIN course ON registration.course_id = course.course_id WHERE registration.grade = 'B' GROUP BY course.diff HAVING course.diff > avg(course.diff) * 0.8
Database: cs_semester
Note: teachability <= 3; percentage = MULTIPLY(DIVIDE(COUNT(salary = 'low'), COUNT(salary)), 1.0);
Question: Among the professors with a teachability of 3 and below, what is the percentage of their student advisees with a low salary?
SQL: SELECT cast(sum(CASE WHEN ra.salary = 'low' THEN 1 ELSE 0 END) AS REAL) * 100 / count(ra.salary) FROM ra INNER JOIN prof ON ra.prof_id = prof.prof_id WHERE prof.teachingability < 3
Database: cs_semester
Note: most important refers to MAX(credit); most difficult refers to MAX(diff);
Question: Find the most important and most difficult courses.
SQL: SELECT name FROM course WHERE credit = ( SELECT max(credit) FROM course ) AND diff = ( SELECT max(diff) FROM course )
Database: cs_semester
Note: average = AVG(teachingability); most popular professor refers to MAX(popularity);
Question: What is the average teaching ability of the most popular professors?
SQL: SELECT cast(sum(teachingability) AS REAL) / count(prof_id) FROM prof WHERE popularity = ( SELECT max(popularity) FROM prof )
Database: cs_semester
Note: average satisfaction = DIVIDE(SUM(sat), COUNT(course_id)); satisfaction refers to sat; good student refers to grade = 'B';
Question: Calculate the average satisfaction of the good students with their courses.
SQL: SELECT cast(sum(sat) AS REAL) / count(course_id) FROM registration WHERE grade = 'B'
Database: cs_semester
Note: intelligence < 4; full name = f_name, l_name; gpa > 3;
Question: Among the students with less than four intelligence, list the full name and phone number of students with a greater than 3 GPA.
SQL: SELECT f_name, l_name, phone_number FROM student WHERE gpa > 3 AND intelligence < 4
Database: cs_semester
Note: name of the students = f_name, l_name; above average-capability refers to capability > AVG(capability);
Question: Name the students with above-average capability.
SQL: SELECT student.f_name, student.l_name FROM student INNER JOIN ra ON student.student_id = ra.student_id WHERE ra.capability > ( SELECT avg(capability) FROM ra )