Skip to main content

RA: employees on project DBMS

Short answer

Natural join employee, work, project; select where p_name = 'DBMS'; project name: π name (σ p_name='DBMS' (employee ⋈ work ⋈ project)).

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 working on project named "DBMS". (Write a relational algebra expression.)

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

Relational algebra expression

π name ( σ p_name = "DBMS" ( employee ⋈ work ⋈ project ) )

Explanation

  1. employee ⋈ work joins on the common attribute e_no, so each employee is paired with the projects he or she works on.
  2. The result ⋈ project joins on p_no and brings in the project name.
  3. σ p_name = "DBMS" keeps only the tuples of the DBMS project.
  4. π name outputs only the employee names (duplicates are removed automatically in relational algebra).

Equivalent SQL (checked on sample data)

SELECT DISTINCT e.name
FROM employee e JOIN work w ON e.e_no = w.e_no
                JOIN project p ON p.p_no = w.p_no
WHERE p.p_name = 'DBMS';

✓ Answer checked by Claude Opus 5.5 (high effort)

All Database Management System chapter 3 questions →