- Year not given
RA: employee-projects with no part used
Short answer
Find (e_no,p_no) from work minus use, join employee and project, project name and p_name: π name, p_name (employee ⋈ project ⋈ (π e_no,p_no(work) − π e_no,p_no(use))).
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) List names of employees and projects with which employees are associated with and for which they have used no part so far. (Write a relational algebra expression.)
Relational algebra symbols used: σ select, π project, ⋈ natural join, ∪ union, ∩ intersection, − difference, ρ rename, 𝒢 aggregate.
Relational algebra expression
π name, p_name ( employee ⋈ project ⋈
( π e_no, p_no (work) − π e_no, p_no (use) ) )
Explanation
- π e_no, p_no (work) lists every (employee, project) association.
- π e_no, p_no (use) lists the pairs for which at least one part was used.
- The difference leaves the pairs where the employee works on the project but has used no part there.
- Joining with employee (on e_no) and project (on p_no) brings in the names, and the final projection prints the employee name and the project name.
Both operands of the − have the same attributes (e_no, p_no), so they are union-compatible.
Equivalent SQL
SELECT e.name, p.p_name
FROM work w JOIN employee e ON e.e_no = w.e_no
JOIN project p ON p.p_no = w.p_no
WHERE NOT EXISTS (SELECT 1 FROM use u
WHERE u.e_no = w.e_no AND u.p_no = w.p_no);
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- RA: projects where all used bolts size 6 · Database Management System, chapter 3
- RA: employees on no project · Database Management System, chapter 3
- RA: employees on project DBMS · Database Management System, chapter 3
- RA: employees in both DBMS and MIS · 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