Chinastark/bird_dataset huggingface dataset:
Database: social_media
Question: From which city were more tweets posted, Bangkok or Chiang Mai?
Evidence: "Bangkok" and "Chiang Mai" are both City
SQL: SELECT SUM(CASE WHEN T2.City = 'Bangkok' THEN 1 ELSE 0 END) AS bNum , SUM(CASE WHEN T2.City = 'Chiang Mai' THEN 1 ELSE 0 END) AS cNum FROM twitter AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE T2.City IN ('Bangkok', 'Chiang Mai')
Database: social_media
Question: Among the tweets posted from Santa Fe state in Argentina, how many of them were posted on 31st?
Evidence: "Sante Fe" is the State; "Argentina" is the Country; posted on 31st refers to Day = 31
SQL: SELECT COUNT(T1.TweetID) FROM twitter AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE T1.Day = 31 AND T2.State = 'Santa' AND T2.Country = 'Argentina'
Database: social_media
Question: Please list the top 3 cities with the most number of tweets posted in Canada.
Evidence: "Canada" is the Country; city with most number of tweets refers to City where Max(Count(TweetID))
SQL: SELECT T.City FROM ( SELECT T2.City, COUNT(T1.TweetID) AS num FROM twitter AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE T2.Country = 'Canada' GROUP BY T2.City ) T ORDER BY T.num DESC LIMIT 3
Database: social_media
Question: Please list all the cities from where tweets with neutral sentiments were posted.
Evidence: neutral sentiment refers to Sentiment = 0
SQL: SELECT DISTINCT T2.City FROM twitter AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE Sentiment = 0
Database: social_media
Question: Among all the tweets sent by male users in Argentina, what is the text of the one with the most number of likes?
Evidence: male user refers to Gender = 'Male'; 'Argentina' is the Country; most number of likes refers to Max(Likes)
SQL: SELECT T2.text FROM user AS T1 INNER JOIN twitter AS T2 ON T1.UserID = T2.UserID INNER JOIN location AS T3 ON T2.LocationID = T3.LocationID WHERE T3.Country = 'Argentina' AND T1.Gender = 'Male' ORDER BY T2.Likes DESC LIMIT 1
Database: social_media
Question: What is the average number of likes for a tweet posted by a male user on Mondays?
Evidence: male user refers to Gender = 'Male'; 'Monday' is the Weekday; average number of likes = Divide (Sum(Likes), Count(TweetID))
SQL: SELECT SUM(T1.Likes) / COUNT(T1.TweetID) FROM twitter AS T1 INNER JOIN user AS T2 ON T1.UserID = T2.UserID WHERE T2.Gender = 'Male' AND T1.Weekday = 'Monday'
Database: social_media
Question: Tweets posted from which city has a higher number of average likes, Bangkok or Chiang Mai?
Evidence: "Bangkok" and "Chiang Mai" are both City; average number of like = Divide (Sum(Likes), Count(TweetID))
SQL: SELECT SUM(CASE WHEN T2.City = 'Bangkok' THEN Likes ELSE NULL END) / COUNT(CASE WHEN T2.City = 'Bangkok' THEN 1 ELSE 0 END) AS bNum , SUM(CASE WHEN City = 'Chiang Mai' THEN Likes ELSE NULL END) / COUNT(CASE WHEN City = 'Chiang Mai' THEN TweetID ELSE NULL END) AS cNum FROM twitter AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE T2.City IN ('Bangkok', 'Chiang Mai')
Database: cs_semester
Question: Which course is more difficult, Intro to BlockChain or Computer Network?
Evidence: diff refers to difficulty; diff is higher means the course is more difficult;
SQL: SELECT name FROM course WHERE name = 'Intro to BlockChain' OR name = 'Computer Network' ORDER BY diff DESC LIMIT 1
Database: cs_semester
Question: Please list the names of the courses that are less important than Machine Learning Theory.
Evidence: lower credit means less important;
SQL: SELECT name FROM course WHERE credit < ( SELECT credit FROM course WHERE name = 'Machine Learning Theory' )
Database: cs_semester
Question: How many professors are more popular than Zhou Zhihua?
Evidence: higher popularity means the professor is more popular;
SQL: SELECT COUNT(prof_id) FROM prof WHERE popularity > ( SELECT popularity FROM prof WHERE first_name = 'Zhihua' AND last_name = 'Zhou' )
Database: cs_semester
Question: Which professor advised Faina Mallinar to become a research assistant? Please give his or her full name.
Evidence: research assistant refers to the student who serves for research where the abbreviation is RA; full name refers to f_name and l_name;
SQL: SELECT T1.first_name, T1.last_name FROM prof AS T1 INNER JOIN RA AS T2 ON T1.prof_id = T2.prof_id INNER JOIN student AS T3 ON T2.student_id = T3.student_id WHERE T3.f_name = 'Faina' AND T3.l_name = 'Mallinar'
Database: cs_semester
Question: How many research assistants does Sauveur Skyme have?
Evidence: research assistant refers to the student who serves for research where the abbreviation is RA;
SQL: SELECT COUNT(T1.student_id) FROM RA AS T1 INNER JOIN prof AS T2 ON T1.prof_id = T2.prof_id WHERE T2.first_name = 'Sauveur' AND T2.last_name = 'Skyme'
Database: cs_semester
Question: Please list the full names of all the students who are research assistants with the highest research capability.
Evidence: research assistant refers to the student who serves for research where the abbreviation is RA; the highest research capability refers to capability = 5; full name refers to f_name and l_name;
SQL: SELECT T1.f_name, T1.l_name FROM student AS T1 INNER JOIN RA AS T2 ON T1.student_id = T2.student_id WHERE T2.capability = 5
Database: cs_semester
Question: How many research assistants of Ogdon Zywicki have an average salary?
Evidence: research assistant refers to the student who serves for research where the abbreviation is RA; average salary refers to salary = 'med';
SQL: SELECT COUNT(T1.prof_id) FROM RA AS T1 INNER JOIN prof AS T2 ON T1.prof_id = T2.prof_id WHERE T2.first_name = 'Ogdon' AND T1.salary = 'med' AND T2.last_name = 'Zywicki'
Database: cs_semester
Question: Please list the full names of all the students who took the course Machine Learning Theory.
Evidence: full name refers to f_name and l_name;
SQL: SELECT T1.f_name, T1.l_name FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T3.name = 'Machine Learning Theory'
Database: cs_semester
Question: Among the students who got a B in the course Machine Learning Theory, how many of them have a gpa of over 3?
Evidence: B refers to grade; GPA is an abbreviated name of Grade Point Average where over 3 refers to gpa > 3;
SQL: SELECT COUNT(student_id) FROM registration WHERE grade = 'B' AND student_id IN ( SELECT student_id FROM student WHERE gpa > 3 AND course_id IN ( SELECT course_id FROM course WHERE name = 'Machine Learning Theory' ) )
Database: cs_semester
Question: Please list the names of the courses taken by Laughton Antonio.
SQL: SELECT T3.name FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T1.f_name = 'Laughton' AND T1.l_name = 'Antonio'
Database: cs_semester
Question: Which student failed the course Intro to Database 2? Please give his or her full name.
Evidence: If grade is NULL, it means that this student fails to pass the course; full name refers to f_name and l_name;
SQL: SELECT T1.f_name, T1.l_name FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T2.grade IS NULL AND T3.name = 'Intro to Database 2'
Database: cs_semester
Question: Which student is more satisfied with the course Machine Learning Theory, Willie Rechert or Laughton Antonio?
Evidence: sat refers to student's satisfaction degree with the course; more satisfied refers to MAX(sat);
SQL: SELECT T1.f_name, T1.l_name FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE (T1.f_name = 'Laughton' OR T1.f_name = 'Willie') AND (T1.l_name = 'Antonio' OR T1.l_name = 'Rechert') AND T3.name = 'Machine Learning Theory' ORDER BY T2.sat DESC LIMIT 1
Database: cs_semester
Question: Among the professors who have more than 3 research assistants, how many of them are male?
Evidence: research assistant refers to the student who serves for research where the abbreviation is RA; more than 3 research assistant refers to COUNT(student_id) > 3;
SQL: SELECT COUNT(*) FROM ( SELECT T2.prof_id FROM RA AS T1 INNER JOIN prof AS T2 ON T1.prof_id = T2.prof_id WHERE T2.gender = 'Male' GROUP BY T1.prof_id HAVING COUNT(T1.student_id) > 3 )
Database: cs_semester
Question: Among the students who took the course Machine Learning Theory, how many of them are undergraduates?
Evidence: UG is an abbreviated name of undergraduate student in which type = 'UG';
SQL: SELECT COUNT(T1.student_id) FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T3.name = 'Machine Learning Theory' AND T1.type = 'UG'
Database: cs_semester
Question: Which professor advised Willie Rechert to work as a research assistant? Please give his or her full name.
Evidence: research assistant refers to the student who serves for research where the abbreviation is RA; prof_id refers to professor’s ID; full name refers to f_name and l_name;
SQL: SELECT T1.first_name, T1.last_name FROM prof AS T1 INNER JOIN RA AS T2 ON T1.prof_id = T2.prof_id INNER JOIN student AS T3 ON T2.student_id = T3.student_id WHERE T3.f_name = 'Willie' AND T3.l_name = 'Rechert'
Database: cs_semester
Question: What is the average gpa of Ogdon Zywicki's research assistants?
Evidence: research assistant refers to the student who serves for research where the abbreviation is RA; prof_id refers to professor’s ID; GPA is an abbreviated name of Grade Point Average where average = AVG(gpa);
SQL: SELECT SUM(T3.gpa) / COUNT(T1.student_id) FROM RA AS T1 INNER JOIN prof AS T2 ON T1.prof_id = T2.prof_id INNER JOIN student AS T3 ON T1.student_id = T3.student_id WHERE T2.first_name = 'Ogdon' AND T2.last_name = 'Zywicki'
Database: cs_semester
Question: What is the average satisfying degree of the course Machine Learning Theory?
Evidence: sat refers to student's satisfaction degree with the course;
SQL: SELECT CAST(SUM(T1.sat) AS REAL) / COUNT(T1.student_id) FROM registration AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T2.name = 'Machine Learning Theory'
Database: cs_semester
Question: Give the number of research postgraduate students.
Evidence: RPG is an abbreviated name of research postgraduate student in which type = 'RPG';
SQL: SELECT COUNT(student_id) FROM student WHERE type = 'RPG'
Database: cs_semester
Question: Which student has the highest gpa? Give the full name.
Evidence: GPA is an abbreviated name of Grade Point Average where highest GPA = MAX(gpa); full name refers to f_name and l_name;
SQL: SELECT f_name, l_name FROM student WHERE gpa = ( SELECT MAX(gpa) FROM student )
Database: cs_semester
Question: For the 3-credit course with the easiest difficulty, how many students get an "A" in that course?
Evidence: diff refers to difficulty; diff is higher means the course is more difficult in which easiest difficulty refers to diff = 1; 3-credit course refers to credit = '3'; get an "A" refers to grade = 'A' for the course;
SQL: SELECT COUNT(T1.student_id) FROM registration AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T1.grade = 'A' AND T2.credit = '3' AND T2.diff = 1
Database: cs_semester
Question: How many students took the hardest course?
Evidence: diff refers to difficulty; diff is higher means the course is more difficult in which hardest difficulty is expressed as diff = 5;
SQL: SELECT COUNT(T1.student_id) FROM registration AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T2.diff = 5
Database: cs_semester
Question: Which professor is Oliy Spratling working with? Give the full name.
Evidence: research assistant refers to the student who serves for research where the abbreviation is RA; full name refers to f_name and l_name;
SQL: SELECT T1.first_name, T1.last_name FROM prof AS T1 INNER JOIN RA AS T2 ON T1.prof_id = T2.prof_id INNER JOIN student AS T3 ON T2.student_id = T3.student_id WHERE T3.f_name = 'Oliy' AND T3.l_name = 'Spratling'
Database: cs_semester
Question: For the professor who is working with Harrietta Lydford, how is his popularity?
Evidence: research assistant refers to the student who serves for research where the abbreviation is RA; higher popularity means more popular; prof_id refers to professor’s ID;
SQL: SELECT T1.popularity 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.f_name = 'Harrietta' AND T3.l_name = 'Lydford'
Database: cs_semester
Question: How many research assistants does the female professor with the lowest teaching ability have?
Evidence: research assistant refers to the student who serves for research where the abbreviation is RA; professor with the lowest teaching ability refers to prof_id where teachability = '1';
SQL: SELECT COUNT(T1.student_id) FROM RA AS T1 INNER JOIN prof AS T2 ON T1.prof_id = T2.prof_id WHERE T2.teachingability = '1' AND T2.gender = 'Female'
Database: cs_semester
Question: For the professors who advise more than 2 students, which professor has a higher teaching ability? Give the full name.
Evidence: professor advising more than 2 students refers to COUNT(student_id) > 2; higher teachability refers to MAX(teachingability); full name refers to f_name and l_name;
SQL: SELECT T.first_name, T.last_name FROM ( SELECT T2.first_name, T2.last_name, T2.teachingability FROM RA AS T1 INNER JOIN prof AS T2 ON T1.prof_id = T2.prof_id GROUP BY T1.prof_id HAVING COUNT(student_id) > 2 ) T ORDER BY T.teachingability DESC LIMIT 1
Database: cs_semester
Question: Give the grade score for Rik Unsworth in "Computer Network".
Evidence: Academic grades awarded for participation in a course are A, B, C, D and F where Grade 'A' means excellent, Grade 'B' means good, Grade 'C' means fair, Grade 'D' means poorly pass, if grade is null or empty, it means that this student fails to pass this course in which grade = NULL;
SQL: SELECT CASE grade WHEN 'A' THEN 4 WHEN 'B' THEN 3 WHEN 'C' THEN 2 ELSE 1 END AS result FROM registration WHERE student_id IN ( SELECT student_id FROM student WHERE f_name = 'Rik' AND l_name = 'Unsworth' AND course_id IN ( SELECT course_id FROM course WHERE name = 'Computer Network' ) )
Database: cs_semester
Question: How many courses does Alvera McQuillin take?
SQL: SELECT COUNT(T1.course_id) FROM registration AS T1 INNER JOIN student AS T2 ON T1.student_id = T2.student_id WHERE T2.f_name = 'Alvera' AND T2.l_name = 'McQuillin'
Database: cs_semester
Question: State the name of research postgraduate student among Professor Zhihua Zhou's research assistants.
Evidence: research postgraduate student refers to type = 'RPG'; research assistant refers to the student who serves for research where the abbreviation is RA;
SQL: SELECT T3.f_name, T3.l_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 T1.first_name = 'Zhihua' AND T3.type = 'RPG' AND T1.last_name = 'Zhou'
Database: cs_semester
Question: Provide the number of students enrolled in the "Statistical Learning" course.
SQL: SELECT COUNT(T2.student_id) FROM course AS T1 INNER JOIN registration AS T2 ON T1.course_id = T2.course_id WHERE T1.name = 'Statistical learning'
Database: cs_semester
Question: Who were the students who failed the course "Applied Deep Learning"? Give the full name.
Evidence: If grade is null or empty, it means that this student fails to pass the course in which grade = NULL;
SQL: SELECT T1.f_name, T1.l_name FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T3.name = 'Applied Deep Learning ' AND T2.grade IS NULL
Database: cs_semester
Question: Give the phone number of the only student who obtained "A" in the course "Intro to BlockChain".
Evidence: A refers to an excellent grade in which grade = 'A' for the course;
SQL: SELECT T1.phone_number 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 BlockChain' AND T2.grade = 'A'
Database: cs_semester
Question: What is the percentage of Professor Ogdon Zywicki's research assistants are taught postgraduate students?
Evidence: 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;
SQL: SELECT CAST(SUM(CASE WHEN T3.type = 'TPG' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.student_id) FROM RA AS T1 INNER JOIN prof AS T2 ON T1.prof_id = T2.prof_id INNER JOIN student AS T3 ON T1.student_id = T3.student_id WHERE T2.first_name = 'Ogdon' AND T2.last_name = 'Zywicki'
Database: cs_semester
Question: What is the percentage of students who get a "B" in the course "Computer Network"?
Evidence: DIVIDE(COUNT(student_id(grade = 'B' and name = 'Computer Network')), COUNT(student_id where name = ' Computer Network')) as percentage;
SQL: SELECT CAST(SUM(CASE WHEN T1.grade = 'B' THEN 1 ELSE 0 END) 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 = 'Computer Network'
Database: cs_semester
Question: How many courses have the highest difficulty?
Evidence: diff refers to difficulty; diff is higher means the course is more difficult in which highest difficulty is expessed as diff = 5;
SQL: SELECT COUNT(course_id) FROM course WHERE diff = 5
Database: cs_semester
Question: What is the full name of the professor who graduated from an Ivy League School?
Evidence: 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;
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
Question: Among the most important courses, what is the name of the most difficult course?
Evidence: 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);
SQL: SELECT name FROM course WHERE credit = ( SELECT MAX(credit) FROM course ) AND diff = ( SELECT MAX(diff) FROM course )
Database: cs_semester
Question: How many students have the highest intelligence among those taking a bachelor's degree?
Evidence: bachelor's degree is an undergraduate degree in which type = 'UG'; the highest intelligence refers to MAX(intelligence);
SQL: SELECT COUNT(student_id) FROM student WHERE type = 'UG' AND intelligence = ( SELECT MAX(intelligence) FROM student )
Database: cs_semester
Question: Among the most popular professors, how many are females?
Evidence: the most popular professors refers to prof_id where MAX(popularity); female refers to gender;
SQL: SELECT COUNT(prof_id) FROM prof WHERE gender = 'Female' AND popularity = ( SELECT MAX(popularity) FROM prof )
Database: cs_semester
Question: How many research postgraduate students are there?
Evidence: research postgraduate student refers to type = 'RPG';
SQL: SELECT COUNT(student_id) FROM student WHERE type = 'RPG'
Database: cs_semester
Question: How many students got an A in Applied Deep Learning?
Evidence: A refers to an excellent grade in which grade = 'A' for the course;
SQL: SELECT COUNT(T2.student_id) FROM course AS T1 INNER JOIN registration AS T2 ON T1.course_id = T2.course_id WHERE T2.grade = 'A' AND T1.name = 'Applied Deep Learning '
Database: cs_semester
Question: What are the GPAs of the unpaid Research Assistants?
Evidence: Unpaid Research Assistants undertake their work without payment in which salary = 'free';
SQL: SELECT T2.gpa FROM RA AS T1 INNER JOIN student AS T2 ON T1.student_id = T2.student_id WHERE T1.salary = 'free'
Database: cs_semester
Question: Among the easiest courses, what is the name of the course where most students got an A?
Evidence: diff refers to difficulty; the easiest courses refers to diff = 1; A refers to an excellent grade in which grade = 'A' for the course;
SQL: SELECT T2.name FROM registration AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T1.grade = 'A' AND T2.diff = 1 GROUP BY T2.name ORDER BY COUNT(T1.student_id) DESC LIMIT 1
Database: cs_semester
Question: How many courses does the student with the highest GPA this semester take?
Evidence: student with the highest GPA refers to student_id where MAX(gpa);
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
Question: How many students does Ogdon Zywicki advise?
Evidence: Ogdon Zywicki is a professor;
SQL: SELECT COUNT(T1.student_id) FROM RA AS T1 INNER JOIN prof AS T2 ON T1.prof_id = T2.prof_id WHERE T2.first_name = 'Ogdon' AND T2.last_name = 'Zywicki'
Database: cs_semester
Question: What is the name of the course with the highest satisfaction from students?
Evidence: sat refers to student's satisfaction degree with the course where sat = 5 stands for the highest satisfaction;
SQL: SELECT DISTINCT T2.name FROM registration AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T1.sat = 5
Database: cs_semester
Question: What are the names of the courses that the students with the lowest intelligence are least satisfied with?
Evidence: lower intelligence refers to intelligence = 1; sat refers to student's satisfaction degree with the course where least satisfaction refers to sat = 1;
SQL: SELECT T3.name FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T2.sat = 1 AND T1.intelligence = 1
Database: cs_semester
Question: Which of the two courses, "Advanced Operating System" or "Intro to BlockChain', did most of the students receive an A in?
Evidence: A refers to an excellent grade in which grade = 'A';
SQL: SELECT T2.name FROM registration AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T1.grade = 'A' AND T2.name IN ('Advanced Operating System', 'Intro to BlockChain') GROUP BY T2.name ORDER BY COUNT(T1.student_id) DESC LIMIT 1
Database: cs_semester
Question: What is the popularity of the professor who advises the highest number of students with the highest research ability?
Evidence: professor with the highest research ability refers to prof_id where MAX(capability);
SQL: SELECT T2.popularity FROM RA AS T1 INNER JOIN prof AS T2 ON T1.prof_id = T2.prof_id GROUP BY T1.prof_id, T1.capability ORDER BY COUNT(T1.student_id) DESC, T1.capability DESC LIMIT 1
Database: cs_semester
Question: What is the average number of students who registered for the courses with a difficulty of 4?
Evidence: diff refers to difficulty; DIVIDE(COUNT(student_id where diff = 4), COUNT(course_id where diff = 4));
SQL: SELECT CAST(COUNT(T1.student_id) AS REAL) / COUNT(DISTINCT T2.course_id) FROM registration AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T2.diff = 4
Database: cs_semester
Question: How many students, who have a GPA between 3 to 4, failed a course?
Evidence: 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;
SQL: SELECT COUNT(T2.student_id) FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id WHERE T2.grade IS NULL AND T1.gpa BETWEEN 3 AND 4
Database: cs_semester
Question: How many students taking a bachelor's degree received an A in all of the courses that they took?
Evidence: bachelor's degree is an undergraduate degree in which type = 'UG'; A refers to an excellent grade in which grade = 'A';
SQL: SELECT COUNT(T2.student_id) FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id WHERE T2.grade = 'A' AND T1.type = 'UG'