← Relational algebra: all 5 exercises
Databases · Free practice
Relational Algebra, Exercise 5: Intersection
Watch the worked solution by Dr. J. Ubaldo Quevedo, then practice as many times as you want: every click of New database gives you new data to work with.
1. Watch
The relations: employees(eid, name, salary, did, m_did) · projects(pid, description) · works_on(eid, pid, hours) · departments(did, location)
- Intersection R ∩ S keeps the rows that are in both R and S.
- One works_on row has only one pid, so σpid='X' ∧ pid='Y' is always empty.
- Instead, find the eids on each project separately, then intersect.
2. Try it yourself
Practice as many times as you want. New database fills the tables with new employees, salaries and hours, and New question changes the details of the query. It's free, and you don't need an account.
Correct so far: 0