Question: need help with this two quieries in sql. 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) //
need help with this two quieries in sql.
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
Write a query that produces the following table:
| Deptid | Sps | %A | %B | %C | %D | %F |
| cs |
|
|
|
|
|
|
| math |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Where SPS is the average number of students in each section and column %A has the percentage of students that got an A, and so on, over all the courses offered by each department. Assume a small section have less than 30 students, medium sections have at least 30 but less than 80, and large sections have at least 80 students.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
