Question: Write the following queries in SQL. 1. Consider the following database schema describing students enrolled in sections of classes at a university. student (sid*, sname,


Write the following queries in SQL.
1. Consider the following database schema describing students enrolled in sections of classes at a university. student (sid*, sname, sex, age, year, gpa) [Year is a number between 1 and 5). dept(dname*, numphds) prof(pname*, dname) course(cno*, cname, dname*) (Course numbers are unique within departments.] major(dname*, sid*) section(dname*, cno*, sectno*, pname) (Associates an instructor to a section.] enroll(sid*, grade, dname*, cno*, sectno*) (Associates students to sections. (k) For each professor, list in a single record) the total number of that professor's enrollments, the total number of enrollments from students majoring in that professor's department, and the total number of enrollments from students majoring in other departments. Hint: use the SQL CASE statement in the SELECT clause. (1) How many students have taken courses from either Computer Sciences" or "Civil Engineering"? (Make sure you don't count a student more than once.) (m) Find pairs of student names and professor names such that the given student has taken every section of every course taught by that professor. Don't list a student/professor pair more than once. Hint. This is a tricky query, which will need nesting
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
