- Year not given
RA: employees on no project
Short answer
All employee numbers minus those in work, join with employee and project name: π name (employee ⋈ (π e_no(employee) − π e_no(work))).
Consider the relational schema: employee (e_no, name, address) project (p_no, p_name) work (e_no, p_no) part (part_no, part_name, qty, size) use (e_no, p_no, part_no, number) Print names of employees not working on any project. (Write a relational algebra expression.)
Relational algebra symbols used: σ select, π project, ⋈ natural join, ∪ union, ∩ intersection, − difference, ρ rename, 𝒢 aggregate.
Relational algebra expression
π name ( employee ⋈ ( π e_no (employee) − π e_no (work) ) )
Explanation
- π e_no (employee) is the set of all employee numbers.
- π e_no (work) is the set of employees who work on at least one project.
- The difference gives the e_no of employees who appear in no work tuple.
- Joining back with employee gets their details, and π name prints the names.
The difference operator is needed because "not" cannot be expressed by selection alone.
Equivalent SQL
SELECT name FROM employee
WHERE e_no NOT IN (SELECT e_no FROM work);
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- RA: employees on project DBMS · Database Management System, chapter 3
- RA: employee-projects with no part used · Database Management System, chapter 3
- RA: employees in both DBMS and MIS · Database Management System, chapter 3
- RA: projects where all used bolts size 6 · Database Management System, chapter 3
- RA: parts used in DBMS and MIS · Database Management System, chapter 3
- RA: computer dept employees and supervisors · Database Management System, chapter 3
- RA: employees on Network over 15 hours · Database Management System, chapter 3