List all the courses (their id) and for each course return the number of courses
ID: 3890906 • Letter: L
Question
List all the courses (their id) and for each course return the number of courses it has as a prerequisite.
Return the number of courses for which the average grade of all students enrolled in the course is lower than ‘B’ (grade point below 3.0).
Explanation / Answer
Query 1:
select cid, count(pid) from prereq group by cid
union
select cid,0 from cources where cid not in (select cid from prereq);
Query 2:
select * from
(select grade, avg(gradepoint) gradepoint from enroll group by grade) where gradepoint<3;
output:
grade gradepoint
______ __________
C 2
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.