I am making up exercises for myself and stumbled across this question:
Given this example relation:
Person(name, birthyear)
Find the relational algebra expression to find the youngest person per name. For example, you have the entries:
(A, 1), (A,2), (B,3), (B,4), (C,5), (C,6)
Expression returns:
(A,1), (B,3), (C,5)
My solution:
ρ p1 (Person) - σ p1.name = p2.name AND p1.birthYear > p2.birthYear (ρ p2 (Person))
Do I accomplish my goal? So yes, will I have doubles and how to elliminate them if I do?
Thanks in advance,