Skip to main content

RA: employees on Network over 15 hours

Short answer

Select the Network project, join with work, keep hours greater than 15, join with emp, then project name. Expression: π name ( emp ⋈ σ hours > 15 ( work ⋈ σ title = "Network" (project) ) ).

Consider the relational schema: emp (eid, name, add, sup_eid) dep (dep_id, name) project (pid, title, dep_id) work (eid, pid, hours) Find name of all employees who work on "Network" project for more than 15 hours. (Write a relational algebra expression.)

Relational algebra symbols used: σ select, π project, ⋈ natural join, ∪ union, ∩ intersection, − difference, ρ rename, 𝒢 aggregate.

Relational algebra expression

π name ( emp ⋈ σ hours > 15 ( work ⋈ σ title = "Network" (project) ) )

Explanation

  1. σ title = "Network" (project) selects the Network project.
  2. Joining with work on pid gives all work tuples of that project.
  3. σ hours > 15 keeps only the tuples where the employee worked more than 15 hours.
  4. Joining with emp on eid brings in the employee, and π name prints the names.

The expression is correct because emp and work share only eid, and work and project share only pid, so each natural join matches on the intended attribute.

Equivalent SQL (tested)

SELECT DISTINCT e.name
FROM emp e JOIN work w ON e.eid = w.eid
           JOIN project p ON p.pid = w.pid
WHERE p.title = 'Network' AND w.hours > 15;

✓ Answer checked by Claude Opus 5.5 (high effort)

All Database Management System chapter 3 questions →