Skip to content
Advertisement

Set ALL Values of PostgreSQL column to X

I have a PostgreSQL database table with same sample data whose schema is shown below.

| UserId | XP | Level |
-----------------------
| 123456 | 55 | 12    |
| 134156 | 45 | 4     |
| 526083 | 39 | 5     |
| 115646 | 12 | 1     |

I want to set every value in the XP and Level column to 1. How would I do this? Thanks.

Advertisement

Answer

I want to reset every value in the XP and Level column back to 1.

You seem to be looking for a simple update query:

update mytable set xp = 1, level = 1
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement