Relational Algebra & Calculus


Answer & solution
Answer: Registered: π_rollno(σ_cno=322(REGISTERED_FOR)). Not registered: π_rollno(STUDENTS) − π_rollno(σ_cno=322(REGISTERED_FOR)). (no official key was published)
1. Select registrations for course 322 before projecting rollno, so registrations in other courses do not count.
2. For the registered variant, projection directly returns the wanted roll numbers under the usual valid student-reference assumption. Without that assumption, intersect with π_rollno(STUDENTS).
3. For the not-registered variant, subtract the selected roll-number set from all student roll numbers. Selecting registrations where cno≠322 would be wrong because a student may register for both 322 and another course, or for no course.
- No single query answers both variants.