Deviopath › PostgreSQL

Raise Prices and Report Back

Medium · Update

Adding RETURNING to an INSERT, UPDATE or DELETE makes the statement return the rows it changed, so you do not need a second SELECT.

Increase the price of every product with stock below 20 by 10%, rounded to 2 decimals (ROUND(price * 1.10, 2)). The statement itself must return the changed rows with the columns id, name and price (the new price). Row order does not matter.

Next: Paid vs Pending