\Pi_{s.name,\ s.id}\left(\sigma_{d.name='ECE'}\left(\text{Student } s \bowtie_{s.dept\_id = d.dept\_id} \text{Department } d\right)\right) Write the…

\(\Pi_{s.name,\ s.id}\left(\sigma_{d.name='ECE'}\left(\text{Student } s \bowtie_{s.dept\_id = d.dept\_id} \text{Department } d\right)\right)\)

Write the equivalent SQL query for the given relational algebra expression.

From the BUET MSC (CSE) October 2026 – Written exam, question 8 of 14.

Answers (1)

Join Student with Department on dept_id, keep the ECE rows, and project the name and id. Relational algebra returns a set, so DISTINCT matches it exactly:

SELECT DISTINCT s.name, s.id
FROM Student s
JOIN Department d ON s.dept_id = d.dept_id
WHERE d.name = 'ECE';

— rhs

More from this paper