This is the database I am using for my queries
https://class.stanford.edu/c4x/DB/RA/asset/pizzadata.html
the syntax for writing out relational algebra queries is based off http://www.cs.duke.edu/~junyang/ra/ .
My objective is to "Find the age of the oldest person (or people) who eat mushroom pizza. ". I have the fist two steps but I am trouble with finding the oldest age.
This is my query so far
\project_{age} (
\select_{pizza="mushroom"}
( Eats
\join Person )
)
The query runs find but it gets a relation of all the ages, not the oldest age. My first step was to get only the tuples inside Eats that included people who ate mushroom pizza. My next step was to join the Eats relation with the Person relation to get the ages of the people who ate mushroom pizza. I am stuck at step of finding the large. In java, my algorithm for doing this was to have some temp value named max and to use an iterator to constantly compare the value to the max, if it is greater than max, set it to max. But this is relational algebra. Is there a tool I can use to do this. I thought about joining what I have to itself, but that would only compare two at a time