I'm a little new to postgres. I want to take a value (which is an integer) in a field in a postgres table and increment it by one. For example if the table 'totals' had 2 columns, 'name' and 'total', and Bill had a total of 203, what would be the SQL statement I'd use in order to move Bill's total to 204?
Postgresql – Increment a value in Postgres
incrementpostgresql
Related Topic
- Mysql – Increment a database field by 1
- Sql – Reset auto increment counter in postgres
- Sql – Completely copying a postgres table with SQL
- Sql – postgres: upgrade a user to be a superuser
- Postgresql – Alphanumeric case in-sensitive sorting in postgres
- Ruby-on-rails – Getting error: Peer authentication failed for user “postgres”, when trying to get pgsql working with rails
Best Answer
If you want to make sure the current value is indeed 203 (and not accidently increase it again) you can also add another condition: