| Algebra | SQL |
|---|---|
r ∪ s | UNION |
r ∩ s | INTERSECT |
r − s | EXCEPT |
π course_id (σ semester = 'Fall' ∧ year = 2025 (teaches)) ∪ π course_id (σ semester = 'Winter' ∧ year = 2026 (teaches))- The same two expressions with
∩. π id (student) − π s_id (advisor)- How many tuples does
π dept_name (department) − π dept_name (instructor)return? - Relational algebra has no MAX. This expression finds the highest salary with the fundamental operators. Write its SQL:
text
π salary (instructor) − π i.salary (σ i.salary < j.salary (ρ i (instructor) × ρ j (instructor)))