Ask your own question, for FREE!
Mathematics 16 Online
OpenStudy (anonymous):

Using primitive relational algebra operations, describe how to select a maximum value out of a relation of values.

OpenStudy (anonymous):

It's not obvious, huh?

OpenStudy (anonymous):

yeah i am not sure on this one i will look into it but its a difficult one

OpenStudy (anonymous):

Let's consider this relation: Values [100] [ 90 ] [101] [200] [306] [ 52 ] describe a procedure using primitive relational algebra operations that will not only get the tuple containing the largest integer out of all the tuples in this relation, but would also work on any relation with the same number of attributes (i.e. 1)

OpenStudy (anonymous):

so basically, I want to obtain [306]

OpenStudy (anonymous):

Hmmm... Recursively applying Select > on consecutive elements all the way through the list.

OpenStudy (anonymous):

Interesting problem but I have to head to work...

OpenStudy (anonymous):

\[Values\] \[-\] \[\pi_{v1}(\sigma_{v1<v2}(\rho_{v1,v2}(Values\ \times\ Values)))\]

OpenStudy (anonymous):

That looks about right. You're using less than, though?

OpenStudy (anonymous):

So it works? yay

OpenStudy (anonymous):

and if I want the minimum, I use >?

OpenStudy (anonymous):

I think the other way around. select v1<v2 should give you all tuples where v1 is < v2. for max you want it the other way around.

OpenStudy (anonymous):

yeah

OpenStudy (anonymous):

I just got all the smaller tuples in one single-dimension list, and subtracted it from the original in order to get just the tuple with the largest value in it.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!