Relational Algebra & Calculus


Answer & solution
Answer: After qualifying SELECT EMP.eno, the set-algebra answer is π_EMP.eno(σ_EMP.eno=INVOLVED.eno ∧ INVOLVED.pno=3(EMP×INVOLVED)). Literal SQL has an ambiguous column reference. (no official key was published)
First distinguish the printed query from its evident intention. Both EMP and INVOLVED have a column named eno, and an explicit FROM EMP,INVOLVED cross join retains both column names. The equality in WHERE does not make the unqualified SELECT eno syntactically unambiguous in standard SQL. The literal query therefore requires qualification. Taking the intended target as EMP.eno gives:
π_EMP.eno(σ_EMP.eno=INVOLVED.eno ∧ INVOLVED.pno=3(EMP × INVOLVED)).
The Cartesian product produces all employee/participation row pairs. Selection keeps only pairs referring to the same employee and project number 3. Projection then retains the requested employee number. One may push the project filter down before the product, obtaining π_EMP.eno(σ_EMP.eno=INVOLVED.eno(EMP × σ_pno=3(INVOLVED))), which is set-equivalent and usually more efficient.
Attribute qualification in the first formula prevents confusion between the two eno fields and the two relations. A natural join EMP ⋈ INVOLVED followed by σ_pno=3 and π_eno is also valid here because eno is their only shared attribute name. PROJ is not used: the SQL never checks whether project 3 exists in PROJ, and adding that join would impose an extra condition not present in the query.
The displayed composite primary key (eno,pno) of INVOLVED rules out duplicate employee–project pairs, and EMP.eno is also a primary key. After restricting INVOLVED.pno to 3, there is at most one qualifying involvement row for each employee, and the join matches at most one EMP row. Therefore the qualified SELECT returns each selected employee number at most once. Although SQL SELECT normally uses bag semantics and ordinary relational algebra uses sets, that difference does not change this query’s result under the stated keys. No added DISTINCT or extra uniqueness assumption is needed. The printed unqualified SELECT eno still requires the column-name repair explained above.