- Year not given
RA: delete Electrical dept projects
Short answer
Find Electrical department dep_id, then delete matching projects by assignment: project ← project - (project ⋈ E).
Consider the relational schema: emp (eid, name, add, sup_eid) dep (dep_id, name) project (pid, title, dep_id) work (eid, pid, hours) Delete projects belonging to Electrical dept. (Write a relational algebra expression.)
Relational algebra symbols used: σ select, π project, ⋈ natural join, ∪ union, ∩ intersection, − difference, ρ rename, 𝒢 aggregate.
Relational algebra expression
E ← π dep_id ( σ name = "Electrical" (dep) )
project ← project − ( project ⋈ E )
Explanation
- σ name="Electrical"(dep) selects the Electrical department, and π dep_id gives its id as relation E.
- project ⋈ E keeps the projects whose dep_id matches (the join is on the common attribute dep_id). Because E has only dep_id, the result keeps the schema of project (pid, title, dep_id), so the difference is valid.
- Subtracting these tuples from project deletes them, and the result is assigned back to project.
To keep the database consistent, the work tuples of the deleted projects should also be removed:
work ← work − ( work ⋈ π pid ( project ⋈ E ) )
This must be done before project is changed, otherwise the pids can no longer be found.
Equivalent SQL
DELETE FROM project
WHERE dep_id IN (SELECT dep_id FROM dep WHERE name = 'Electrical');
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- RA: computer dept employees and supervisors · Database Management System, chapter 3
- RA: projects count per department · Database Management System, chapter 3
- RA: employees on Network over 15 hours · Database Management System, chapter 3
- RA: employee-projects with no part used · Database Management System, chapter 3
- RA: projects where all used bolts size 6 · Database Management System, chapter 3
- RA: delete loans under 1000 · Database Management System, chapter 3