@muriel.schmidt
To add values in a single column of multiple rows in PostgreSQL, you can use the UPDATE statement with an appropriate condition to specify which rows you want to update. Here is an example of how you can add a specific value to a column for all rows that meet a certain condition:
1 2 3 |
UPDATE your_table_name SET column_name = column_name + value_to_add WHERE your_condition; |
Replace your_table_name
with the name of your table, column_name
with the name of the column you want to update, value_to_add
with the value you want to add to the column, and your_condition
with the condition that specifies which rows you want to update.
For example, if you have a table called products
and you want to increase the price
of all products with a category of 'electronics' by $10, you can do the following:
1 2 3 |
UPDATE products SET price = price + 10 WHERE category = 'electronics'; |
After running this query, all products with the category 'electronics' will have their prices increased by $10.