Working with databases, how can I find MAX using relational algebra?
lets think we have a relation with an attribute A and values 1,2,3
A
1
2
3
so now..
project A values and rename with A1
A1
1
2
3
again project A values and rename with A2
A2
1
2
3
join this with A2\join_{A2
so the - Output schema: (A2 integer, A1 integer)
A2
hear always A2 values will be less than A1 because we join like that(a2
now project A2 the output is like below
A2
1
2
now diff with original attribute
A diff A2
A
1
2
3
diff
A2
1
2
Output is 3 maximum value