need help with this two quieries. students(sid,name,age,gpa) // sid is the prima
ID: 3806615 • Letter: N
Question
need help with this two quieries.
students(sid,name,age,gpa) // sid is the primary key
courses(cid,deptid, description) // cid,deptid is the primary key
professors(ssn,name,address,phone,deptid) // ssn is the primary key
enrollment(sid,cid,section,grade) cid makes reference to the courses table. // sid, cid, and section is the primary key
teaches(cid,section,ssn). cid, section makes reference to the enrollment table // cid, section is the primary key
a. List of professors that work for departments with more than 20 faculty members and that offer more large sections than small and medium sections combined.
b. Assume grades are A, B, C, D, F where D and F are failing grades. For each course (section) find the percentage of students that failed the course.
Explanation / Answer
a. select t1.name as professors from professors t1,courses t2,teaches t3 where t1.deptid = t2.deptid group by t1.name having Count(t1.name) > 20
b. select t1.section, t1.grade , (Count(t1.grade)* 100 / (Select Count(*) From enrollment where t1.grade in ('D','F')) as Score from enrollment t1,cources t2 where t1.cid = t2.cid group by t1.section,t1.grade
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.