I am learning SQL and I have a database with two empty columns, Suma
, Producto
and I want to add the attributes of the selected names (I put a *
so that they know which one I select) and I want to put a condition to my sum according to its size and the result of the condition I want to put it in the product column but I do not know how to do this.
INSERT INTO Atleticos.Producto (Suma) VALUES (SUMA)
SELECT SUM(Attributos) Suma FROM Atleticos WHERE name = '????*'
IF Suma < 0.6
Producto = Suma*4
ELSEIF Suma >= 0.6 and Suma<= 5
Producto = Suma * 3 + 5
ELSE
Producto = Suma * 2;
ENDIF
Sum < 0.6, Multiply it by 4 and store it in Product
0.6 ≤ Sum ≤ 5, Multiply it by 3 + 5 and store it in Product
Sum > 5, Multiply it by 2 and store it in Product
This is the table, sum and product is what I want to fill out
Nombres Attributos Altura Suma Producto
Pedro* 0.5 5.1 0.5 2
Anna 0.6 4.3
Carla* 0.3 6.4 0.8 7.4
Johan* 0.4 3.4 1.2 8.6
Bryan 10 6
Cecilia* 5 5.7 6.2 12.4