← Relational algebra: all 5 exercises
Databases · Free practice
Relational Algebra, Exercise 1: Selection, join and projection
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)
- Selection σcondition(R) keeps the rows that satisfy the condition.
- Natural join R ⋈ S pairs rows that agree on the common attributes (here, eid).
- Projection πattributes(R) keeps only the listed columns and removes duplicates.
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