Answer the question
In order to leave comments, you need to log in
How to increase the value of a cell in all rows of a table?
Good afternoon
There is a table with a million records
The table has an int field (position)
Help me write a query that will increase the position value in ALL records by 1
Can this be done in pure SQL?
If not, then you can add python
Answer the question
In order to leave comments, you need to log in
It is possible without where:
An important point, decide what to do if the field value is null - write 1 or leave null. If the first - add the second command update table1 set col1=1 where col is null
, if the second - the first command will suffice.
Have you tried simple?
UPDATE table1
SET col1 = col1+1
WHERE 1=1
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question