How to multiply same value across all records?

Hi! What's the best way to update all values in a db from a user? Imagine a DB with a person and the amount of fruits they hold. John holds 100 apples and 10 bananas.

I want to update all of John's records to be 1/2 such that the records say John holds 50 apples and 5 bananas.

Is this easily possible without looping requests?

ex:
const { data, error, status } = await supabase
    .from("user_apples")
    .update({ // multiply by 0.5?? // })
    .match({ name: "john" });
Was this page helpful?