Working with databases, how can I find MAX using relational algebra?
Just my two cents as I was trying to solve this today myself.
Lets say we have A = 1,2,3
If you use
A x A - (select 'a1' < 'a2') ((rename 'a' as 'a1')(A) x (rename 'a' as 'a2')(A))
you will not get the single max value rather two columns like 1|1, 2|1,3|2,3|1,3|2,3|3
the way to get just 3 is
project(a)A - project(a1)((select 'a1' < 'a2') ((rename 'a' as 'a1')(A) x (rename 'a' as 'a2')(A)))
At least that is what I had to do in a similar situation.
Hope it helps someone