How can I update 1 Column in SQL with different formula

Here is my table table name is "loan"

ID(int)        Loan Amount(Decimal)        Initial Amount(decimal)            Interest(Decimal)

1                   100000                       0                               5

2                   230000                       0                               10

3                   150000                       0                               2

I want to update all the value in "Initial Amount" column. I will add the result of (loan amount x interest rate)

Example Computation

100,000 x .05% = 5,000

then the value of 5,000 will update to "inital amount"


I think something like this would work:

update table
    set `initial amount` = `Loan Amount` * (`Interest Rate` / 100)

update your_table
set `initial amount` = `loan amount` * (`interest rate`/100.0)

Do you really need to update the value ? you can always get the Initial Amount(decimal) value with above data.The initial amount column can be logically created, and the value will always change depends on the loan amount and interest, so my suggestion is create the column when u need it.

select ID, [Loan Amount], [Interest Rate], 
(([Loan Amount] * [Interest Rate])/ 100) as [Initial Amount] 
from YourTable

Need Your Help

glReadPixels is reading from the wrong location

c++ opengl sdl glreadpixels

I am trying to read the color of a rectangle drawn on the screen, but when I try to read from a coord, it appears that it reads it from an offset but this offset is not consistent. (I am using the ...