$24
• INSTRUCTIONS
(1) This lab is graded.
(2) Use the attached files for this exercise. Note that the table “enrolled” includes grades.
• QUESTION 1
Consider the following relations:
Student(snum: integer, sname: string, major: string, level: string, age: integer, total_credits: integer)
Class(name: string, meets_at: time, room: string, fid: integer)
Enrolled(snum: integer, cname: string, varchar:grade)
Faculty (fid: integer, fname: string, deptid: integer)
(1) Write an SQL function that returns the number of students enrolled in a course by a given instructor. Using this function, list the names of instructors who teach more than 1 student. Use SQL command line. [ 5 Marks]
(2) Write an SQL function that returns the number of students who have got an F grade in a given course. Using this function, list the names of instructors who are teaching a course for which more than 1 student has an F grade. Use SQL command line. [5 Marks]
.
1