0

I'm doing my assignment, and I can't figure out how do it.

For instance, I have to decrease the prices in a "movie" column by 3%...how do you update the table like that?

So, would you say:

UPDATE table_name
SET PRICE = (PRICE * 0.97);

?

Edited by java=hard: n/a

2
Contributors
4
Replies
10
Views
7 Years
Discussion Span
Last Post by java=hard
0

To add 3% to a number you can do price = price + (price * 0.3) or price = price * 1.03.

0

To add 3% to a number you can do price = price + (price * 0.3) or price = price * 1.03.

So 3% less would be PRICE / 1.3?

0

So 3% less would be PRICE / 1.3?

No, you should always multiply. number - 3% is number * 0.97, for instance $ 100 * 0.97 = $ 97 (and that is 3% or $ 3 less).
If you do 100 / 1.03 you get 97,087378640776699029126213592233 and that is not what we want.

But even if you multiply you should always use round($number,2) if $number is an amount of $, to make sure you don't end up with $ 4,0994 or something similar.

Edited by colweb: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.