I am trying to update the value of a column where it matches a certain userid
, but it keeps giving a syntax error.
UPDATE user
SET balance = 15000.000000000
WHERE id = 11203;
The table called user has many rows with two columns, balance
and id
. I am trying to edit the balance of the user id in the code.
Syntax. UPDATE table_name SET column1 = value1, column2 = value2...., columnN = valueN WHERE [condition];
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.
First, specify the table name that you want to change data in the UPDATE clause. Second, assign a new value for the column that you want to update. In case you want to update data in multiple columns, each column = value pair is separated by a comma (,). Third, specify which rows you want to update in the WHERE clause.
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 .
Try "user", or give a more generic name:
UPDATE "user"
SET balance = 15000.000000000
WHERE id = 11203;
or ALTER
your table name to "user_list" for example. Any doubt, please check
keywords
You need to escape user
since it is a reserved word. Try
UPDATE "user"
SET balance = 15000.000000000
WHERE id = 11203;
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