Is there a way to do this? I imagine the following will not work.
UPDATE table SET column = column + 1 ...
Other than writing a function or using PHP, is there a way to do this with a query?
It is very easy to update multiple columns in PostgreSQL. Here is the syntax to update multiple columns in PostgreSQL. UPDATE table_name SET column1 = value1, column2 = value2, ... [WHERE condition];
PostgreSQL implements multiversioning by keeping the old version of the table row in the table – an UPDATE adds a new row version (“tuple”) of the row and marks the old version as invalid. In many respects, an UPDATE in PostgreSQL is not much different from a DELETE followed by an INSERT .
To change a numeric value within the grid, double-click the value to select the field. Modify the content in the square in which it is displayed. To change a non-numeric value within the grid, double-click the content to access the edit bubble.
Did you try it? It should just work.
It'll just work:
# psql -U postgres
psql (9.0.1)
Type "help" for help.
postgres=# create database test;
CREATE DATABASE
postgres=# \c test
You are now connected to database "test".
test=# create table test (test integer);
CREATE TABLE
test=# insert into test values (1);
INSERT 0 1
test=# insert into test values (2);
INSERT 0 1
test=# select * from test;
test
------
1
2
(2 rows)
test=# update test set test = test + 1;
UPDATE 2
test=# select * from test;
test
------
2
3
(2 rows)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With