need help with this two quieries. students(sid,name,age,gpa) // sid is the prima
ID: 3806541 • 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. A list of those departments that offer more than 10 courses.
b. Produce a list of the name of those students whose professor’s name starts with an M. Your result must have no duplicates.
Explanation / Answer
a. select deptid from courses group by deptid having count(cid) > 10
b. select distinct s.name from students s join enrollment e on s.sid=e.sid join courses c on e.cid=c.cid join professors p on c.deptid=p.deptid where p.name like 'M%'
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.