I have the relation employee(key, salary, bonus) and I want to create a new relation R(key, totalMoney) where totalMoney = salary + bonus.
My try:
R1(key,totalMoney) = project key, salary (employee)
R2(key,totalMoney) = project key, bonus (employee)
R = key aggregate sum totalMoney (R1 U R2)
What is anything wrong?
I want to get RT2(key, totalMoney * 2).
My try:
RT2 = update totalMoney <- totalMoney * 2 (R)
update is a relational algebra operator.
What is anything wrong?
Codd's original algebra did not include such an operation because he firmly believed that such computations should be done in the application.
And alas most of what is being taught these days is still very close to these original ideas of Codd's. Which are 40 years old by now. And so all the evolutions that have taken place during those 40 years are, alas, mostly overlooked.
One of those things is the EXTEND operator that was introduced, somewhere along the line, by Chris Date & Hugh Darwen I believe. This operator takes care of exactly what you need.